diff --git a/internal/clients/client.go b/internal/clients/client.go index 508a31ab1b27..a1e3e60f1a4e 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -405,7 +405,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.Logz = logz.NewClient(o) client.MachineLearning = machinelearning.NewClient(o) client.Maintenance = maintenance.NewClient(o) - client.ManagedApplication = managedapplication.NewClient(o) + if client.ManagedApplication, err = managedapplication.NewClient(o); err != nil { + return fmt.Errorf("building clients for Managed Applications: %+v", err) + } client.ManagementGroups = managementgroup.NewClient(o) if client.Maps, err = maps.NewClient(o); err != nil { return fmt.Errorf("building clients for Maps: %+v", err) diff --git a/internal/services/managedapplications/client/client.go b/internal/services/managedapplications/client/client.go index a02848e9d7ec..af86f10e2c44 100644 --- a/internal/services/managedapplications/client/client.go +++ b/internal/services/managedapplications/client/client.go @@ -4,24 +4,33 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications" // nolint: staticcheck + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ApplicationClient *managedapplications.ApplicationsClient - ApplicationDefinitionClient *managedapplications.ApplicationDefinitionsClient + ApplicationClient *applications.ApplicationsClient + ApplicationDefinitionClient *applicationdefinitions.ApplicationDefinitionsClient } -func NewClient(o *common.ClientOptions) *Client { - applicationClient := managedapplications.NewApplicationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&applicationClient.Client, o.ResourceManagerAuthorizer) +func NewClient(o *common.ClientOptions) (*Client, error) { + applicationClient, err := applications.NewApplicationsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Applications client: %+v", err) + } + o.Configure(applicationClient.Client, o.Authorizers.ResourceManager) - applicationDefinitionClient := managedapplications.NewApplicationDefinitionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&applicationDefinitionClient.Client, o.ResourceManagerAuthorizer) + applicationDefinitionClient, err := applicationdefinitions.NewApplicationDefinitionsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Application Definitions client: %+v", err) + } + o.Configure(applicationDefinitionClient.Client, o.Authorizers.ResourceManager) return &Client{ - ApplicationClient: &applicationClient, - ApplicationDefinitionClient: &applicationDefinitionClient, - } + ApplicationClient: applicationClient, + ApplicationDefinitionClient: applicationDefinitionClient, + }, nil } diff --git a/internal/services/managedapplications/managed_application_definition_data_source.go b/internal/services/managedapplications/managed_application_definition_data_source.go index ef90ab0c96fe..8fd9fa5655ea 100644 --- a/internal/services/managedapplications/managed_application_definition_data_source.go +++ b/internal/services/managedapplications/managed_application_definition_data_source.go @@ -7,14 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceManagedApplicationDefinition() *pluginsdk.Resource { @@ -45,21 +45,22 @@ func dataSourceManagedApplicationDefinitionRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApplicationDefinitionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := applicationdefinitions.NewApplicationDefinitionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("failed to read %s: %+v", id, err) } - - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.SetId(id.ID()) + d.Set("name", id.ApplicationDefinitionName) + d.Set("resource_group_name", id.ResourceGroupName) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + } + return nil } diff --git a/internal/services/managedapplications/managed_application_definition_resource.go b/internal/services/managedapplications/managed_application_definition_resource.go index d811dfff0dba..bc11d24d739c 100644 --- a/internal/services/managedapplications/managed_application_definition_resource.go +++ b/internal/services/managedapplications/managed_application_definition_resource.go @@ -8,15 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/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" @@ -31,7 +31,7 @@ func resourceManagedApplicationDefinition() *pluginsdk.Resource { Delete: resourceManagedApplicationDefinitionDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationDefinitionID(id) + _, err := applicationdefinitions.ParseApplicationDefinitionID(id) return err }), @@ -65,9 +65,9 @@ func resourceManagedApplicationDefinition() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(managedapplications.CanNotDelete), - string(managedapplications.None), - string(managedapplications.ReadOnly), + string(applicationdefinitions.ApplicationLockLevelCanNotDelete), + string(applicationdefinitions.ApplicationLockLevelNone), + string(applicationdefinitions.ApplicationLockLevelReadOnly), }, false), }, @@ -97,6 +97,7 @@ func resourceManagedApplicationDefinition() *pluginsdk.Resource { ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: pluginsdk.SuppressJsonDiff, ConflictsWith: []string{"package_file_uri"}, + RequiredWith: []string{"main_template"}, }, "description": { @@ -111,6 +112,7 @@ func resourceManagedApplicationDefinition() *pluginsdk.Resource { ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: pluginsdk.SuppressJsonDiff, ConflictsWith: []string{"package_file_uri"}, + RequiredWith: []string{"create_ui_definition"}, }, "package_enabled": { @@ -125,7 +127,7 @@ func resourceManagedApplicationDefinition() *pluginsdk.Resource { ValidateFunc: validation.IsURLWithHTTPorHTTPS, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -136,55 +138,47 @@ func resourceManagedApplicationDefinitionCreateUpdate(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApplicationDefinitionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := applicationdefinitions.NewApplicationDefinitionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("failed to check for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_managed_application_definition", id.ID()) } } - parameters := managedapplications.ApplicationDefinition{ - Location: utils.String(azure.NormalizeLocation(d.Get("location"))), - ApplicationDefinitionProperties: &managedapplications.ApplicationDefinitionProperties{ + parameters := applicationdefinitions.ApplicationDefinition{ + Location: pointer.To(location.Normalize(d.Get("location").(string))), + Properties: applicationdefinitions.ApplicationDefinitionProperties{ Authorizations: expandManagedApplicationDefinitionAuthorization(d.Get("authorization").(*pluginsdk.Set).List()), - Description: utils.String(d.Get("description").(string)), - DisplayName: utils.String(d.Get("display_name").(string)), + Description: pointer.To(d.Get("description").(string)), + DisplayName: pointer.To(d.Get("display_name").(string)), IsEnabled: utils.Bool(d.Get("package_enabled").(bool)), - LockLevel: managedapplications.ApplicationLockLevel(d.Get("lock_level").(string)), + LockLevel: applicationdefinitions.ApplicationLockLevel(d.Get("lock_level").(string)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("create_ui_definition"); ok { - parameters.CreateUIDefinition = utils.String(v.(string)) + parameters.Properties.CreateUiDefinition = &v } if v, ok := d.GetOk("main_template"); ok { - parameters.MainTemplate = utils.String(v.(string)) - } - - if (parameters.CreateUIDefinition != nil && parameters.MainTemplate == nil) || (parameters.CreateUIDefinition == nil && parameters.MainTemplate != nil) { - return fmt.Errorf("if either `create_ui_definition` or `main_template` is set the other one must be too") + parameters.Properties.MainTemplate = &v } if v, ok := d.GetOk("package_file_uri"); ok { - parameters.PackageFileURI = utils.String(v.(string)) + parameters.Properties.PackageFileUri = pointer.To(v.(string)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) - if err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("failed to create %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("failed to wait for creation of %s: %+v", id, err) - } d.SetId(id.ID()) @@ -196,47 +190,52 @@ func resourceManagedApplicationDefinitionRead(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationDefinitionID(d.Id()) + id, err := applicationdefinitions.ParseApplicationDefinitionID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Managed Application Definition %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("failed to read Managed Application Definition %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ApplicationDefinitionName) + d.Set("resource_group_name", id.ResourceGroupName) // missing from response? + + if model := resp.Model; model != nil { + p := model.Properties + + d.Set("location", location.NormalizeNilable(model.Location)) - if props := resp.ApplicationDefinitionProperties; props != nil { - if err := d.Set("authorization", flattenManagedApplicationDefinitionAuthorization(props.Authorizations)); err != nil { + if err := d.Set("authorization", flattenManagedApplicationDefinitionAuthorization(p.Authorizations)); err != nil { return fmt.Errorf("setting `authorization`: %+v", err) } - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("package_enabled", props.IsEnabled) - d.Set("lock_level", string(props.LockLevel)) - } + d.Set("description", p.Description) + d.Set("display_name", p.DisplayName) + d.Set("package_enabled", p.IsEnabled) + d.Set("lock_level", string(p.LockLevel)) + + // the following are not returned from the API so lets pull it from state + if v, ok := d.GetOk("create_ui_definition"); ok { + d.Set("create_ui_definition", v.(string)) + } + if v, ok := d.GetOk("main_template"); ok { + d.Set("main_template", v.(string)) + } + if v, ok := d.GetOk("package_file_uri"); ok { + d.Set("package_file_uri", v.(string)) + } - // the following are not returned from the API so lets pull it from state - if v, ok := d.GetOk("create_ui_definition"); ok { - d.Set("create_ui_definition", v.(string)) - } - if v, ok := d.GetOk("main_template"); ok { - d.Set("main_template", v.(string)) - } - if v, ok := d.GetOk("package_file_uri"); ok { - d.Set("package_file_uri", v.(string)) + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceManagedApplicationDefinitionDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -244,30 +243,25 @@ func resourceManagedApplicationDefinitionDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationDefinitionID(d.Id()) + id, err := applicationdefinitions.ParseApplicationDefinitionID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("failed to delete Managed Application Definition %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("failed to wait for deleting Managed Application Definition (Managed Application Definition Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("issuing AzureRM delete request for '%s': %+v", *id, err) } return nil } -func expandManagedApplicationDefinitionAuthorization(input []interface{}) *[]managedapplications.ApplicationAuthorization { - results := make([]managedapplications.ApplicationAuthorization, 0) +func expandManagedApplicationDefinitionAuthorization(input []interface{}) *[]applicationdefinitions.ApplicationAuthorization { + results := make([]applicationdefinitions.ApplicationAuthorization, 0) for _, item := range input { v := item.(map[string]interface{}) - result := managedapplications.ApplicationAuthorization{ - RoleDefinitionID: utils.String(v["role_definition_id"].(string)), - PrincipalID: utils.String(v["service_principal_id"].(string)), + result := applicationdefinitions.ApplicationAuthorization{ + RoleDefinitionId: v["role_definition_id"].(string), + PrincipalId: v["service_principal_id"].(string), } results = append(results, result) @@ -275,26 +269,16 @@ func expandManagedApplicationDefinitionAuthorization(input []interface{}) *[]man return &results } -func flattenManagedApplicationDefinitionAuthorization(input *[]managedapplications.ApplicationAuthorization) []interface{} { +func flattenManagedApplicationDefinitionAuthorization(input *[]applicationdefinitions.ApplicationAuthorization) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - servicePrincipalId := "" - if item.PrincipalID != nil { - servicePrincipalId = *item.PrincipalID - } - - roleDefinitionId := "" - if item.RoleDefinitionID != nil { - roleDefinitionId = *item.RoleDefinitionID - } - results = append(results, map[string]interface{}{ - "role_definition_id": roleDefinitionId, - "service_principal_id": servicePrincipalId, + "role_definition_id": item.RoleDefinitionId, + "service_principal_id": item.PrincipalId, }) } diff --git a/internal/services/managedapplications/managed_application_definition_resource_test.go b/internal/services/managedapplications/managed_application_definition_resource_test.go index 4ab240620d4b..d4dea33ee231 100644 --- a/internal/services/managedapplications/managed_application_definition_resource_test.go +++ b/internal/services/managedapplications/managed_application_definition_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ManagedApplicationDefinitionResource struct{} @@ -110,17 +110,17 @@ func TestAccManagedApplicationDefinition_update(t *testing.T) { } func (ManagedApplicationDefinitionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApplicationDefinitionID(state.ID) + id, err := applicationdefinitions.ParseApplicationDefinitionID(state.ID) if err != nil { return nil, err } - resp, err := clients.ManagedApplication.ApplicationDefinitionClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.ManagedApplication.ApplicationDefinitionClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Managed Definition %s (resource group: %s): %v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ApplicationDefinitionProperties != nil), nil + return pointer.To(resp.Model != nil), nil } func (r ManagedApplicationDefinitionResource) basic(data acceptance.TestData) string { diff --git a/internal/services/managedapplications/managed_application_resource.go b/internal/services/managedapplications/managed_application_resource.go index 1e2364ada386..568b6b6971af 100644 --- a/internal/services/managedapplications/managed_application_resource.go +++ b/internal/services/managedapplications/managed_application_resource.go @@ -10,20 +10,21 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/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/managedapplications/2021-07-01/applicationdefinitions" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/validate" resourcesParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" - "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 resourceManagedApplication() *pluginsdk.Resource { @@ -34,7 +35,7 @@ func resourceManagedApplication() *pluginsdk.Resource { Delete: resourceManagedApplicationDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationID(id) + _, err := applications.ParseApplicationID(id) return err }), @@ -72,7 +73,7 @@ func resourceManagedApplication() *pluginsdk.Resource { "application_definition_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.ApplicationDefinitionID, + ValidateFunc: applicationdefinitions.ValidateApplicationDefinitionID, }, "parameters": { @@ -129,7 +130,7 @@ func resourceManagedApplication() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "outputs": { Type: pluginsdk.TypeMap, @@ -148,35 +149,35 @@ func resourceManagedApplicationCreateUpdate(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := applications.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("failed to check for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_managed_application", id.ID()) } } - parameters := managedapplications.Application{ - Location: utils.String(azure.NormalizeLocation(d.Get("location"))), - Kind: utils.String(d.Get("kind").(string)), + parameters := applications.Application{ + Location: pointer.To(location.Normalize(d.Get("location").(string))), + Kind: d.Get("kind").(string), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("managed_resource_group_name"); ok { - targetResourceGroupId := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s", meta.(*clients.Client).Account.SubscriptionId, v) - parameters.ApplicationProperties = &managedapplications.ApplicationProperties{ - ManagedResourceGroupID: utils.String(targetResourceGroupId), + targetResourceGroupId := commonids.NewResourceGroupID(meta.(*clients.Client).Account.SubscriptionId, v.(string)) + parameters.Properties = applications.ApplicationProperties{ + ManagedResourceGroupId: pointer.To(targetResourceGroupId.ID()), } } if v, ok := d.GetOk("application_definition_id"); ok { - parameters.ApplicationDefinitionID = utils.String(v.(string)) + parameters.Properties.ApplicationDefinitionId = pointer.To(v.(string)) } if v, ok := d.GetOk("plan"); ok { @@ -187,15 +188,12 @@ func resourceManagedApplicationCreateUpdate(d *pluginsdk.ResourceData, meta inte if err != nil { return fmt.Errorf("expanding `parameters` or `parameter_values`: %+v", err) } - parameters.Parameters = params + parameters.Properties.Parameters = pointer.To(interface{}(params)) - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) + err = client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("failed to create %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("failed to wait for creation of %s: %+v", id, err) - } d.SetId(id.ID()) @@ -207,44 +205,48 @@ func resourceManagedApplicationRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := applications.ParseApplicationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Managed Application %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("failed to read Managed Application %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("failed to read Managed Application %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("kind", resp.Kind) - if err := d.Set("plan", flattenManagedApplicationPlan(resp.Plan)); err != nil { - return fmt.Errorf("setting `plan`: %+v", err) - } - if props := resp.ApplicationProperties; props != nil { - id, err := resourcesParse.ResourceGroupIDInsensitively(*props.ManagedResourceGroupID) + d.Set("name", id.ApplicationName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + p := model.Properties + + d.Set("location", location.NormalizeNilable(model.Location)) + d.Set("kind", model.Kind) + if err := d.Set("plan", flattenManagedApplicationPlan(model.Plan)); err != nil { + return fmt.Errorf("setting `plan`: %+v", err) + } + + id, err := resourcesParse.ResourceGroupIDInsensitively(pointer.From(p.ManagedResourceGroupId)) if err != nil { return err } d.Set("managed_resource_group_name", id.ResourceGroup) - d.Set("application_definition_id", props.ApplicationDefinitionID) + d.Set("application_definition_id", p.ApplicationDefinitionId) - parameterValues, err := flattenManagedApplicationParameterValuesValueToString(props.Parameters) + parameterValues, err := flattenManagedApplicationParameterValuesValueToString(p.Parameters) if err != nil { return fmt.Errorf("serializing JSON from `parameter_values`: %+v", err) } d.Set("parameter_values", parameterValues) - parameters, err := flattenManagedApplicationParametersOrOutputs(props.Parameters) + parameters, err := flattenManagedApplicationParametersOrOutputs(p.Parameters) if err != nil { return err } @@ -252,16 +254,20 @@ func resourceManagedApplicationRead(d *pluginsdk.ResourceData, meta interface{}) return err } - outputs, err := flattenManagedApplicationParametersOrOutputs(props.Outputs) + outputs, err := flattenManagedApplicationParametersOrOutputs(p.Outputs) if err != nil { return err } if err = d.Set("outputs", outputs); err != nil { return err } + + if err = tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceManagedApplicationDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -269,35 +275,30 @@ func resourceManagedApplicationDelete(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := applications.ParseApplicationID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("failed to delete Managed Application %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("failed to wait for deleting Managed Application (Managed Application Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("failed to delete %s: %+v", *id, err) } return nil } -func expandManagedApplicationPlan(input []interface{}) *managedapplications.Plan { +func expandManagedApplicationPlan(input []interface{}) *applications.Plan { if len(input) == 0 { return nil } plan := input[0].(map[string]interface{}) - return &managedapplications.Plan{ - Name: utils.String(plan["name"].(string)), - Product: utils.String(plan["product"].(string)), - Publisher: utils.String(plan["publisher"].(string)), - Version: utils.String(plan["version"].(string)), - PromotionCode: utils.String(plan["promotion_code"].(string)), + return &applications.Plan{ + Name: plan["name"].(string), + Product: plan["product"].(string), + Publisher: plan["publisher"].(string), + Version: plan["version"].(string), + PromotionCode: pointer.To(plan["promotion_code"].(string)), } } @@ -325,75 +326,57 @@ func expandManagedApplicationParameters(d *pluginsdk.ResourceData) (*map[string] return &newParams, nil } -func flattenManagedApplicationPlan(input *managedapplications.Plan) []interface{} { +func flattenManagedApplicationPlan(input *applications.Plan) []interface{} { results := make([]interface{}, 0) if input == nil { return results } - name := "" - if input.Name != nil { - name = *input.Name - } - product := "" - if input.Product != nil { - product = *input.Product - } - publisher := "" - if input.Publisher != nil { - publisher = *input.Publisher - } - version := "" - if input.Version != nil { - version = *input.Version - } - promotionCode := "" - if input.PromotionCode != nil { - promotionCode = *input.PromotionCode - } - results = append(results, map[string]interface{}{ - "name": name, - "product": product, - "publisher": publisher, - "version": version, - "promotion_code": promotionCode, + "name": input.Name, + "product": input.Product, + "publisher": input.Publisher, + "version": input.Version, + "promotion_code": pointer.From(input.PromotionCode), }) return results } -func flattenManagedApplicationParametersOrOutputs(input interface{}) (map[string]interface{}, error) { +func flattenManagedApplicationParametersOrOutputs(input *interface{}) (map[string]interface{}, error) { results := make(map[string]interface{}) if input == nil { return results, nil } - for k, val := range input.(map[string]interface{}) { - mapVal, ok := val.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("unexpected managed application parameter or output type: %+v", mapVal) - } - if mapVal != nil { - v, ok := mapVal["value"] + attrs := *input + if _, ok := attrs.(map[string]interface{}); ok { + for k, val := range attrs.(map[string]interface{}) { + mapVal, ok := val.(map[string]interface{}) if !ok { - return nil, fmt.Errorf("missing key 'value' in parameters or output map %+v", mapVal) + return nil, fmt.Errorf("unexpected managed application parameter or output type: %+v", mapVal) } - switch t := v.(type) { - case float64: - results[k] = v.(float64) - case string: - results[k] = v.(string) - case map[string]interface{}: - // Azure NVA managed applications read call returns empty map[string]interface{} parameter 'tags' - // Do not return an error if the parameter is unsupported type, but is empty - if len(v.(map[string]interface{})) == 0 { - log.Printf("parameter '%s' is unexpected type %T, but we're ignoring it because of the empty value", k, t) - } else { + if mapVal != nil { + v, ok := mapVal["value"] + if !ok { + return nil, fmt.Errorf("missing key 'value' in parameters or output map %+v", mapVal) + } + switch t := v.(type) { + case float64: + results[k] = v.(float64) + case string: + results[k] = v.(string) + case map[string]interface{}: + // Azure NVA managed applications read call returns empty map[string]interface{} parameter 'tags' + // Do not return an error if the parameter is unsupported type, but is empty + if len(v.(map[string]interface{})) == 0 { + log.Printf("parameter '%s' is unexpected type %T, but we're ignoring it because of the empty value", k, t) + } else { + return nil, fmt.Errorf("unexpected parameter type %T", t) + } + default: return nil, fmt.Errorf("unexpected parameter type %T", t) } - default: - return nil, fmt.Errorf("unexpected parameter type %T", t) } } } @@ -401,26 +384,31 @@ func flattenManagedApplicationParametersOrOutputs(input interface{}) (map[string return results, nil } -func flattenManagedApplicationParameterValuesValueToString(input interface{}) (string, error) { +func flattenManagedApplicationParameterValuesValueToString(input *interface{}) (string, error) { if input == nil { return "", nil } - for k, v := range input.(map[string]interface{}) { - if v != nil { - delete(input.(map[string]interface{})[k].(map[string]interface{}), "type") + attrs := *input + if _, ok := attrs.(map[string]interface{}); ok { + for k, v := range attrs.(map[string]interface{}) { + if v != nil { + delete(attrs.(map[string]interface{})[k].(map[string]interface{}), "type") + } + } + + result, err := json.Marshal(input) + if err != nil { + return "", err } - } - result, err := json.Marshal(input) - if err != nil { - return "", err - } + compactJson := bytes.Buffer{} + if err := json.Compact(&compactJson, result); err != nil { + return "", err + } - compactJson := bytes.Buffer{} - if err := json.Compact(&compactJson, result); err != nil { - return "", err + return compactJson.String(), nil } - return compactJson.String(), nil + return "", nil } diff --git a/internal/services/managedapplications/managed_application_resource_test.go b/internal/services/managedapplications/managed_application_resource_test.go index e941ae362463..92c531a1ae5d 100644 --- a/internal/services/managedapplications/managed_application_resource_test.go +++ b/internal/services/managedapplications/managed_application_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ManagedApplicationResource struct{} @@ -167,17 +167,17 @@ func TestAccManagedApplication_parameterValues(t *testing.T) { } func (ManagedApplicationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApplicationID(state.ID) + id, err := applications.ParseApplicationID(state.ID) if err != nil { return nil, err } - resp, err := clients.ManagedApplication.ApplicationClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.ManagedApplication.ApplicationClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Managed Application %s (resource group: %s): %v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %v", *id, err) } - return utils.Bool(resp.ApplicationProperties != nil), nil + return pointer.To(resp.Model != nil), nil } func (r ManagedApplicationResource) basic(data acceptance.TestData) string { diff --git a/internal/services/managedapplications/parse/application.go b/internal/services/managedapplications/parse/application.go deleted file mode 100644 index 659ed313fa9f..000000000000 --- a/internal/services/managedapplications/parse/application.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewApplicationID(subscriptionId, resourceGroup, name string) ApplicationId { - return ApplicationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ApplicationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application", segmentsStr) -} - -func (id ApplicationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Solutions/applications/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ApplicationID parses a Application ID into an ApplicationId struct -func ApplicationID(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an Application ID: %+v", input, err) - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("applications"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/managedapplications/parse/application_definition.go b/internal/services/managedapplications/parse/application_definition.go deleted file mode 100644 index d5104a3c5bb9..000000000000 --- a/internal/services/managedapplications/parse/application_definition.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationDefinitionId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewApplicationDefinitionID(subscriptionId, resourceGroup, name string) ApplicationDefinitionId { - return ApplicationDefinitionId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ApplicationDefinitionId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application Definition", segmentsStr) -} - -func (id ApplicationDefinitionId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Solutions/applicationDefinitions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ApplicationDefinitionID parses a ApplicationDefinition ID into an ApplicationDefinitionId struct -func ApplicationDefinitionID(input string) (*ApplicationDefinitionId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an ApplicationDefinition ID: %+v", input, err) - } - - resourceId := ApplicationDefinitionId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("applicationDefinitions"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/managedapplications/parse/application_definition_test.go b/internal/services/managedapplications/parse/application_definition_test.go deleted file mode 100644 index bfb65c5203d5..000000000000 --- a/internal/services/managedapplications/parse/application_definition_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ApplicationDefinitionId{} - -func TestApplicationDefinitionIDFormatter(t *testing.T) { - actual := NewApplicationDefinitionID("12345678-1234-9876-4563-123456789012", "resGroup1", "definition1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applicationDefinitions/definition1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestApplicationDefinitionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ApplicationDefinitionId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applicationDefinitions/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applicationDefinitions/definition1", - Expected: &ApplicationDefinitionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "definition1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SOLUTIONS/APPLICATIONDEFINITIONS/DEFINITION1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ApplicationDefinitionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/managedapplications/parse/application_test.go b/internal/services/managedapplications/parse/application_test.go deleted file mode 100644 index 1e3476f6cbdd..000000000000 --- a/internal/services/managedapplications/parse/application_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ApplicationId{} - -func TestApplicationIDFormatter(t *testing.T) { - actual := NewApplicationID("12345678-1234-9876-4563-123456789012", "resGroup1", "app1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applications/app1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestApplicationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ApplicationId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applications/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applications/app1", - Expected: &ApplicationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "app1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SOLUTIONS/APPLICATIONS/APP1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ApplicationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/managedapplications/resourceids.go b/internal/services/managedapplications/resourceids.go deleted file mode 100644 index 8aa3ccdd43be..000000000000 --- a/internal/services/managedapplications/resourceids.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package managedapplications - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Application -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applications/app1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ApplicationDefinition -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applicationDefinitions/definition1 diff --git a/internal/services/managedapplications/validate/application_definition_id.go b/internal/services/managedapplications/validate/application_definition_id.go deleted file mode 100644 index 3e37aaf08ae9..000000000000 --- a/internal/services/managedapplications/validate/application_definition_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" -) - -func ApplicationDefinitionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationDefinitionID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/managedapplications/validate/application_definition_id_test.go b/internal/services/managedapplications/validate/application_definition_id_test.go deleted file mode 100644 index b22e1caeb9a5..000000000000 --- a/internal/services/managedapplications/validate/application_definition_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestApplicationDefinitionID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applicationDefinitions/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applicationDefinitions/definition1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SOLUTIONS/APPLICATIONDEFINITIONS/DEFINITION1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ApplicationDefinitionID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/managedapplications/validate/application_id.go b/internal/services/managedapplications/validate/application_id.go deleted file mode 100644 index 1db5855900fd..000000000000 --- a/internal/services/managedapplications/validate/application_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/managedapplications/parse" -) - -func ApplicationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/managedapplications/validate/application_id_test.go b/internal/services/managedapplications/validate/application_id_test.go deleted file mode 100644 index 9b18c97051bc..000000000000 --- a/internal/services/managedapplications/validate/application_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestApplicationID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applications/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Solutions/applications/app1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SOLUTIONS/APPLICATIONS/APP1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ApplicationID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/_meta.json deleted file mode 100644 index acafe2d52017..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", - "tag": "package-managedapplications-2019-07", - "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-managedapplications-2019-07 --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/resources/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/resources/mgmt/2019-07-01/managedapplications/applicationdefinitions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/applicationdefinitions.go deleted file mode 100644 index becce583b2c2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/applicationdefinitions.go +++ /dev/null @@ -1,705 +0,0 @@ -package managedapplications - -// 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" -) - -// ApplicationDefinitionsClient is the ARM applications -type ApplicationDefinitionsClient struct { - BaseClient -} - -// NewApplicationDefinitionsClient creates an instance of the ApplicationDefinitionsClient client. -func NewApplicationDefinitionsClient(subscriptionID string) ApplicationDefinitionsClient { - return NewApplicationDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationDefinitionsClientWithBaseURI creates an instance of the ApplicationDefinitionsClient 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 NewApplicationDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationDefinitionsClient { - return ApplicationDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new managed application definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationDefinitionName - the name of the managed application definition. -// parameters - parameters supplied to the create or update an managed application definition. -func (client ApplicationDefinitionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (result ApplicationDefinitionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationDefinitionName, - Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy.NotificationEndpoints", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationDefinitionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationDefinitionsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationDefinitionsCreateOrUpdateFuture, 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 ApplicationDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByID creates a new managed application definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationDefinitionName - the name of the managed application definition. -// parameters - parameters supplied to the create or update a managed application definition. -func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (result ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.CreateOrUpdateByID") - 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}}}, - {TargetValue: applicationDefinitionName, - Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy.NotificationEndpoints", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", err.Error()) - } - - req, err := client.CreateOrUpdateByIDPreparer(ctx, resourceGroupName, applicationDefinitionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. -func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationDefinitionsClient) CreateOrUpdateByIDSender(req *http.Request) (future ApplicationDefinitionsCreateOrUpdateByIDFuture, 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 -} - -// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always -// closes the http.Response Body. -func (client ApplicationDefinitionsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the managed application definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationDefinitionName - the name of the managed application definition to delete. -func (client ApplicationDefinitionsClient) Delete(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinitionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationDefinitionName, - Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationDefinitionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applicationDefinitions/{applicationDefinitionName}", 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 ApplicationDefinitionsClient) DeleteSender(req *http.Request) (future ApplicationDefinitionsDeleteFuture, 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 ApplicationDefinitionsClient) 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 -} - -// DeleteByID deletes the managed application definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationDefinitionName - the name of the managed application definition. -func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinitionsDeleteByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.DeleteByID") - 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}}}, - {TargetValue: applicationDefinitionName, - Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "DeleteByID", err.Error()) - } - - req, err := client.DeleteByIDPreparer(ctx, resourceGroupName, applicationDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", nil, "Failure preparing request") - return - } - - result, err = client.DeleteByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationDefinitionsClient) DeleteByIDSender(req *http.Request) (future ApplicationDefinitionsDeleteByIDFuture, 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 -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client ApplicationDefinitionsClient) DeleteByIDResponder(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 gets the managed application definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationDefinitionName - the name of the managed application definition. -func (client ApplicationDefinitionsClient) Get(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationDefinitionName, - Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationDefinitionsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applicationDefinitions/{applicationDefinitionName}", 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 ApplicationDefinitionsClient) 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 ApplicationDefinitionsClient) GetResponder(resp *http.Response) (result ApplicationDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets the managed application definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationDefinitionName - the name of the managed application definition. -func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.GetByID") - 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}}}, - {TargetValue: applicationDefinitionName, - Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, applicationDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client ApplicationDefinitionsClient) GetByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the managed application definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ApplicationDefinitionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationDefinitionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.adlr.Response.Response != nil { - sc = result.adlr.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.adlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.adlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.adlr.hasNextLink() && result.adlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ApplicationDefinitionsClient) 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 = "2019-07-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.Solutions/applicationDefinitions", 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 ApplicationDefinitionsClient) 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 ApplicationDefinitionsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationDefinitionListResult, 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 ApplicationDefinitionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationDefinitionListResult) (result ApplicationDefinitionListResult, err error) { - req, err := lastResults.applicationDefinitionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "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, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationDefinitionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationDefinitionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.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 -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/applications.go deleted file mode 100644 index 91d33b5e2534..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/applications.go +++ /dev/null @@ -1,1073 +0,0 @@ -package managedapplications - -// 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" -) - -// ApplicationsClient is the ARM applications -type ApplicationsClient struct { - BaseClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(subscriptionID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new managed application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationName - the name of the managed application. -// parameters - parameters supplied to the create or update a managed application. -func (client ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationName string, parameters Application) (result ApplicationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy.JitAccessEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ApplicationProperties.CustomerSupport", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.CustomerSupport.Email", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ApplicationProperties.CustomerSupport.Phone", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.Plan", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Plan.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Plan.Product", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Plan.Version", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Kind", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByID creates a new managed application. -// Parameters: -// applicationID - the fully qualified ID of the managed application, including the managed application name -// and the managed application resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} -// parameters - parameters supplied to the create or update a managed application. -func (client ApplicationsClient) CreateOrUpdateByID(ctx context.Context, applicationID string, parameters Application) (result ApplicationsCreateOrUpdateByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdateByID") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy.JitAccessEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ApplicationProperties.CustomerSupport", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.CustomerSupport.Email", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ApplicationProperties.CustomerSupport.Phone", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.Plan", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Plan.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Plan.Product", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Plan.Version", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Kind", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "CreateOrUpdateByID", err.Error()) - } - - req, err := client.CreateOrUpdateByIDPreparer(ctx, applicationID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdateByID", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdateByID", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. -func (client ApplicationsClient) CreateOrUpdateByIDPreparer(ctx context.Context, applicationID string, parameters Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationId": applicationID, - } - - const APIVersion = "2019-07-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("/{applicationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateOrUpdateByIDSender(req *http.Request) (future ApplicationsCreateOrUpdateByIDFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the managed application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationName - the name of the managed application. -func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, applicationName string) (result ApplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (future ApplicationsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByID deletes the managed application. -// Parameters: -// applicationID - the fully qualified ID of the managed application, including the managed application name -// and the managed application resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} -func (client ApplicationsClient) DeleteByID(ctx context.Context, applicationID string) (result ApplicationsDeleteByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.DeleteByID") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByIDPreparer(ctx, applicationID) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "DeleteByID", nil, "Failure preparing request") - return - } - - result, err = client.DeleteByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "DeleteByID", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client ApplicationsClient) DeleteByIDPreparer(ctx context.Context, applicationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationId": applicationID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{applicationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteByIDSender(req *http.Request) (future ApplicationsDeleteByIDFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteByIDResponder(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 gets the managed application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationName - the name of the managed application. -func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, applicationName string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets the managed application. -// Parameters: -// applicationID - the fully qualified ID of the managed application, including the managed application name -// and the managed application resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} -func (client ApplicationsClient) GetByID(ctx context.Context, applicationID string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.GetByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByIDPreparer(ctx, applicationID) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client ApplicationsClient) GetByIDPreparer(ctx context.Context, applicationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationId": applicationID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{applicationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetByIDResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all the applications within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ApplicationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ApplicationsClient) 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 = "2019-07-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.Solutions/applications", 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 ApplicationsClient) 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 ApplicationsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationListResult, 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 ApplicationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationListResult) (result ApplicationListResult, err error) { - req, err := lastResults.applicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "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, "managedapplications.ApplicationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.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 -} - -// ListBySubscription gets all the applications within a subscription. -func (client ApplicationsClient) ListBySubscription(ctx context.Context) (result ApplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListBySubscription") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.alr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ApplicationsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ApplicationsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ApplicationListResult) (result ApplicationListResult, err error) { - req, err := lastResults.applicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationsClient) ListBySubscriptionComplete(ctx context.Context) (result ApplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// RefreshPermissions refresh Permissions for application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationName - the name of the managed application. -func (client ApplicationsClient) RefreshPermissions(ctx context.Context, resourceGroupName string, applicationName string) (result ApplicationsRefreshPermissionsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.RefreshPermissions") - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "RefreshPermissions", err.Error()) - } - - req, err := client.RefreshPermissionsPreparer(ctx, resourceGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "RefreshPermissions", nil, "Failure preparing request") - return - } - - result, err = client.RefreshPermissionsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "RefreshPermissions", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshPermissionsPreparer prepares the RefreshPermissions request. -func (client ApplicationsClient) RefreshPermissionsPreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshPermissionsSender sends the RefreshPermissions request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) RefreshPermissionsSender(req *http.Request) (future ApplicationsRefreshPermissionsFuture, 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 -} - -// RefreshPermissionsResponder handles the response to the RefreshPermissions request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) RefreshPermissionsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing managed application. The only value that can be updated via PATCH currently is the tags. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationName - the name of the managed application. -// parameters - parameters supplied to update an existing managed application. -func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationName string, parameters *ApplicationPatchable) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update") - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.ApplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters *ApplicationPatchable) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateByID updates an existing managed application. The only value that can be updated via PATCH currently is the -// tags. -// Parameters: -// applicationID - the fully qualified ID of the managed application, including the managed application name -// and the managed application resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} -// parameters - parameters supplied to update an existing managed application. -func (client ApplicationsClient) UpdateByID(ctx context.Context, applicationID string, parameters *Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdateByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateByIDPreparer(ctx, applicationID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateByID", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateByID", resp, "Failure sending request") - return - } - - result, err = client.UpdateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateByID", resp, "Failure responding to request") - return - } - - return -} - -// UpdateByIDPreparer prepares the UpdateByID request. -func (client ApplicationsClient) UpdateByIDPreparer(ctx context.Context, applicationID string, parameters *Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationId": applicationID, - } - - const APIVersion = "2019-07-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("/{applicationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateByIDSender sends the UpdateByID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateByIDResponder handles the response to the UpdateByID request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateByIDResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/client.go deleted file mode 100644 index cec0ce252546..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/client.go +++ /dev/null @@ -1,156 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armmanagedapplications](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armmanagedapplications). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package managedapplications implements the Azure ARM Managedapplications service API version 2019-07-01. -// -// ARM applications -package managedapplications - -// 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" -) - -const ( - // DefaultBaseURI is the default URI used for the service Managedapplications - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Managedapplications. -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, - } -} - -// ListOperations lists all of the available Microsoft.Solutions REST API operations. -func (client BaseClient) ListOperations(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListOperations") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOperationsNextResults - req, err := client.ListOperationsPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "ListOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "ListOperations", resp, "Failure sending request") - return - } - - result.olr, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "ListOperations", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOperationsPreparer prepares the ListOperations request. -func (client BaseClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Solutions/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOperationsSender sends the ListOperations request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ListOperationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOperationsResponder handles the response to the ListOperations request. The method always -// closes the http.Response Body. -func (client BaseClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOperationsNextResults retrieves the next set of results, if any. -func (client BaseClient) listOperationsNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "managedapplications.BaseClient", "listOperationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "managedapplications.BaseClient", "listOperationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "listOperationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) ListOperationsComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListOperations") - 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.ListOperations(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/enums.go deleted file mode 100644 index 62810af99f37..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/enums.go +++ /dev/null @@ -1,243 +0,0 @@ -package managedapplications - -// 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. - -// ApplicationArtifactName enumerates the values for application artifact name. -type ApplicationArtifactName string - -const ( - // Authorizations ... - Authorizations ApplicationArtifactName = "Authorizations" - // CustomRoleDefinition ... - CustomRoleDefinition ApplicationArtifactName = "CustomRoleDefinition" - // NotSpecified ... - NotSpecified ApplicationArtifactName = "NotSpecified" - // ViewDefinition ... - ViewDefinition ApplicationArtifactName = "ViewDefinition" -) - -// PossibleApplicationArtifactNameValues returns an array of possible values for the ApplicationArtifactName const type. -func PossibleApplicationArtifactNameValues() []ApplicationArtifactName { - return []ApplicationArtifactName{Authorizations, CustomRoleDefinition, NotSpecified, ViewDefinition} -} - -// ApplicationArtifactType enumerates the values for application artifact type. -type ApplicationArtifactType string - -const ( - // ApplicationArtifactTypeCustom ... - ApplicationArtifactTypeCustom ApplicationArtifactType = "Custom" - // ApplicationArtifactTypeNotSpecified ... - ApplicationArtifactTypeNotSpecified ApplicationArtifactType = "NotSpecified" - // ApplicationArtifactTypeTemplate ... - ApplicationArtifactTypeTemplate ApplicationArtifactType = "Template" -) - -// PossibleApplicationArtifactTypeValues returns an array of possible values for the ApplicationArtifactType const type. -func PossibleApplicationArtifactTypeValues() []ApplicationArtifactType { - return []ApplicationArtifactType{ApplicationArtifactTypeCustom, ApplicationArtifactTypeNotSpecified, ApplicationArtifactTypeTemplate} -} - -// ApplicationDefinitionArtifactName enumerates the values for application definition artifact name. -type ApplicationDefinitionArtifactName string - -const ( - // ApplicationDefinitionArtifactNameApplicationResourceTemplate ... - ApplicationDefinitionArtifactNameApplicationResourceTemplate ApplicationDefinitionArtifactName = "ApplicationResourceTemplate" - // ApplicationDefinitionArtifactNameCreateUIDefinition ... - ApplicationDefinitionArtifactNameCreateUIDefinition ApplicationDefinitionArtifactName = "CreateUiDefinition" - // ApplicationDefinitionArtifactNameMainTemplateParameters ... - ApplicationDefinitionArtifactNameMainTemplateParameters ApplicationDefinitionArtifactName = "MainTemplateParameters" - // ApplicationDefinitionArtifactNameNotSpecified ... - ApplicationDefinitionArtifactNameNotSpecified ApplicationDefinitionArtifactName = "NotSpecified" -) - -// PossibleApplicationDefinitionArtifactNameValues returns an array of possible values for the ApplicationDefinitionArtifactName const type. -func PossibleApplicationDefinitionArtifactNameValues() []ApplicationDefinitionArtifactName { - return []ApplicationDefinitionArtifactName{ApplicationDefinitionArtifactNameApplicationResourceTemplate, ApplicationDefinitionArtifactNameCreateUIDefinition, ApplicationDefinitionArtifactNameMainTemplateParameters, ApplicationDefinitionArtifactNameNotSpecified} -} - -// ApplicationLockLevel enumerates the values for application lock level. -type ApplicationLockLevel string - -const ( - // CanNotDelete ... - CanNotDelete ApplicationLockLevel = "CanNotDelete" - // None ... - None ApplicationLockLevel = "None" - // ReadOnly ... - ReadOnly ApplicationLockLevel = "ReadOnly" -) - -// PossibleApplicationLockLevelValues returns an array of possible values for the ApplicationLockLevel const type. -func PossibleApplicationLockLevelValues() []ApplicationLockLevel { - return []ApplicationLockLevel{CanNotDelete, None, ReadOnly} -} - -// ApplicationManagementMode enumerates the values for application management mode. -type ApplicationManagementMode string - -const ( - // ApplicationManagementModeManaged ... - ApplicationManagementModeManaged ApplicationManagementMode = "Managed" - // ApplicationManagementModeNotSpecified ... - ApplicationManagementModeNotSpecified ApplicationManagementMode = "NotSpecified" - // ApplicationManagementModeUnmanaged ... - ApplicationManagementModeUnmanaged ApplicationManagementMode = "Unmanaged" -) - -// PossibleApplicationManagementModeValues returns an array of possible values for the ApplicationManagementMode const type. -func PossibleApplicationManagementModeValues() []ApplicationManagementMode { - return []ApplicationManagementMode{ApplicationManagementModeManaged, ApplicationManagementModeNotSpecified, ApplicationManagementModeUnmanaged} -} - -// DeploymentMode enumerates the values for deployment mode. -type DeploymentMode string - -const ( - // DeploymentModeComplete ... - DeploymentModeComplete DeploymentMode = "Complete" - // DeploymentModeIncremental ... - DeploymentModeIncremental DeploymentMode = "Incremental" - // DeploymentModeNotSpecified ... - DeploymentModeNotSpecified DeploymentMode = "NotSpecified" -) - -// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type. -func PossibleDeploymentModeValues() []DeploymentMode { - return []DeploymentMode{DeploymentModeComplete, DeploymentModeIncremental, DeploymentModeNotSpecified} -} - -// JitApprovalMode enumerates the values for jit approval mode. -type JitApprovalMode string - -const ( - // JitApprovalModeAutoApprove ... - JitApprovalModeAutoApprove JitApprovalMode = "AutoApprove" - // JitApprovalModeManualApprove ... - JitApprovalModeManualApprove JitApprovalMode = "ManualApprove" - // JitApprovalModeNotSpecified ... - JitApprovalModeNotSpecified JitApprovalMode = "NotSpecified" -) - -// PossibleJitApprovalModeValues returns an array of possible values for the JitApprovalMode const type. -func PossibleJitApprovalModeValues() []JitApprovalMode { - return []JitApprovalMode{JitApprovalModeAutoApprove, JitApprovalModeManualApprove, JitApprovalModeNotSpecified} -} - -// JitApproverType enumerates the values for jit approver type. -type JitApproverType string - -const ( - // Group ... - Group JitApproverType = "group" - // User ... - User JitApproverType = "user" -) - -// PossibleJitApproverTypeValues returns an array of possible values for the JitApproverType const type. -func PossibleJitApproverTypeValues() []JitApproverType { - return []JitApproverType{Group, User} -} - -// JitRequestState enumerates the values for jit request state. -type JitRequestState string - -const ( - // JitRequestStateApproved ... - JitRequestStateApproved JitRequestState = "Approved" - // JitRequestStateCanceled ... - JitRequestStateCanceled JitRequestState = "Canceled" - // JitRequestStateDenied ... - JitRequestStateDenied JitRequestState = "Denied" - // JitRequestStateExpired ... - JitRequestStateExpired JitRequestState = "Expired" - // JitRequestStateFailed ... - JitRequestStateFailed JitRequestState = "Failed" - // JitRequestStateNotSpecified ... - JitRequestStateNotSpecified JitRequestState = "NotSpecified" - // JitRequestStatePending ... - JitRequestStatePending JitRequestState = "Pending" - // JitRequestStateTimeout ... - JitRequestStateTimeout JitRequestState = "Timeout" -) - -// PossibleJitRequestStateValues returns an array of possible values for the JitRequestState const type. -func PossibleJitRequestStateValues() []JitRequestState { - return []JitRequestState{JitRequestStateApproved, JitRequestStateCanceled, JitRequestStateDenied, JitRequestStateExpired, JitRequestStateFailed, JitRequestStateNotSpecified, JitRequestStatePending, JitRequestStateTimeout} -} - -// JitSchedulingType enumerates the values for jit scheduling type. -type JitSchedulingType string - -const ( - // JitSchedulingTypeNotSpecified ... - JitSchedulingTypeNotSpecified JitSchedulingType = "NotSpecified" - // JitSchedulingTypeOnce ... - JitSchedulingTypeOnce JitSchedulingType = "Once" - // JitSchedulingTypeRecurring ... - JitSchedulingTypeRecurring JitSchedulingType = "Recurring" -) - -// PossibleJitSchedulingTypeValues returns an array of possible values for the JitSchedulingType const type. -func PossibleJitSchedulingTypeValues() []JitSchedulingType { - return []JitSchedulingType{JitSchedulingTypeNotSpecified, JitSchedulingTypeOnce, JitSchedulingTypeRecurring} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateAccepted ... - ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreated ... - ProvisioningStateCreated ProvisioningState = "Created" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleted ... - ProvisioningStateDeleted ProvisioningState = "Deleted" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateNotSpecified ... - ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" - // ProvisioningStateReady ... - ProvisioningStateReady ProvisioningState = "Ready" - // ProvisioningStateRunning ... - ProvisioningStateRunning ProvisioningState = "Running" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateNotSpecified, ProvisioningStateReady, ProvisioningStateRunning, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/jitrequests.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/jitrequests.go deleted file mode 100644 index 7e068f88dc2d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/jitrequests.go +++ /dev/null @@ -1,538 +0,0 @@ -package managedapplications - -// 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" -) - -// JitRequestsClient is the ARM applications -type JitRequestsClient struct { - BaseClient -} - -// NewJitRequestsClient creates an instance of the JitRequestsClient client. -func NewJitRequestsClient(subscriptionID string) JitRequestsClient { - return NewJitRequestsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJitRequestsClientWithBaseURI creates an instance of the JitRequestsClient 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 NewJitRequestsClientWithBaseURI(baseURI string, subscriptionID string) JitRequestsClient { - return JitRequestsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the JIT request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// jitRequestName - the name of the JIT request. -// parameters - parameters supplied to the update JIT request. -func (client JitRequestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestDefinition) (result JitRequestsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitRequestsClient.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JitRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.JitRequestProperties.ApplicationResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JitRequestProperties.JitAuthorizationPolicies", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JitRequestProperties.JitSchedulingPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JitRequestProperties.JitSchedulingPolicy.Duration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JitRequestProperties.JitSchedulingPolicy.StartTime", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("managedapplications.JitRequestsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, jitRequestName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JitRequestsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jitRequestName": autorest.Encode("path", jitRequestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/jitRequests/{jitRequestName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client JitRequestsClient) CreateOrUpdateSender(req *http.Request) (future JitRequestsCreateOrUpdateFuture, 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 JitRequestsClient) CreateOrUpdateResponder(resp *http.Response) (result JitRequestDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the JIT request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// jitRequestName - the name of the JIT request. -func (client JitRequestsClient) Delete(ctx context.Context, resourceGroupName string, jitRequestName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitRequestsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.JitRequestsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, jitRequestName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JitRequestsClient) DeletePreparer(ctx context.Context, resourceGroupName string, jitRequestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jitRequestName": autorest.Encode("path", jitRequestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/jitRequests/{jitRequestName}", 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 JitRequestsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client JitRequestsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the JIT request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// jitRequestName - the name of the JIT request. -func (client JitRequestsClient) Get(ctx context.Context, resourceGroupName string, jitRequestName string) (result JitRequestDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitRequestsClient.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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.JitRequestsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, jitRequestName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JitRequestsClient) GetPreparer(ctx context.Context, resourceGroupName string, jitRequestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jitRequestName": autorest.Encode("path", jitRequestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/jitRequests/{jitRequestName}", 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 JitRequestsClient) 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 JitRequestsClient) GetResponder(resp *http.Response) (result JitRequestDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieves all JIT requests within the resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client JitRequestsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result JitRequestDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitRequestsClient.ListByResourceGroup") - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.JitRequestsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client JitRequestsClient) 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 = "2019-07-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.Solutions/jitRequests", 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 JitRequestsClient) 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 JitRequestsClient) ListByResourceGroupResponder(resp *http.Response) (result JitRequestDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieves all JIT requests within the subscription. -func (client JitRequestsClient) ListBySubscription(ctx context.Context) (result JitRequestDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitRequestsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client JitRequestsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client JitRequestsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client JitRequestsClient) ListBySubscriptionResponder(resp *http.Response) (result JitRequestDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the JIT request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// jitRequestName - the name of the JIT request. -// parameters - parameters supplied to the update JIT request. -func (client JitRequestsClient) Update(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestPatchable) (result JitRequestDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitRequestsClient.Update") - 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: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("managedapplications.JitRequestsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, jitRequestName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client JitRequestsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestPatchable) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jitRequestName": autorest.Encode("path", jitRequestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-07-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.Solutions/jitRequests/{jitRequestName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client JitRequestsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client JitRequestsClient) UpdateResponder(resp *http.Response) (result JitRequestDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/models.go deleted file mode 100644 index e575e0711cc0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/models.go +++ /dev/null @@ -1,1959 +0,0 @@ -package managedapplications - -// 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/resources/mgmt/2019-07-01/managedapplications" - -// Application information about managed application. -type Application struct { - autorest.Response `json:"-"` - // ApplicationProperties - The managed application properties. - *ApplicationProperties `json:"properties,omitempty"` - // Plan - The plan information. - Plan *Plan `json:"plan,omitempty"` - // Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. - Kind *string `json:"kind,omitempty"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // ManagedBy - ID of the resource that manages this resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Sku - The SKU of the resource. - Sku *Sku `json:"sku,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"` -} - -// MarshalJSON is the custom marshaler for Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ApplicationProperties != nil { - objectMap["properties"] = a.ApplicationProperties - } - if a.Plan != nil { - objectMap["plan"] = a.Plan - } - if a.Kind != nil { - objectMap["kind"] = a.Kind - } - if a.Identity != nil { - objectMap["identity"] = a.Identity - } - if a.ManagedBy != nil { - objectMap["managedBy"] = a.ManagedBy - } - if a.Sku != nil { - objectMap["sku"] = a.Sku - } - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Application struct. -func (a *Application) 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 applicationProperties ApplicationProperties - err = json.Unmarshal(*v, &applicationProperties) - if err != nil { - return err - } - a.ApplicationProperties = &applicationProperties - } - case "plan": - if v != nil { - var plan Plan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - a.Plan = &plan - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - a.Kind = &kind - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - a.Identity = &identity - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - a.ManagedBy = &managedBy - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - a.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - } - } - - return nil -} - -// ApplicationArtifact managed application artifact. -type ApplicationArtifact struct { - // Name - The managed application artifact name. Possible values include: 'NotSpecified', 'ViewDefinition', 'Authorizations', 'CustomRoleDefinition' - Name ApplicationArtifactName `json:"name,omitempty"` - // URI - The managed application artifact blob uri. - URI *string `json:"uri,omitempty"` - // Type - The managed application artifact type. Possible values include: 'ApplicationArtifactTypeNotSpecified', 'ApplicationArtifactTypeTemplate', 'ApplicationArtifactTypeCustom' - Type ApplicationArtifactType `json:"type,omitempty"` -} - -// ApplicationAuthorization the managed application provider authorization. -type ApplicationAuthorization struct { - // PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources. - PrincipalID *string `json:"principalId,omitempty"` - // RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the managed application's container resource group. This role definition cannot have permission to delete the resource group. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` -} - -// ApplicationBillingDetailsDefinition managed application billing details definition. -type ApplicationBillingDetailsDefinition struct { - // ResourceUsageID - The managed application resource usage Id. - ResourceUsageID *string `json:"resourceUsageId,omitempty"` -} - -// ApplicationClientDetails the application client details to track the entity creating/updating the -// managed app resource. -type ApplicationClientDetails struct { - // Oid - The client Oid. - Oid *string `json:"oid,omitempty"` - // Puid - The client Puid - Puid *string `json:"puid,omitempty"` - // ApplicationID - The client application Id. - ApplicationID *string `json:"applicationId,omitempty"` -} - -// ApplicationDefinition information about managed application definition. -type ApplicationDefinition struct { - autorest.Response `json:"-"` - // ApplicationDefinitionProperties - The managed application definition properties. - *ApplicationDefinitionProperties `json:"properties,omitempty"` - // ManagedBy - ID of the resource that manages this resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Sku - The SKU of the resource. - Sku *Sku `json:"sku,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"` -} - -// MarshalJSON is the custom marshaler for ApplicationDefinition. -func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ad.ApplicationDefinitionProperties != nil { - objectMap["properties"] = ad.ApplicationDefinitionProperties - } - if ad.ManagedBy != nil { - objectMap["managedBy"] = ad.ManagedBy - } - if ad.Sku != nil { - objectMap["sku"] = ad.Sku - } - if ad.Location != nil { - objectMap["location"] = ad.Location - } - if ad.Tags != nil { - objectMap["tags"] = ad.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationDefinition struct. -func (ad *ApplicationDefinition) 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 applicationDefinitionProperties ApplicationDefinitionProperties - err = json.Unmarshal(*v, &applicationDefinitionProperties) - if err != nil { - return err - } - ad.ApplicationDefinitionProperties = &applicationDefinitionProperties - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - ad.ManagedBy = &managedBy - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ad.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ad.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ad.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ad.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ad.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ad.Tags = tags - } - } - } - - return nil -} - -// ApplicationDefinitionArtifact application definition artifact. -type ApplicationDefinitionArtifact struct { - // Name - The managed application definition artifact name. Possible values include: 'ApplicationDefinitionArtifactNameNotSpecified', 'ApplicationDefinitionArtifactNameApplicationResourceTemplate', 'ApplicationDefinitionArtifactNameCreateUIDefinition', 'ApplicationDefinitionArtifactNameMainTemplateParameters' - Name ApplicationDefinitionArtifactName `json:"name,omitempty"` - // URI - The managed application definition artifact blob uri. - URI *string `json:"uri,omitempty"` - // Type - The managed application definition artifact type. Possible values include: 'ApplicationArtifactTypeNotSpecified', 'ApplicationArtifactTypeTemplate', 'ApplicationArtifactTypeCustom' - Type ApplicationArtifactType `json:"type,omitempty"` -} - -// ApplicationDefinitionListResult list of managed application definitions. -type ApplicationDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - The array of managed application definitions. - Value *[]ApplicationDefinition `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationDefinitionListResultIterator provides access to a complete listing of ApplicationDefinition -// values. -type ApplicationDefinitionListResultIterator struct { - i int - page ApplicationDefinitionListResultPage -} - -// 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 *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.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 *ApplicationDefinitionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationDefinitionListResultIterator) 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 ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult { - 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 ApplicationDefinitionListResultIterator) Value() ApplicationDefinition { - if !iter.page.NotDone() { - return ApplicationDefinition{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationDefinitionListResultIterator type. -func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator { - return ApplicationDefinitionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (adlr ApplicationDefinitionListResult) IsEmpty() bool { - return adlr.Value == nil || len(*adlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (adlr ApplicationDefinitionListResult) hasNextLink() bool { - return adlr.NextLink != nil && len(*adlr.NextLink) != 0 -} - -// applicationDefinitionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !adlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(adlr.NextLink))) -} - -// ApplicationDefinitionListResultPage contains a page of ApplicationDefinition values. -type ApplicationDefinitionListResultPage struct { - fn func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error) - adlr ApplicationDefinitionListResult -} - -// 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 *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.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.adlr) - if err != nil { - return err - } - page.adlr = 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 *ApplicationDefinitionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationDefinitionListResultPage) NotDone() bool { - return !page.adlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult { - return page.adlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition { - if page.adlr.IsEmpty() { - return nil - } - return *page.adlr.Value -} - -// Creates a new instance of the ApplicationDefinitionListResultPage type. -func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage { - return ApplicationDefinitionListResultPage{ - fn: getNextPage, - adlr: cur, - } -} - -// ApplicationDefinitionProperties the managed application definition properties. -type ApplicationDefinitionProperties struct { - // LockLevel - The managed application lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None' - LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"` - // DisplayName - The managed application definition display name. - DisplayName *string `json:"displayName,omitempty"` - // IsEnabled - A value indicating whether the package is enabled or not. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Authorizations - The managed application provider authorizations. - Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"` - // Artifacts - The collection of managed application artifacts. The portal will use the files specified as artifacts to construct the user experience of creating a managed application from a managed application definition. - Artifacts *[]ApplicationDefinitionArtifact `json:"artifacts,omitempty"` - // Description - The managed application definition description. - Description *string `json:"description,omitempty"` - // PackageFileURI - The managed application definition package file Uri. Use this element - PackageFileURI *string `json:"packageFileUri,omitempty"` - // MainTemplate - The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string. - MainTemplate interface{} `json:"mainTemplate,omitempty"` - // CreateUIDefinition - The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. - CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"` - // NotificationPolicy - The managed application notification policy. - NotificationPolicy *ApplicationNotificationPolicy `json:"notificationPolicy,omitempty"` - // LockingPolicy - The managed application locking policy. - LockingPolicy *ApplicationPackageLockingPolicyDefinition `json:"lockingPolicy,omitempty"` - // DeploymentPolicy - The managed application deployment policy. - DeploymentPolicy *ApplicationDeploymentPolicy `json:"deploymentPolicy,omitempty"` - // ManagementPolicy - The managed application management policy that determines publisher's access to the managed resource group. - ManagementPolicy *ApplicationManagementPolicy `json:"managementPolicy,omitempty"` - // Policies - The managed application provider policies. - Policies *[]ApplicationPolicy `json:"policies,omitempty"` -} - -// ApplicationDefinitionsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ApplicationDefinitionsCreateOrUpdateByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationDefinitionsCreateOrUpdateByIDFuture) 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 ApplicationDefinitionsCreateOrUpdateByIDFuture.Result. -func (future *ApplicationDefinitionsCreateOrUpdateByIDFuture) result(client ApplicationDefinitionsClient) (ad ApplicationDefinition, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ad.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent { - ad, err = client.CreateOrUpdateByIDResponder(ad.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture", "Result", ad.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationDefinitionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationDefinitionsCreateOrUpdateFuture) 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 ApplicationDefinitionsCreateOrUpdateFuture.Result. -func (future *ApplicationDefinitionsCreateOrUpdateFuture) result(client ApplicationDefinitionsClient) (ad ApplicationDefinition, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ad.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent { - ad, err = client.CreateOrUpdateResponder(ad.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateFuture", "Result", ad.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationDefinitionsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationDefinitionsDeleteByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationDefinitionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationDefinitionsDeleteByIDFuture) 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 ApplicationDefinitionsDeleteByIDFuture.Result. -func (future *ApplicationDefinitionsDeleteByIDFuture) result(client ApplicationDefinitionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsDeleteByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsDeleteByIDFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationDefinitionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationDefinitionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationDefinitionsDeleteFuture) 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 ApplicationDefinitionsDeleteFuture.Result. -func (future *ApplicationDefinitionsDeleteFuture) result(client ApplicationDefinitionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationDeploymentPolicy managed application deployment policy. -type ApplicationDeploymentPolicy struct { - // DeploymentMode - The managed application deployment mode. Possible values include: 'DeploymentModeNotSpecified', 'DeploymentModeIncremental', 'DeploymentModeComplete' - DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"` -} - -// ApplicationJitAccessPolicy managed application Jit access policy. -type ApplicationJitAccessPolicy struct { - // JitAccessEnabled - Whether the JIT access is enabled. - JitAccessEnabled *bool `json:"jitAccessEnabled,omitempty"` - // JitApprovalMode - JIT approval mode. Possible values include: 'JitApprovalModeNotSpecified', 'JitApprovalModeAutoApprove', 'JitApprovalModeManualApprove' - JitApprovalMode JitApprovalMode `json:"jitApprovalMode,omitempty"` - // JitApprovers - The JIT approvers - JitApprovers *[]JitApproverDefinition `json:"jitApprovers,omitempty"` - // MaximumJitAccessDuration - The maximum duration JIT access is granted. This is an ISO8601 time period value. - MaximumJitAccessDuration *string `json:"maximumJitAccessDuration,omitempty"` -} - -// ApplicationListResult list of managed applications. -type ApplicationListResult struct { - autorest.Response `json:"-"` - // Value - The array of managed applications. - Value *[]Application `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationListResultIterator provides access to a complete listing of Application values. -type ApplicationListResultIterator struct { - i int - page ApplicationListResultPage -} - -// 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 *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.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 *ApplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationListResultIterator) 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 ApplicationListResultIterator) Response() ApplicationListResult { - 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 ApplicationListResultIterator) Value() Application { - if !iter.page.NotDone() { - return Application{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationListResultIterator type. -func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator { - return ApplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr ApplicationListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr ApplicationListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// applicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !alr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(alr.NextLink))) -} - -// ApplicationListResultPage contains a page of Application values. -type ApplicationListResultPage struct { - fn func(context.Context, ApplicationListResult) (ApplicationListResult, error) - alr ApplicationListResult -} - -// 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 *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.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.alr) - if err != nil { - return err - } - page.alr = 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 *ApplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationListResultPage) Response() ApplicationListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationListResultPage) Values() []Application { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the ApplicationListResultPage type. -func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { - return ApplicationListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// ApplicationManagementPolicy managed application management policy. -type ApplicationManagementPolicy struct { - // Mode - The managed application management mode. Possible values include: 'ApplicationManagementModeNotSpecified', 'ApplicationManagementModeUnmanaged', 'ApplicationManagementModeManaged' - Mode ApplicationManagementMode `json:"mode,omitempty"` -} - -// ApplicationNotificationEndpoint managed application notification endpoint. -type ApplicationNotificationEndpoint struct { - // URI - The managed application notification endpoint uri. - URI *string `json:"uri,omitempty"` -} - -// ApplicationNotificationPolicy managed application notification policy. -type ApplicationNotificationPolicy struct { - // NotificationEndpoints - The managed application notification endpoint. - NotificationEndpoints *[]ApplicationNotificationEndpoint `json:"notificationEndpoints,omitempty"` -} - -// ApplicationPackageContact the application package contact information. -type ApplicationPackageContact struct { - // ContactName - The contact name. - ContactName *string `json:"contactName,omitempty"` - // Email - The contact email. - Email *string `json:"email,omitempty"` - // Phone - The contact phone number. - Phone *string `json:"phone,omitempty"` -} - -// ApplicationPackageLockingPolicyDefinition managed application locking policy. -type ApplicationPackageLockingPolicyDefinition struct { - // AllowedActions - The deny assignment excluded actions. - AllowedActions *[]string `json:"allowedActions,omitempty"` -} - -// ApplicationPackageSupportUrls the appliance package support URLs. -type ApplicationPackageSupportUrls struct { - // PublicAzure - The public azure support URL. - PublicAzure *string `json:"publicAzure,omitempty"` - // GovernmentCloud - The government cloud support URL. - GovernmentCloud *string `json:"governmentCloud,omitempty"` -} - -// ApplicationPatchable information about managed application. -type ApplicationPatchable struct { - // ApplicationProperties - The managed application properties. - *ApplicationProperties `json:"properties,omitempty"` - // Plan - The plan information. - Plan *PlanPatchable `json:"plan,omitempty"` - // Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. - Kind *string `json:"kind,omitempty"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // ManagedBy - ID of the resource that manages this resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Sku - The SKU of the resource. - Sku *Sku `json:"sku,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"` -} - -// MarshalJSON is the custom marshaler for ApplicationPatchable. -func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ApplicationProperties != nil { - objectMap["properties"] = ap.ApplicationProperties - } - if ap.Plan != nil { - objectMap["plan"] = ap.Plan - } - if ap.Kind != nil { - objectMap["kind"] = ap.Kind - } - if ap.Identity != nil { - objectMap["identity"] = ap.Identity - } - if ap.ManagedBy != nil { - objectMap["managedBy"] = ap.ManagedBy - } - if ap.Sku != nil { - objectMap["sku"] = ap.Sku - } - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct. -func (ap *ApplicationPatchable) 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 applicationProperties ApplicationProperties - err = json.Unmarshal(*v, &applicationProperties) - if err != nil { - return err - } - ap.ApplicationProperties = &applicationProperties - } - case "plan": - if v != nil { - var plan PlanPatchable - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - ap.Plan = &plan - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ap.Kind = &kind - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ap.Identity = &identity - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - ap.ManagedBy = &managedBy - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ap.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - } - } - - return nil -} - -// ApplicationPolicy managed application policy. -type ApplicationPolicy struct { - // Name - The policy name - Name *string `json:"name,omitempty"` - // PolicyDefinitionID - The policy definition Id. - PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` - // Parameters - The policy parameters. - Parameters *string `json:"parameters,omitempty"` -} - -// ApplicationProperties the managed application properties. -type ApplicationProperties struct { - // ManagedResourceGroupID - The managed resource group Id. - ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"` - // ApplicationDefinitionID - The fully qualified path of managed application definition Id. - ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"` - // Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. - Parameters interface{} `json:"parameters,omitempty"` - // Outputs - READ-ONLY; Name and value pairs that define the managed application outputs. - Outputs interface{} `json:"outputs,omitempty"` - // ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // BillingDetails - READ-ONLY; The managed application billing details. - BillingDetails *ApplicationBillingDetailsDefinition `json:"billingDetails,omitempty"` - // JitAccessPolicy - The managed application Jit access policy. - JitAccessPolicy *ApplicationJitAccessPolicy `json:"jitAccessPolicy,omitempty"` - // PublisherTenantID - READ-ONLY; The publisher tenant Id. - PublisherTenantID *string `json:"publisherTenantId,omitempty"` - // Authorizations - READ-ONLY; The read-only authorizations property that is retrieved from the application package. - Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"` - // ManagementMode - READ-ONLY; The managed application management mode. Possible values include: 'ApplicationManagementModeNotSpecified', 'ApplicationManagementModeUnmanaged', 'ApplicationManagementModeManaged' - ManagementMode ApplicationManagementMode `json:"managementMode,omitempty"` - // CustomerSupport - READ-ONLY; The read-only customer support property that is retrieved from the application package. - CustomerSupport *ApplicationPackageContact `json:"customerSupport,omitempty"` - // SupportUrls - READ-ONLY; The read-only support URLs property that is retrieved from the application package. - SupportUrls *ApplicationPackageSupportUrls `json:"supportUrls,omitempty"` - // Artifacts - READ-ONLY; The collection of managed application artifacts. - Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"` - // CreatedBy - READ-ONLY; The client entity that created the JIT request. - CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"` - // UpdatedBy - READ-ONLY; The client entity that last updated the JIT request. - UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationProperties. -func (ap ApplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ManagedResourceGroupID != nil { - objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID - } - if ap.ApplicationDefinitionID != nil { - objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID - } - if ap.Parameters != nil { - objectMap["parameters"] = ap.Parameters - } - if ap.JitAccessPolicy != nil { - objectMap["jitAccessPolicy"] = ap.JitAccessPolicy - } - return json.Marshal(objectMap) -} - -// ApplicationPropertiesPatchable the managed application properties. -type ApplicationPropertiesPatchable struct { - // ManagedResourceGroupID - The managed resource group Id. - ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"` - // ApplicationDefinitionID - The fully qualified path of managed application definition Id. - ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"` - // Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. - Parameters interface{} `json:"parameters,omitempty"` - // Outputs - READ-ONLY; Name and value pairs that define the managed application outputs. - Outputs interface{} `json:"outputs,omitempty"` - // ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable. -func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.ManagedResourceGroupID != nil { - objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID - } - if app.ApplicationDefinitionID != nil { - objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID - } - if app.Parameters != nil { - objectMap["parameters"] = app.Parameters - } - return json.Marshal(objectMap) -} - -// ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationsCreateOrUpdateByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (Application, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsCreateOrUpdateByIDFuture) 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 ApplicationsCreateOrUpdateByIDFuture.Result. -func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateByIDResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (Application, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsCreateOrUpdateFuture.Result. -func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationsDeleteByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsDeleteByIDFuture) 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 ApplicationsDeleteByIDFuture.Result. -func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsDeleteFuture.Result. -func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationsRefreshPermissionsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationsRefreshPermissionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsRefreshPermissionsFuture) 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 ApplicationsRefreshPermissionsFuture.Result. -func (future *ApplicationsRefreshPermissionsFuture) result(client ApplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsRefreshPermissionsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsRefreshPermissionsFuture") - return - } - ar.Response = future.Response() - return -} - -// ErrorResponse error response indicates managed application is not able to process the incoming request. -// The reason is provided in the error message. -type ErrorResponse struct { - // HTTPStatus - Http status code. - HTTPStatus *string `json:"httpStatus,omitempty"` - // ErrorCode - Error code. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message indicating why the operation failed. - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// GenericResource resource information. -type GenericResource struct { - // ManagedBy - ID of the resource that manages this resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Sku - The SKU of the resource. - Sku *Sku `json:"sku,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"` -} - -// MarshalJSON is the custom marshaler for GenericResource. -func (gr GenericResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gr.ManagedBy != nil { - objectMap["managedBy"] = gr.ManagedBy - } - if gr.Sku != nil { - objectMap["sku"] = gr.Sku - } - if gr.Location != nil { - objectMap["location"] = gr.Location - } - if gr.Tags != nil { - objectMap["tags"] = gr.Tags - } - return json.Marshal(objectMap) -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserAssignedResourceIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - if i.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = i.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// JitApproverDefinition JIT approver definition. -type JitApproverDefinition struct { - // ID - The approver service principal Id. - ID *string `json:"id,omitempty"` - // Type - The approver type. Possible values include: 'User', 'Group' - Type JitApproverType `json:"type,omitempty"` - // DisplayName - The approver display name. - DisplayName *string `json:"displayName,omitempty"` -} - -// JitAuthorizationPolicies the JIT authorization policies. -type JitAuthorizationPolicies struct { - // PrincipalID - The the principal id that will be granted JIT access. - PrincipalID *string `json:"principalId,omitempty"` - // RoleDefinitionID - The role definition id that will be granted to the Principal. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` -} - -// JitRequestDefinition information about JIT request definition. -type JitRequestDefinition struct { - autorest.Response `json:"-"` - // JitRequestProperties - The JIT request properties. - *JitRequestProperties `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"` -} - -// MarshalJSON is the custom marshaler for JitRequestDefinition. -func (jrd JitRequestDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jrd.JitRequestProperties != nil { - objectMap["properties"] = jrd.JitRequestProperties - } - if jrd.Location != nil { - objectMap["location"] = jrd.Location - } - if jrd.Tags != nil { - objectMap["tags"] = jrd.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JitRequestDefinition struct. -func (jrd *JitRequestDefinition) 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 jitRequestProperties JitRequestProperties - err = json.Unmarshal(*v, &jitRequestProperties) - if err != nil { - return err - } - jrd.JitRequestProperties = &jitRequestProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - jrd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - jrd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - jrd.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - jrd.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - jrd.Tags = tags - } - } - } - - return nil -} - -// JitRequestDefinitionListResult list of JIT requests. -type JitRequestDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - The array of Jit request definition. - Value *[]JitRequestDefinition `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// JitRequestPatchable information about JIT request. -type JitRequestPatchable struct { - // Tags - Jit request tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for JitRequestPatchable. -func (jrp JitRequestPatchable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jrp.Tags != nil { - objectMap["tags"] = jrp.Tags - } - return json.Marshal(objectMap) -} - -// JitRequestProperties information about JIT request properties -type JitRequestProperties struct { - // ApplicationResourceID - The parent application id. - ApplicationResourceID *string `json:"applicationResourceId,omitempty"` - // PublisherTenantID - READ-ONLY; The publisher tenant id. - PublisherTenantID *string `json:"publisherTenantId,omitempty"` - // JitAuthorizationPolicies - The JIT authorization policies. - JitAuthorizationPolicies *[]JitAuthorizationPolicies `json:"jitAuthorizationPolicies,omitempty"` - // JitSchedulingPolicy - The JIT request properties. - JitSchedulingPolicy *JitSchedulingPolicy `json:"jitSchedulingPolicy,omitempty"` - // ProvisioningState - READ-ONLY; The JIT request provisioning state. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // JitRequestState - READ-ONLY; The JIT request state. Possible values include: 'JitRequestStateNotSpecified', 'JitRequestStatePending', 'JitRequestStateApproved', 'JitRequestStateDenied', 'JitRequestStateFailed', 'JitRequestStateCanceled', 'JitRequestStateExpired', 'JitRequestStateTimeout' - JitRequestState JitRequestState `json:"jitRequestState,omitempty"` - // CreatedBy - READ-ONLY; The client entity that created the JIT request. - CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"` - // UpdatedBy - READ-ONLY; The client entity that last updated the JIT request. - UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"` -} - -// MarshalJSON is the custom marshaler for JitRequestProperties. -func (jrp JitRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jrp.ApplicationResourceID != nil { - objectMap["applicationResourceId"] = jrp.ApplicationResourceID - } - if jrp.JitAuthorizationPolicies != nil { - objectMap["jitAuthorizationPolicies"] = jrp.JitAuthorizationPolicies - } - if jrp.JitSchedulingPolicy != nil { - objectMap["jitSchedulingPolicy"] = jrp.JitSchedulingPolicy - } - return json.Marshal(objectMap) -} - -// JitRequestsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type JitRequestsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JitRequestsClient) (JitRequestDefinition, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JitRequestsCreateOrUpdateFuture) 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 JitRequestsCreateOrUpdateFuture.Result. -func (future *JitRequestsCreateOrUpdateFuture) result(client JitRequestsClient) (jrd JitRequestDefinition, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - jrd.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedapplications.JitRequestsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if jrd.Response.Response, err = future.GetResult(sender); err == nil && jrd.Response.Response.StatusCode != http.StatusNoContent { - jrd, err = client.CreateOrUpdateResponder(jrd.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", jrd.Response.Response, "Failure responding to request") - } - } - return -} - -// JitSchedulingPolicy the JIT scheduling policies. -type JitSchedulingPolicy struct { - // Type - The type of JIT schedule. Possible values include: 'JitSchedulingTypeNotSpecified', 'JitSchedulingTypeOnce', 'JitSchedulingTypeRecurring' - Type JitSchedulingType `json:"type,omitempty"` - Duration *string `json:"duration,omitempty"` - // StartTime - The start time of the request. - StartTime *date.Time `json:"startTime,omitempty"` -} - -// Operation microsoft.Solutions operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Solutions - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Application, JitRequest, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Solutions operations. It contains a list of -// operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Microsoft.Solutions operations. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// Plan plan for the managed application. -type Plan struct { - // Name - The plan name. - Name *string `json:"name,omitempty"` - // Publisher - The publisher ID. - Publisher *string `json:"publisher,omitempty"` - // Product - The product code. - Product *string `json:"product,omitempty"` - // PromotionCode - The promotion code. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The plan's version. - Version *string `json:"version,omitempty"` -} - -// PlanPatchable plan for the managed application. -type PlanPatchable struct { - // Name - The plan name. - Name *string `json:"name,omitempty"` - // Publisher - The publisher ID. - Publisher *string `json:"publisher,omitempty"` - // Product - The product code. - Product *string `json:"product,omitempty"` - // PromotionCode - The promotion code. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The plan's version. - Version *string `json:"version,omitempty"` -} - -// Resource resource information. -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"` -} - -// 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 - } - return json.Marshal(objectMap) -} - -// Sku SKU for the resource. -type Sku struct { - // Name - The SKU name. - Name *string `json:"name,omitempty"` - // Tier - The SKU tier. - Tier *string `json:"tier,omitempty"` - // Size - The SKU size. - Size *string `json:"size,omitempty"` - // Family - The SKU family. - Family *string `json:"family,omitempty"` - // Model - The SKU model. - Model *string `json:"model,omitempty"` - // Capacity - The SKU capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// UserAssignedResourceIdentity represents the user assigned identity that is contained within the -// UserAssignedIdentities dictionary on ResourceIdentity -type UserAssignedResourceIdentity struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of user assigned identity. - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedResourceIdentity. -func (uari UserAssignedResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/version.go deleted file mode 100644 index 51aedae83e49..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package managedapplications - -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() + " managedapplications/2019-07-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/managedapplications/2021-07-01/applicationdefinitions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/README.md new file mode 100644 index 000000000000..fa14bbada5e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions` Documentation + +The `applicationdefinitions` SDK allows for interaction with the Azure Resource Manager Service `managedapplications` (API Version `2021-07-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/managedapplications/2021-07-01/applicationdefinitions" +``` + + +### Client Initialization + +```go +client := applicationdefinitions.NewApplicationDefinitionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApplicationDefinitionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := applicationdefinitions.NewApplicationDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationDefinitionValue") + +payload := applicationdefinitions.ApplicationDefinition{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationDefinitionsClient.Delete` + +```go +ctx := context.TODO() +id := applicationdefinitions.NewApplicationDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationDefinitionValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationDefinitionsClient.Get` + +```go +ctx := context.TODO() +id := applicationdefinitions.NewApplicationDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationDefinitionValue") + +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: `ApplicationDefinitionsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := applicationdefinitions.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: `ApplicationDefinitionsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := applicationdefinitions.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationDefinitionsClient.Update` + +```go +ctx := context.TODO() +id := applicationdefinitions.NewApplicationDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationDefinitionValue") + +payload := applicationdefinitions.ApplicationDefinitionPatchable{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go new file mode 100644 index 000000000000..7bd233c8a53f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go @@ -0,0 +1,26 @@ +package applicationdefinitions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDefinitionsClient struct { + Client *resourcemanager.Client +} + +func NewApplicationDefinitionsClientWithBaseURI(api environments.Api) (*ApplicationDefinitionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "applicationdefinitions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApplicationDefinitionsClient: %+v", err) + } + + return &ApplicationDefinitionsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/constants.go new file mode 100644 index 000000000000..40bde100255d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/constants.go @@ -0,0 +1,233 @@ +package applicationdefinitions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationArtifactType string + +const ( + ApplicationArtifactTypeCustom ApplicationArtifactType = "Custom" + ApplicationArtifactTypeNotSpecified ApplicationArtifactType = "NotSpecified" + ApplicationArtifactTypeTemplate ApplicationArtifactType = "Template" +) + +func PossibleValuesForApplicationArtifactType() []string { + return []string{ + string(ApplicationArtifactTypeCustom), + string(ApplicationArtifactTypeNotSpecified), + string(ApplicationArtifactTypeTemplate), + } +} + +func (s *ApplicationArtifactType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationArtifactType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationArtifactType(input string) (*ApplicationArtifactType, error) { + vals := map[string]ApplicationArtifactType{ + "custom": ApplicationArtifactTypeCustom, + "notspecified": ApplicationArtifactTypeNotSpecified, + "template": ApplicationArtifactTypeTemplate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationArtifactType(input) + return &out, nil +} + +type ApplicationDefinitionArtifactName string + +const ( + ApplicationDefinitionArtifactNameApplicationResourceTemplate ApplicationDefinitionArtifactName = "ApplicationResourceTemplate" + ApplicationDefinitionArtifactNameCreateUiDefinition ApplicationDefinitionArtifactName = "CreateUiDefinition" + ApplicationDefinitionArtifactNameMainTemplateParameters ApplicationDefinitionArtifactName = "MainTemplateParameters" + ApplicationDefinitionArtifactNameNotSpecified ApplicationDefinitionArtifactName = "NotSpecified" +) + +func PossibleValuesForApplicationDefinitionArtifactName() []string { + return []string{ + string(ApplicationDefinitionArtifactNameApplicationResourceTemplate), + string(ApplicationDefinitionArtifactNameCreateUiDefinition), + string(ApplicationDefinitionArtifactNameMainTemplateParameters), + string(ApplicationDefinitionArtifactNameNotSpecified), + } +} + +func (s *ApplicationDefinitionArtifactName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationDefinitionArtifactName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationDefinitionArtifactName(input string) (*ApplicationDefinitionArtifactName, error) { + vals := map[string]ApplicationDefinitionArtifactName{ + "applicationresourcetemplate": ApplicationDefinitionArtifactNameApplicationResourceTemplate, + "createuidefinition": ApplicationDefinitionArtifactNameCreateUiDefinition, + "maintemplateparameters": ApplicationDefinitionArtifactNameMainTemplateParameters, + "notspecified": ApplicationDefinitionArtifactNameNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationDefinitionArtifactName(input) + return &out, nil +} + +type ApplicationLockLevel string + +const ( + ApplicationLockLevelCanNotDelete ApplicationLockLevel = "CanNotDelete" + ApplicationLockLevelNone ApplicationLockLevel = "None" + ApplicationLockLevelReadOnly ApplicationLockLevel = "ReadOnly" +) + +func PossibleValuesForApplicationLockLevel() []string { + return []string{ + string(ApplicationLockLevelCanNotDelete), + string(ApplicationLockLevelNone), + string(ApplicationLockLevelReadOnly), + } +} + +func (s *ApplicationLockLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationLockLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationLockLevel(input string) (*ApplicationLockLevel, error) { + vals := map[string]ApplicationLockLevel{ + "cannotdelete": ApplicationLockLevelCanNotDelete, + "none": ApplicationLockLevelNone, + "readonly": ApplicationLockLevelReadOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationLockLevel(input) + return &out, nil +} + +type ApplicationManagementMode string + +const ( + ApplicationManagementModeManaged ApplicationManagementMode = "Managed" + ApplicationManagementModeNotSpecified ApplicationManagementMode = "NotSpecified" + ApplicationManagementModeUnmanaged ApplicationManagementMode = "Unmanaged" +) + +func PossibleValuesForApplicationManagementMode() []string { + return []string{ + string(ApplicationManagementModeManaged), + string(ApplicationManagementModeNotSpecified), + string(ApplicationManagementModeUnmanaged), + } +} + +func (s *ApplicationManagementMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationManagementMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationManagementMode(input string) (*ApplicationManagementMode, error) { + vals := map[string]ApplicationManagementMode{ + "managed": ApplicationManagementModeManaged, + "notspecified": ApplicationManagementModeNotSpecified, + "unmanaged": ApplicationManagementModeUnmanaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationManagementMode(input) + return &out, nil +} + +type DeploymentMode string + +const ( + DeploymentModeComplete DeploymentMode = "Complete" + DeploymentModeIncremental DeploymentMode = "Incremental" + DeploymentModeNotSpecified DeploymentMode = "NotSpecified" +) + +func PossibleValuesForDeploymentMode() []string { + return []string{ + string(DeploymentModeComplete), + string(DeploymentModeIncremental), + string(DeploymentModeNotSpecified), + } +} + +func (s *DeploymentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeploymentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeploymentMode(input string) (*DeploymentMode, error) { + vals := map[string]DeploymentMode{ + "complete": DeploymentModeComplete, + "incremental": DeploymentModeIncremental, + "notspecified": DeploymentModeNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeploymentMode(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go new file mode 100644 index 000000000000..833c66e0683a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go @@ -0,0 +1,127 @@ +package applicationdefinitions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApplicationDefinitionId{} + +// ApplicationDefinitionId is a struct representing the Resource ID for a Application Definition +type ApplicationDefinitionId struct { + SubscriptionId string + ResourceGroupName string + ApplicationDefinitionName string +} + +// NewApplicationDefinitionID returns a new ApplicationDefinitionId struct +func NewApplicationDefinitionID(subscriptionId string, resourceGroupName string, applicationDefinitionName string) ApplicationDefinitionId { + return ApplicationDefinitionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationDefinitionName: applicationDefinitionName, + } +} + +// ParseApplicationDefinitionID parses 'input' into a ApplicationDefinitionId +func ParseApplicationDefinitionID(input string) (*ApplicationDefinitionId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationDefinitionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationDefinitionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ApplicationDefinitionName, ok = parsed.Parsed["applicationDefinitionName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", *parsed) + } + + return &id, nil +} + +// ParseApplicationDefinitionIDInsensitively parses 'input' case-insensitively into a ApplicationDefinitionId +// note: this method should only be used for API response data and not user input +func ParseApplicationDefinitionIDInsensitively(input string) (*ApplicationDefinitionId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationDefinitionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationDefinitionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ApplicationDefinitionName, ok = parsed.Parsed["applicationDefinitionName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", *parsed) + } + + return &id, nil +} + +// ValidateApplicationDefinitionID checks that 'input' can be parsed as a Application Definition ID +func ValidateApplicationDefinitionID(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 := ParseApplicationDefinitionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Definition ID +func (id ApplicationDefinitionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Solutions/applicationDefinitions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationDefinitionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Definition ID +func (id ApplicationDefinitionId) 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("staticMicrosoftSolutions", "Microsoft.Solutions", "Microsoft.Solutions"), + resourceids.StaticSegment("staticApplicationDefinitions", "applicationDefinitions", "applicationDefinitions"), + resourceids.UserSpecifiedSegment("applicationDefinitionName", "applicationDefinitionValue"), + } +} + +// String returns a human-readable description of this Application Definition ID +func (id ApplicationDefinitionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Definition Name: %q", id.ApplicationDefinitionName), + } + return fmt.Sprintf("Application Definition (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_createorupdate.go new file mode 100644 index 000000000000..511310e5af8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_createorupdate.go @@ -0,0 +1,56 @@ +package applicationdefinitions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationDefinition +} + +// CreateOrUpdate ... +func (c ApplicationDefinitionsClient) CreateOrUpdate(ctx context.Context, id ApplicationDefinitionId, input ApplicationDefinition) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_delete.go new file mode 100644 index 000000000000..76d5b6bfce8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_delete.go @@ -0,0 +1,47 @@ +package applicationdefinitions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ApplicationDefinitionsClient) Delete(ctx context.Context, id ApplicationDefinitionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_get.go new file mode 100644 index 000000000000..4de1d7703c4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_get.go @@ -0,0 +1,51 @@ +package applicationdefinitions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationDefinition +} + +// Get ... +func (c ApplicationDefinitionsClient) Get(ctx context.Context, id ApplicationDefinitionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_listbyresourcegroup.go new file mode 100644 index 000000000000..17586af69b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package applicationdefinitions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationDefinition +} + +type ListByResourceGroupCompleteResult struct { + Items []ApplicationDefinition +} + +// ListByResourceGroup ... +func (c ApplicationDefinitionsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Solutions/applicationDefinitions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApplicationDefinition `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ApplicationDefinitionsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApplicationDefinitionOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApplicationDefinitionsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApplicationDefinitionOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ApplicationDefinition, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_listbysubscription.go new file mode 100644 index 000000000000..6fd89ac66938 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_listbysubscription.go @@ -0,0 +1,90 @@ +package applicationdefinitions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationDefinition +} + +type ListBySubscriptionCompleteResult struct { + Items []ApplicationDefinition +} + +// ListBySubscription ... +func (c ApplicationDefinitionsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Solutions/applicationDefinitions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApplicationDefinition `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ApplicationDefinitionsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ApplicationDefinitionOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApplicationDefinitionsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApplicationDefinitionOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ApplicationDefinition, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_update.go new file mode 100644 index 000000000000..3b50dcc61b49 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/method_update.go @@ -0,0 +1,55 @@ +package applicationdefinitions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationDefinition +} + +// Update ... +func (c ApplicationDefinitionsClient) Update(ctx context.Context, id ApplicationDefinitionId, input ApplicationDefinitionPatchable) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationauthorization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationauthorization.go new file mode 100644 index 000000000000..f69ce8ff5805 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationauthorization.go @@ -0,0 +1,9 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAuthorization struct { + PrincipalId string `json:"principalId"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinition.go new file mode 100644 index 000000000000..0759d65159a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinition.go @@ -0,0 +1,20 @@ +package applicationdefinitions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDefinition struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Properties ApplicationDefinitionProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionartifact.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionartifact.go new file mode 100644 index 000000000000..457ca0a5baa9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionartifact.go @@ -0,0 +1,10 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDefinitionArtifact struct { + Name ApplicationDefinitionArtifactName `json:"name"` + Type ApplicationArtifactType `json:"type"` + Uri string `json:"uri"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionpatchable.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionpatchable.go new file mode 100644 index 000000000000..440524da3e7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionpatchable.go @@ -0,0 +1,8 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDefinitionPatchable struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionproperties.go new file mode 100644 index 000000000000..c8df992936f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdefinitionproperties.go @@ -0,0 +1,22 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDefinitionProperties struct { + Artifacts *[]ApplicationDefinitionArtifact `json:"artifacts,omitempty"` + Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"` + CreateUiDefinition *interface{} `json:"createUiDefinition,omitempty"` + DeploymentPolicy *ApplicationDeploymentPolicy `json:"deploymentPolicy,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + LockLevel ApplicationLockLevel `json:"lockLevel"` + LockingPolicy *ApplicationPackageLockingPolicyDefinition `json:"lockingPolicy,omitempty"` + MainTemplate *interface{} `json:"mainTemplate,omitempty"` + ManagementPolicy *ApplicationManagementPolicy `json:"managementPolicy,omitempty"` + NotificationPolicy *ApplicationNotificationPolicy `json:"notificationPolicy,omitempty"` + PackageFileUri *string `json:"packageFileUri,omitempty"` + Policies *[]ApplicationPolicy `json:"policies,omitempty"` + StorageAccountId *string `json:"storageAccountId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdeploymentpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdeploymentpolicy.go new file mode 100644 index 000000000000..a5188d72f475 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationdeploymentpolicy.go @@ -0,0 +1,8 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDeploymentPolicy struct { + DeploymentMode DeploymentMode `json:"deploymentMode"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationmanagementpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationmanagementpolicy.go new file mode 100644 index 000000000000..1e26acf53283 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationmanagementpolicy.go @@ -0,0 +1,8 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationManagementPolicy struct { + Mode *ApplicationManagementMode `json:"mode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationnotificationendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationnotificationendpoint.go new file mode 100644 index 000000000000..67d0f8d55df0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationnotificationendpoint.go @@ -0,0 +1,8 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationNotificationEndpoint struct { + Uri string `json:"uri"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationnotificationpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationnotificationpolicy.go new file mode 100644 index 000000000000..60393c5759b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationnotificationpolicy.go @@ -0,0 +1,8 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationNotificationPolicy struct { + NotificationEndpoints []ApplicationNotificationEndpoint `json:"notificationEndpoints"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationpackagelockingpolicydefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationpackagelockingpolicydefinition.go new file mode 100644 index 000000000000..16a3ce253cc4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationpackagelockingpolicydefinition.go @@ -0,0 +1,9 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPackageLockingPolicyDefinition struct { + AllowedActions *[]string `json:"allowedActions,omitempty"` + AllowedDataActions *[]string `json:"allowedDataActions,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationpolicy.go new file mode 100644 index 000000000000..91ea61b1e9ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_applicationpolicy.go @@ -0,0 +1,10 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPolicy struct { + Name *string `json:"name,omitempty"` + Parameters *string `json:"parameters,omitempty"` + PolicyDefinitionId *string `json:"policyDefinitionId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_sku.go new file mode 100644 index 000000000000..757ee697612c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/model_sku.go @@ -0,0 +1,13 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Model *string `json:"model,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/predicates.go new file mode 100644 index 000000000000..3e73ec2907f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/predicates.go @@ -0,0 +1,37 @@ +package applicationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDefinitionOperationPredicate struct { + Id *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p ApplicationDefinitionOperationPredicate) Matches(input ApplicationDefinition) bool { + + 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.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + 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/managedapplications/2021-07-01/applicationdefinitions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/version.go new file mode 100644 index 000000000000..c64033f5bba1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions/version.go @@ -0,0 +1,12 @@ +package applicationdefinitions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-07-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/applicationdefinitions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/README.md new file mode 100644 index 000000000000..01e1ac7eedbf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/README.md @@ -0,0 +1,244 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications` Documentation + +The `applications` SDK allows for interaction with the Azure Resource Manager Service `managedapplications` (API Version `2021-07-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/managedapplications/2021-07-01/applications" +``` + + +### Client Initialization + +```go +client := applications.NewApplicationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApplicationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +payload := applications.Application{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.CreateOrUpdateById` + +```go +ctx := context.TODO() +id := applications.NewApplicationIdID("applicationIdValue") + +payload := applications.Application{ + // ... +} + + +if err := client.CreateOrUpdateByIdThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.Delete` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.DeleteById` + +```go +ctx := context.TODO() +id := applications.NewApplicationIdID("applicationIdValue") + +if err := client.DeleteByIdThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.Get` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +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: `ApplicationsClient.GetById` + +```go +ctx := context.TODO() +id := applications.NewApplicationIdID("applicationIdValue") + +read, err := client.GetById(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationsClient.ListAllowedUpgradePlans` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +read, err := client.ListAllowedUpgradePlans(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := applications.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: `ApplicationsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := applications.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationsClient.ListTokens` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +payload := applications.ListTokenRequest{ + // ... +} + + +read, err := client.ListTokens(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationsClient.RefreshPermissions` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +if err := client.RefreshPermissionsThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.Update` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +payload := applications.ApplicationPatchable{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.UpdateAccess` + +```go +ctx := context.TODO() +id := applications.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationValue") + +payload := applications.UpdateAccessDefinition{ + // ... +} + + +if err := client.UpdateAccessThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationsClient.UpdateById` + +```go +ctx := context.TODO() +id := applications.NewApplicationIdID("applicationIdValue") + +payload := applications.ApplicationPatchable{ + // ... +} + + +if err := client.UpdateByIdThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/client.go new file mode 100644 index 000000000000..4cedd2657e75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/client.go @@ -0,0 +1,26 @@ +package applications + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationsClient struct { + Client *resourcemanager.Client +} + +func NewApplicationsClientWithBaseURI(api environments.Api) (*ApplicationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "applications", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApplicationsClient: %+v", err) + } + + return &ApplicationsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/constants.go new file mode 100644 index 000000000000..ed61b20305e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/constants.go @@ -0,0 +1,436 @@ +package applications + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationArtifactName string + +const ( + ApplicationArtifactNameAuthorizations ApplicationArtifactName = "Authorizations" + ApplicationArtifactNameCustomRoleDefinition ApplicationArtifactName = "CustomRoleDefinition" + ApplicationArtifactNameNotSpecified ApplicationArtifactName = "NotSpecified" + ApplicationArtifactNameViewDefinition ApplicationArtifactName = "ViewDefinition" +) + +func PossibleValuesForApplicationArtifactName() []string { + return []string{ + string(ApplicationArtifactNameAuthorizations), + string(ApplicationArtifactNameCustomRoleDefinition), + string(ApplicationArtifactNameNotSpecified), + string(ApplicationArtifactNameViewDefinition), + } +} + +func (s *ApplicationArtifactName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationArtifactName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationArtifactName(input string) (*ApplicationArtifactName, error) { + vals := map[string]ApplicationArtifactName{ + "authorizations": ApplicationArtifactNameAuthorizations, + "customroledefinition": ApplicationArtifactNameCustomRoleDefinition, + "notspecified": ApplicationArtifactNameNotSpecified, + "viewdefinition": ApplicationArtifactNameViewDefinition, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationArtifactName(input) + return &out, nil +} + +type ApplicationArtifactType string + +const ( + ApplicationArtifactTypeCustom ApplicationArtifactType = "Custom" + ApplicationArtifactTypeNotSpecified ApplicationArtifactType = "NotSpecified" + ApplicationArtifactTypeTemplate ApplicationArtifactType = "Template" +) + +func PossibleValuesForApplicationArtifactType() []string { + return []string{ + string(ApplicationArtifactTypeCustom), + string(ApplicationArtifactTypeNotSpecified), + string(ApplicationArtifactTypeTemplate), + } +} + +func (s *ApplicationArtifactType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationArtifactType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationArtifactType(input string) (*ApplicationArtifactType, error) { + vals := map[string]ApplicationArtifactType{ + "custom": ApplicationArtifactTypeCustom, + "notspecified": ApplicationArtifactTypeNotSpecified, + "template": ApplicationArtifactTypeTemplate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationArtifactType(input) + return &out, nil +} + +type ApplicationManagementMode string + +const ( + ApplicationManagementModeManaged ApplicationManagementMode = "Managed" + ApplicationManagementModeNotSpecified ApplicationManagementMode = "NotSpecified" + ApplicationManagementModeUnmanaged ApplicationManagementMode = "Unmanaged" +) + +func PossibleValuesForApplicationManagementMode() []string { + return []string{ + string(ApplicationManagementModeManaged), + string(ApplicationManagementModeNotSpecified), + string(ApplicationManagementModeUnmanaged), + } +} + +func (s *ApplicationManagementMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationManagementMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationManagementMode(input string) (*ApplicationManagementMode, error) { + vals := map[string]ApplicationManagementMode{ + "managed": ApplicationManagementModeManaged, + "notspecified": ApplicationManagementModeNotSpecified, + "unmanaged": ApplicationManagementModeUnmanaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationManagementMode(input) + return &out, nil +} + +type JitApprovalMode string + +const ( + JitApprovalModeAutoApprove JitApprovalMode = "AutoApprove" + JitApprovalModeManualApprove JitApprovalMode = "ManualApprove" + JitApprovalModeNotSpecified JitApprovalMode = "NotSpecified" +) + +func PossibleValuesForJitApprovalMode() []string { + return []string{ + string(JitApprovalModeAutoApprove), + string(JitApprovalModeManualApprove), + string(JitApprovalModeNotSpecified), + } +} + +func (s *JitApprovalMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseJitApprovalMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseJitApprovalMode(input string) (*JitApprovalMode, error) { + vals := map[string]JitApprovalMode{ + "autoapprove": JitApprovalModeAutoApprove, + "manualapprove": JitApprovalModeManualApprove, + "notspecified": JitApprovalModeNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JitApprovalMode(input) + return &out, nil +} + +type JitApproverType string + +const ( + JitApproverTypeGroup JitApproverType = "group" + JitApproverTypeUser JitApproverType = "user" +) + +func PossibleValuesForJitApproverType() []string { + return []string{ + string(JitApproverTypeGroup), + string(JitApproverTypeUser), + } +} + +func (s *JitApproverType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseJitApproverType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseJitApproverType(input string) (*JitApproverType, error) { + vals := map[string]JitApproverType{ + "group": JitApproverTypeGroup, + "user": JitApproverTypeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JitApproverType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ResourceIdentityType string + +const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +func PossibleValuesForResourceIdentityType() []string { + return []string{ + string(ResourceIdentityTypeNone), + string(ResourceIdentityTypeSystemAssigned), + string(ResourceIdentityTypeSystemAssignedUserAssigned), + string(ResourceIdentityTypeUserAssigned), + } +} + +func (s *ResourceIdentityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceIdentityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceIdentityType(input string) (*ResourceIdentityType, error) { + vals := map[string]ResourceIdentityType{ + "none": ResourceIdentityTypeNone, + "systemassigned": ResourceIdentityTypeSystemAssigned, + "systemassigned, userassigned": ResourceIdentityTypeSystemAssignedUserAssigned, + "userassigned": ResourceIdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceIdentityType(input) + return &out, nil +} + +type Status string + +const ( + StatusElevate Status = "Elevate" + StatusNotSpecified Status = "NotSpecified" + StatusRemove Status = "Remove" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusElevate), + string(StatusNotSpecified), + string(StatusRemove), + } +} + +func (s *Status) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "elevate": StatusElevate, + "notspecified": StatusNotSpecified, + "remove": StatusRemove, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type Substatus string + +const ( + SubstatusApproved Substatus = "Approved" + SubstatusDenied Substatus = "Denied" + SubstatusExpired Substatus = "Expired" + SubstatusFailed Substatus = "Failed" + SubstatusNotSpecified Substatus = "NotSpecified" + SubstatusTimeout Substatus = "Timeout" +) + +func PossibleValuesForSubstatus() []string { + return []string{ + string(SubstatusApproved), + string(SubstatusDenied), + string(SubstatusExpired), + string(SubstatusFailed), + string(SubstatusNotSpecified), + string(SubstatusTimeout), + } +} + +func (s *Substatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubstatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSubstatus(input string) (*Substatus, error) { + vals := map[string]Substatus{ + "approved": SubstatusApproved, + "denied": SubstatusDenied, + "expired": SubstatusExpired, + "failed": SubstatusFailed, + "notspecified": SubstatusNotSpecified, + "timeout": SubstatusTimeout, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Substatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/id_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/id_application.go new file mode 100644 index 000000000000..45d20c2e8946 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/id_application.go @@ -0,0 +1,127 @@ +package applications + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApplicationId{} + +// ApplicationId is a struct representing the Resource ID for a Application +type ApplicationId struct { + SubscriptionId string + ResourceGroupName string + ApplicationName string +} + +// NewApplicationID returns a new ApplicationId struct +func NewApplicationID(subscriptionId string, resourceGroupName string, applicationName string) ApplicationId { + return ApplicationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationName: applicationName, + } +} + +// ParseApplicationID parses 'input' into a ApplicationId +func ParseApplicationID(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + } + + return &id, nil +} + +// ParseApplicationIDInsensitively parses 'input' case-insensitively into a ApplicationId +// note: this method should only be used for API response data and not user input +func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + } + + return &id, nil +} + +// ValidateApplicationID checks that 'input' can be parsed as a Application ID +func ValidateApplicationID(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 := ParseApplicationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application ID +func (id ApplicationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Solutions/applications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application ID +func (id ApplicationId) 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("staticMicrosoftSolutions", "Microsoft.Solutions", "Microsoft.Solutions"), + resourceids.StaticSegment("staticApplications", "applications", "applications"), + resourceids.UserSpecifiedSegment("applicationName", "applicationValue"), + } +} + +// String returns a human-readable description of this Application ID +func (id ApplicationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Name: %q", id.ApplicationName), + } + return fmt.Sprintf("Application (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go new file mode 100644 index 000000000000..2960c4ce29b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go @@ -0,0 +1,98 @@ +package applications + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApplicationIdId{} + +// ApplicationIdId is a struct representing the Resource ID for a Application Id +type ApplicationIdId struct { + ApplicationId string +} + +// NewApplicationIdID returns a new ApplicationIdId struct +func NewApplicationIdID(applicationId string) ApplicationIdId { + return ApplicationIdId{ + ApplicationId: applicationId, + } +} + +// ParseApplicationIdID parses 'input' into a ApplicationIdId +func ParseApplicationIdID(input string) (*ApplicationIdId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationIdId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationIdId{} + + if id.ApplicationId, ok = parsed.Parsed["applicationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationId", *parsed) + } + + return &id, nil +} + +// ParseApplicationIdIDInsensitively parses 'input' case-insensitively into a ApplicationIdId +// note: this method should only be used for API response data and not user input +func ParseApplicationIdIDInsensitively(input string) (*ApplicationIdId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationIdId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationIdId{} + + if id.ApplicationId, ok = parsed.Parsed["applicationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationId", *parsed) + } + + return &id, nil +} + +// ValidateApplicationIdID checks that 'input' can be parsed as a Application Id ID +func ValidateApplicationIdID(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 := ParseApplicationIdID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Id ID +func (id ApplicationIdId) ID() string { + fmtString := "/%s" + return fmt.Sprintf(fmtString, id.ApplicationId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Id ID +func (id ApplicationIdId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.UserSpecifiedSegment("applicationId", "applicationIdValue"), + } +} + +// String returns a human-readable description of this Application Id ID +func (id ApplicationIdId) String() string { + components := []string{ + fmt.Sprintf("Application: %q", id.ApplicationId), + } + return fmt.Sprintf("Application Id (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_createorupdate.go new file mode 100644 index 000000000000..21f85923a1d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_createorupdate.go @@ -0,0 +1,74 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ApplicationsClient) CreateOrUpdate(ctx context.Context, id ApplicationId, input Application) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApplicationsClient) CreateOrUpdateThenPoll(ctx context.Context, id ApplicationId, input Application) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_createorupdatebyid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_createorupdatebyid.go new file mode 100644 index 000000000000..708eec30a6a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_createorupdatebyid.go @@ -0,0 +1,74 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateByIdOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdateById ... +func (c ApplicationsClient) CreateOrUpdateById(ctx context.Context, id ApplicationIdId, input Application) (result CreateOrUpdateByIdOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateByIdThenPoll performs CreateOrUpdateById then polls until it's completed +func (c ApplicationsClient) CreateOrUpdateByIdThenPoll(ctx context.Context, id ApplicationIdId, input Application) error { + result, err := c.CreateOrUpdateById(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdateById: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdateById: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_delete.go new file mode 100644 index 000000000000..37cd083f7789 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_delete.go @@ -0,0 +1,71 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ApplicationsClient) Delete(ctx context.Context, id ApplicationId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ApplicationsClient) DeleteThenPoll(ctx context.Context, id ApplicationId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_deletebyid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_deletebyid.go new file mode 100644 index 000000000000..507c2988428e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_deletebyid.go @@ -0,0 +1,71 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteByIdOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeleteById ... +func (c ApplicationsClient) DeleteById(ctx context.Context, id ApplicationIdId) (result DeleteByIdOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteByIdThenPoll performs DeleteById then polls until it's completed +func (c ApplicationsClient) DeleteByIdThenPoll(ctx context.Context, id ApplicationIdId) error { + result, err := c.DeleteById(ctx, id) + if err != nil { + return fmt.Errorf("performing DeleteById: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteById: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_get.go new file mode 100644 index 000000000000..c1cb9f3fd6d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_get.go @@ -0,0 +1,51 @@ +package applications + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Application +} + +// Get ... +func (c ApplicationsClient) Get(ctx context.Context, id ApplicationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_getbyid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_getbyid.go new file mode 100644 index 000000000000..90092939f14f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_getbyid.go @@ -0,0 +1,51 @@ +package applications + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetByIdOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Application +} + +// GetById ... +func (c ApplicationsClient) GetById(ctx context.Context, id ApplicationIdId) (result GetByIdOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listallowedupgradeplans.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listallowedupgradeplans.go new file mode 100644 index 000000000000..6172ed8c19eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listallowedupgradeplans.go @@ -0,0 +1,52 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllowedUpgradePlansOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AllowedUpgradePlansResult +} + +// ListAllowedUpgradePlans ... +func (c ApplicationsClient) ListAllowedUpgradePlans(ctx context.Context, id ApplicationId) (result ListAllowedUpgradePlansOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listAllowedUpgradePlans", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listbyresourcegroup.go new file mode 100644 index 000000000000..2c3ae851fa57 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Application +} + +type ListByResourceGroupCompleteResult struct { + Items []Application +} + +// ListByResourceGroup ... +func (c ApplicationsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Solutions/applications", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Application `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ApplicationsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApplicationOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApplicationsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApplicationOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Application, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listbysubscription.go new file mode 100644 index 000000000000..05b3e2394e2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listbysubscription.go @@ -0,0 +1,90 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Application +} + +type ListBySubscriptionCompleteResult struct { + Items []Application +} + +// ListBySubscription ... +func (c ApplicationsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Solutions/applications", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Application `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ApplicationsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ApplicationOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApplicationsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApplicationOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Application, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listtokens.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listtokens.go new file mode 100644 index 000000000000..a66ec99d00d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_listtokens.go @@ -0,0 +1,56 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListTokensOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedIdentityTokenResult +} + +// ListTokens ... +func (c ApplicationsClient) ListTokens(ctx context.Context, id ApplicationId, input ListTokenRequest) (result ListTokensOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listTokens", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_refreshpermissions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_refreshpermissions.go new file mode 100644 index 000000000000..738e9d285d48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_refreshpermissions.go @@ -0,0 +1,70 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshPermissionsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RefreshPermissions ... +func (c ApplicationsClient) RefreshPermissions(ctx context.Context, id ApplicationId) (result RefreshPermissionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshPermissions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RefreshPermissionsThenPoll performs RefreshPermissions then polls until it's completed +func (c ApplicationsClient) RefreshPermissionsThenPoll(ctx context.Context, id ApplicationId) error { + result, err := c.RefreshPermissions(ctx, id) + if err != nil { + return fmt.Errorf("performing RefreshPermissions: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RefreshPermissions: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_update.go new file mode 100644 index 000000000000..28417e82a35f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_update.go @@ -0,0 +1,74 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c ApplicationsClient) Update(ctx context.Context, id ApplicationId, input ApplicationPatchable) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ApplicationsClient) UpdateThenPoll(ctx context.Context, id ApplicationId, input ApplicationPatchable) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_updateaccess.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_updateaccess.go new file mode 100644 index 000000000000..0e6748ccb543 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_updateaccess.go @@ -0,0 +1,74 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateAccessOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UpdateAccess ... +func (c ApplicationsClient) UpdateAccess(ctx context.Context, id ApplicationId, input UpdateAccessDefinition) (result UpdateAccessOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/updateAccess", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateAccessThenPoll performs UpdateAccess then polls until it's completed +func (c ApplicationsClient) UpdateAccessThenPoll(ctx context.Context, id ApplicationId, input UpdateAccessDefinition) error { + result, err := c.UpdateAccess(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateAccess: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateAccess: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_updatebyid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_updatebyid.go new file mode 100644 index 000000000000..6a684b1ee3a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/method_updatebyid.go @@ -0,0 +1,74 @@ +package applications + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateByIdOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UpdateById ... +func (c ApplicationsClient) UpdateById(ctx context.Context, id ApplicationIdId, input ApplicationPatchable) (result UpdateByIdOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateByIdThenPoll performs UpdateById then polls until it's completed +func (c ApplicationsClient) UpdateByIdThenPoll(ctx context.Context, id ApplicationIdId, input ApplicationPatchable) error { + result, err := c.UpdateById(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateById: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateById: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_allowedupgradeplansresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_allowedupgradeplansresult.go new file mode 100644 index 000000000000..871d3503af2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_allowedupgradeplansresult.go @@ -0,0 +1,8 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllowedUpgradePlansResult struct { + Value *[]Plan `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_application.go new file mode 100644 index 000000000000..028b006090d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_application.go @@ -0,0 +1,23 @@ +package applications + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Application struct { + Id *string `json:"id,omitempty"` + Identity *Identity `json:"identity,omitempty"` + Kind string `json:"kind"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties ApplicationProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationartifact.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationartifact.go new file mode 100644 index 000000000000..ac68d0c169c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationartifact.go @@ -0,0 +1,10 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationArtifact struct { + Name ApplicationArtifactName `json:"name"` + Type ApplicationArtifactType `json:"type"` + Uri string `json:"uri"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationauthorization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationauthorization.go new file mode 100644 index 000000000000..ad45c633e7c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationauthorization.go @@ -0,0 +1,9 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAuthorization struct { + PrincipalId string `json:"principalId"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationbillingdetailsdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationbillingdetailsdefinition.go new file mode 100644 index 000000000000..8f27adf1b60b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationbillingdetailsdefinition.go @@ -0,0 +1,8 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationBillingDetailsDefinition struct { + ResourceUsageId *string `json:"resourceUsageId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationclientdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationclientdetails.go new file mode 100644 index 000000000000..ee9c956d1e91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationclientdetails.go @@ -0,0 +1,10 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationClientDetails struct { + ApplicationId *string `json:"applicationId,omitempty"` + Oid *string `json:"oid,omitempty"` + Puid *string `json:"puid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationjitaccesspolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationjitaccesspolicy.go new file mode 100644 index 000000000000..f3550cd35a1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationjitaccesspolicy.go @@ -0,0 +1,11 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationJitAccessPolicy struct { + JitAccessEnabled bool `json:"jitAccessEnabled"` + JitApprovalMode *JitApprovalMode `json:"jitApprovalMode,omitempty"` + JitApprovers *[]JitApproverDefinition `json:"jitApprovers,omitempty"` + MaximumJitAccessDuration *string `json:"maximumJitAccessDuration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpackagecontact.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpackagecontact.go new file mode 100644 index 000000000000..74d3d0907226 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpackagecontact.go @@ -0,0 +1,10 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPackageContact struct { + ContactName *string `json:"contactName,omitempty"` + Email string `json:"email"` + Phone string `json:"phone"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpackagesupporturls.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpackagesupporturls.go new file mode 100644 index 000000000000..91a12da36f8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpackagesupporturls.go @@ -0,0 +1,9 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPackageSupportUrls struct { + GovernmentCloud *string `json:"governmentCloud,omitempty"` + PublicAzure *string `json:"publicAzure,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpatchable.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpatchable.go new file mode 100644 index 000000000000..9b84b68e6914 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationpatchable.go @@ -0,0 +1,23 @@ +package applications + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPatchable struct { + Id *string `json:"id,omitempty"` + Identity *Identity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *PlanPatchable `json:"plan,omitempty"` + Properties *ApplicationProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationproperties.go new file mode 100644 index 000000000000..be19835b7e41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_applicationproperties.go @@ -0,0 +1,22 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProperties struct { + ApplicationDefinitionId *string `json:"applicationDefinitionId,omitempty"` + Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"` + Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"` + BillingDetails *ApplicationBillingDetailsDefinition `json:"billingDetails,omitempty"` + CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"` + CustomerSupport *ApplicationPackageContact `json:"customerSupport,omitempty"` + JitAccessPolicy *ApplicationJitAccessPolicy `json:"jitAccessPolicy,omitempty"` + ManagedResourceGroupId *string `json:"managedResourceGroupId,omitempty"` + ManagementMode *ApplicationManagementMode `json:"managementMode,omitempty"` + Outputs *interface{} `json:"outputs,omitempty"` + Parameters *interface{} `json:"parameters,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublisherTenantId *string `json:"publisherTenantId,omitempty"` + SupportUrls *ApplicationPackageSupportUrls `json:"supportUrls,omitempty"` + UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_identity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_identity.go new file mode 100644 index 000000000000..1deb66d458fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_identity.go @@ -0,0 +1,11 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Identity struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *ResourceIdentityType `json:"type,omitempty"` + UserAssignedIdentities *map[string]UserAssignedResourceIdentity `json:"userAssignedIdentities,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_jitapproverdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_jitapproverdefinition.go new file mode 100644 index 000000000000..79a8250ec46d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_jitapproverdefinition.go @@ -0,0 +1,10 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JitApproverDefinition struct { + DisplayName *string `json:"displayName,omitempty"` + Id string `json:"id"` + Type *JitApproverType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_jitrequestmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_jitrequestmetadata.go new file mode 100644 index 000000000000..58e668349d3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_jitrequestmetadata.go @@ -0,0 +1,11 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JitRequestMetadata struct { + OriginRequestId *string `json:"originRequestId,omitempty"` + RequestorId *string `json:"requestorId,omitempty"` + SubjectDisplayName *string `json:"subjectDisplayName,omitempty"` + TenantDisplayName *string `json:"tenantDisplayName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_listtokenrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_listtokenrequest.go new file mode 100644 index 000000000000..043c9a75d1bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_listtokenrequest.go @@ -0,0 +1,9 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListTokenRequest struct { + AuthorizationAudience *string `json:"authorizationAudience,omitempty"` + UserAssignedIdentities *[]string `json:"userAssignedIdentities,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_managedidentitytoken.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_managedidentitytoken.go new file mode 100644 index 000000000000..e96739ba8b31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_managedidentitytoken.go @@ -0,0 +1,14 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentityToken struct { + AccessToken *string `json:"accessToken,omitempty"` + AuthorizationAudience *string `json:"authorizationAudience,omitempty"` + ExpiresIn *string `json:"expiresIn,omitempty"` + ExpiresOn *string `json:"expiresOn,omitempty"` + NotBefore *string `json:"notBefore,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + TokenType *string `json:"tokenType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_managedidentitytokenresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_managedidentitytokenresult.go new file mode 100644 index 000000000000..bf3e80e15774 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_managedidentitytokenresult.go @@ -0,0 +1,8 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentityTokenResult struct { + Value *[]ManagedIdentityToken `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_plan.go new file mode 100644 index 000000000000..1331ca4bf68f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_plan.go @@ -0,0 +1,12 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version string `json:"version"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_planpatchable.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_planpatchable.go new file mode 100644 index 000000000000..c257477ed87f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_planpatchable.go @@ -0,0 +1,12 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlanPatchable struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_sku.go new file mode 100644 index 000000000000..f02b3b5e50d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_sku.go @@ -0,0 +1,13 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Model *string `json:"model,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_updateaccessdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_updateaccessdefinition.go new file mode 100644 index 000000000000..af99a4538e33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_updateaccessdefinition.go @@ -0,0 +1,11 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateAccessDefinition struct { + Approver *string `json:"approver,omitempty"` + Metadata JitRequestMetadata `json:"metadata"` + Status Status `json:"status"` + SubStatus Substatus `json:"subStatus"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_userassignedresourceidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_userassignedresourceidentity.go new file mode 100644 index 000000000000..c44aa691a6b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/model_userassignedresourceidentity.go @@ -0,0 +1,9 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedResourceIdentity struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/predicates.go new file mode 100644 index 000000000000..ce73dd931817 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/predicates.go @@ -0,0 +1,42 @@ +package applications + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationOperationPredicate struct { + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p ApplicationOperationPredicate) Matches(input Application) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && *p.Kind != input.Kind { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + 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/managedapplications/2021-07-01/applications/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/version.go new file mode 100644 index 000000000000..98b1f8c38ec1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications/version.go @@ -0,0 +1,12 @@ +package applications + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-07-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/applications/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 98a6b7e4cce8..7b559f3f0770 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -28,7 +28,6 @@ github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v2.0/synapse github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-07-10/siterecovery github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-12-01/features -github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-05-01/managementgroups github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/subscriptions @@ -417,6 +416,8 @@ github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022- github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations +github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applicationdefinitions +github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31 github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments