diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md index 52911e4cc5e4..60675616e95a 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md @@ -1,2 +1,16 @@ -# Change History +# Unreleased +## 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/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json index 1f5ee74c43e5..77107e2a8ecc 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "5f1802d90056e1fc0ea9ca348ee036110a61ea29", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2018-01-01-preview", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go index 71dc9f3cdf7e..adb9c2979f8e 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/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" ) @@ -43,6 +44,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/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go index 1e1da38902d9..b5ddf57e6d46 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/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/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go index 62d87b8d120b..961759680282 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/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" ) @@ -32,7 +33,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. +// 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. @@ -48,6 +49,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 { @@ -156,7 +166,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. +// 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") @@ -168,6 +178,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/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go index bcfa975c050e..7b001ed4468d 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go @@ -275,7 +275,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} @@ -348,7 +348,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} @@ -519,6 +519,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 { @@ -625,7 +631,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. @@ -644,6 +650,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 { @@ -755,7 +770,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. @@ -770,6 +785,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/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go index d3ee5a13aca3..445a59445e3d 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go @@ -179,7 +179,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}