diff --git a/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md b/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md index 52911e4cc5e4..c1b6629a9798 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md +++ b/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md @@ -1,2 +1,43 @@ -# Change History +# Unreleased +## Breaking Changes + +### Signature Changes + +#### Funcs + +1. ProviderOperationsMetadataClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ProviderOperationsMetadataClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ProviderOperationsMetadataClient.List + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ProviderOperationsMetadataClient.ListComplete + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ProviderOperationsMetadataClient.ListPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string + +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail +1. ErrorResponse diff --git a/services/authorization/mgmt/2015-07-01/authorization/_meta.json b/services/authorization/mgmt/2015-07-01/authorization/_meta.json index a2715bfe473a..536b4c08c886 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/_meta.json +++ b/services/authorization/mgmt/2015-07-01/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "5f1802d90056e1fc0ea9ca348ee036110a61ea29", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2015-07-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go b/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go index abe0fe9e4378..d4328f8c201e 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go +++ b/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go @@ -36,9 +36,9 @@ var _ RoleDefinitionsClientAPI = (*authorization.RoleDefinitionsClient)(nil) // ProviderOperationsMetadataClientAPI contains the set of methods on the ProviderOperationsMetadataClient type. type ProviderOperationsMetadataClientAPI interface { - Get(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (result authorization.ProviderOperationsMetadata, err error) - List(ctx context.Context, APIVersion string, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) - ListComplete(ctx context.Context, APIVersion string, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) + Get(ctx context.Context, resourceProviderNamespace string, expand string) (result authorization.ProviderOperationsMetadata, err error) + List(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) + ListComplete(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) } var _ ProviderOperationsMetadataClientAPI = (*authorization.ProviderOperationsMetadataClient)(nil) diff --git a/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go b/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go index cdff22469469..d0e42af959e3 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go +++ b/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go @@ -10,6 +10,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" ) @@ -46,6 +47,12 @@ func (client ClassicAdministratorsClient) List(ctx context.Context) (result Clas tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("authorization.ClassicAdministratorsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { diff --git a/services/authorization/mgmt/2015-07-01/authorization/models.go b/services/authorization/mgmt/2015-07-01/authorization/models.go index 79d95b5c8d46..668001bf0aff 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/models.go +++ b/services/authorization/mgmt/2015-07-01/authorization/models.go @@ -267,6 +267,47 @@ type ClassicAdministratorProperties struct { Role *string `json:"role,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Permission role definition permissions. type Permission struct { // Actions - Allowed actions. diff --git a/services/authorization/mgmt/2015-07-01/authorization/permissions.go b/services/authorization/mgmt/2015-07-01/authorization/permissions.go index a3358cbeb722..6acd393f3a27 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/permissions.go +++ b/services/authorization/mgmt/2015-07-01/authorization/permissions.go @@ -10,6 +10,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" ) @@ -35,7 +36,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group containing the resource. The name is case insensitive. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -51,6 +52,15 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("authorization.PermissionsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -159,7 +169,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group to get the permissions for. The name is case insensitive. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") @@ -171,6 +181,15 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) if err != nil { diff --git a/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go b/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go index ac10ce7754d9..01c464a610e8 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go +++ b/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go @@ -37,9 +37,8 @@ func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscription // Get gets provider operations metadata for the specified resource provider. // Parameters: // resourceProviderNamespace - the namespace of the resource provider. -// APIVersion - the API version to use for the operation. // expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (result ProviderOperationsMetadata, err error) { +func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.Get") defer func() { @@ -50,7 +49,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, resourceProviderNamespace, APIVersion, expand) + req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) if err != nil { err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") return @@ -73,11 +72,12 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource } // GetPreparer prepares the Get request. -func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -115,9 +115,8 @@ func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) // List gets provider operations metadata for all resource providers. // Parameters: -// APIVersion - the API version to use for this operation. // expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVersion string, expand string) (result ProviderOperationsMetadataListResultPage, err error) { +func (client ProviderOperationsMetadataClient) List(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") defer func() { @@ -129,7 +128,7 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVers }() } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, APIVersion, expand) + req, err := client.ListPreparer(ctx, expand) if err != nil { err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") return @@ -156,7 +155,8 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVers } // ListPreparer prepares the List request. -func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, APIVersion string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -214,7 +214,7 @@ func (client ProviderOperationsMetadataClient) listNextResults(ctx context.Conte } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, APIVersion string, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { +func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") defer func() { @@ -225,6 +225,6 @@ func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, APIVersion, expand) + result.page, err = client.List(ctx, expand) return } diff --git a/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go b/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go index 43897ed795c4..8e529fe11f91 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go +++ b/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go @@ -281,7 +281,7 @@ func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -357,7 +357,7 @@ func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.R func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -531,6 +531,12 @@ func (client RoleAssignmentsClient) List(ctx context.Context, filter string) (re tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -637,7 +643,7 @@ func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets role assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -656,6 +662,15 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -767,7 +782,7 @@ func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets role assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or // above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope // for the specified principal. @@ -782,6 +797,15 @@ func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go b/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go index 5bc63943465a..1d17715bff18 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go +++ b/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go @@ -182,7 +182,7 @@ func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp}