diff --git a/services/resources/mgmt/2020-06-01/resources/enums.go b/services/resources/mgmt/2020-06-01/resources/enums.go index 1821dc57f2b8..e6784cf1ca39 100644 --- a/services/resources/mgmt/2020-06-01/resources/enums.go +++ b/services/resources/mgmt/2020-06-01/resources/enums.go @@ -135,6 +135,23 @@ func PossibleDeploymentModeValues() []DeploymentMode { return []DeploymentMode{Complete, Incremental} } +// ExpressionEvaluationOptionsScopeType enumerates the values for expression evaluation options scope type. +type ExpressionEvaluationOptionsScopeType string + +const ( + // ExpressionEvaluationOptionsScopeTypeInner ... + ExpressionEvaluationOptionsScopeTypeInner ExpressionEvaluationOptionsScopeType = "Inner" + // ExpressionEvaluationOptionsScopeTypeNotSpecified ... + ExpressionEvaluationOptionsScopeTypeNotSpecified ExpressionEvaluationOptionsScopeType = "NotSpecified" + // ExpressionEvaluationOptionsScopeTypeOuter ... + ExpressionEvaluationOptionsScopeTypeOuter ExpressionEvaluationOptionsScopeType = "Outer" +) + +// PossibleExpressionEvaluationOptionsScopeTypeValues returns an array of possible values for the ExpressionEvaluationOptionsScopeType const type. +func PossibleExpressionEvaluationOptionsScopeTypeValues() []ExpressionEvaluationOptionsScopeType { + return []ExpressionEvaluationOptionsScopeType{ExpressionEvaluationOptionsScopeTypeInner, ExpressionEvaluationOptionsScopeTypeNotSpecified, ExpressionEvaluationOptionsScopeTypeOuter} +} + // OnErrorDeploymentType enumerates the values for on error deployment type. type OnErrorDeploymentType string diff --git a/services/resources/mgmt/2020-06-01/resources/models.go b/services/resources/mgmt/2020-06-01/resources/models.go index b9472b3e16f5..12c500bfcac4 100644 --- a/services/resources/mgmt/2020-06-01/resources/models.go +++ b/services/resources/mgmt/2020-06-01/resources/models.go @@ -715,6 +715,8 @@ type DeploymentProperties struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` + // ExpressionEvaluationOptions - Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + ExpressionEvaluationOptions *ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"` } // DeploymentPropertiesExtended deployment properties with additional details. @@ -1320,6 +1322,8 @@ type DeploymentWhatIfProperties struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` + // ExpressionEvaluationOptions - Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + ExpressionEvaluationOptions *ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"` } // DeploymentWhatIfSettings deployment What-If operation settings. @@ -1358,6 +1362,13 @@ type ExportTemplateRequest struct { Options *string `json:"options,omitempty"` } +// ExpressionEvaluationOptions specifies whether template expressions are evaluated within the scope of the +// parent template or nested template. +type ExpressionEvaluationOptions struct { + // Scope - The scope to be used for evaluation of parameters, variables and functions in a nested template. Possible values include: 'ExpressionEvaluationOptionsScopeTypeNotSpecified', 'ExpressionEvaluationOptionsScopeTypeOuter', 'ExpressionEvaluationOptionsScopeTypeInner' + Scope ExpressionEvaluationOptionsScopeType `json:"scope,omitempty"` +} + // GenericResource resource information. type GenericResource struct { autorest.Response `json:"-"` diff --git a/services/resources/mgmt/2020-06-01/resources/providers.go b/services/resources/mgmt/2020-06-01/resources/providers.go index 364aa69022a7..6b372ff2d69c 100644 --- a/services/resources/mgmt/2020-06-01/resources/providers.go +++ b/services/resources/mgmt/2020-06-01/resources/providers.go @@ -21,6 +21,7 @@ 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" ) @@ -509,6 +510,86 @@ func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Pro return } +// RegisterAtManagementGroupScope registers a management group with a resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider to register. +// groupID - the management group ID. +func (client ProvidersClient) RegisterAtManagementGroupScope(ctx context.Context, resourceProviderNamespace string, groupID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.RegisterAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.ProvidersClient", "RegisterAtManagementGroupScope", err.Error()) + } + + req, err := client.RegisterAtManagementGroupScopePreparer(ctx, resourceProviderNamespace, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "RegisterAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterAtManagementGroupScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "RegisterAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.RegisterAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "RegisterAtManagementGroupScope", resp, "Failure responding to request") + } + + return +} + +// RegisterAtManagementGroupScopePreparer prepares the RegisterAtManagementGroupScope request. +func (client ProvidersClient) RegisterAtManagementGroupScopePreparer(ctx context.Context, resourceProviderNamespace string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterAtManagementGroupScopeSender sends the RegisterAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) RegisterAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RegisterAtManagementGroupScopeResponder handles the response to the RegisterAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client ProvidersClient) RegisterAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + // Unregister unregisters a subscription from a resource provider. // Parameters: // resourceProviderNamespace - the namespace of the resource provider to unregister. diff --git a/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go b/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go index 8c5b69684e23..f6ab7e5fdfb9 100644 --- a/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go +++ b/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go @@ -96,6 +96,7 @@ type ProvidersClientAPI interface { ListAtTenantScope(ctx context.Context, top *int32, expand string) (result resources.ProviderListResultPage, err error) ListAtTenantScopeComplete(ctx context.Context, top *int32, expand string) (result resources.ProviderListResultIterator, err error) Register(ctx context.Context, resourceProviderNamespace string) (result resources.Provider, err error) + RegisterAtManagementGroupScope(ctx context.Context, resourceProviderNamespace string, groupID string) (result autorest.Response, err error) Unregister(ctx context.Context, resourceProviderNamespace string) (result resources.Provider, err error) }