diff --git a/sdk/policy/arm-policy/LICENSE.txt b/sdk/policy/arm-policy/LICENSE.txt index b73b4a1293c3..ea8fb1516028 100644 --- a/sdk/policy/arm-policy/LICENSE.txt +++ b/sdk/policy/arm-policy/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 Microsoft +Copyright (c) 2020 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/policy/arm-policy/src/models/index.ts b/sdk/policy/arm-policy/src/models/index.ts index fa048f50c6f6..a3c35f1d4fe8 100644 --- a/sdk/policy/arm-policy/src/models/index.ts +++ b/sdk/policy/arm-policy/src/models/index.ts @@ -59,7 +59,7 @@ export interface ErrorResponse { } /** - * An interface representing ParameterValuesValue. + * The value of a parameter. */ export interface ParameterValuesValue { /** @@ -97,7 +97,8 @@ export interface Identity { */ readonly tenantId?: string; /** - * The identity type. Possible values include: 'SystemAssigned', 'None' + * The identity type. This is the only required field when adding a system assigned identity to a + * resource. Possible values include: 'SystemAssigned', 'None' */ type?: ResourceIdentityType; } @@ -188,7 +189,7 @@ export interface ParameterDefinitionsValueMetadata { } /** - * An interface representing ParameterDefinitionsValue. + * The definition of a parameter that can be provided to the policy. */ export interface ParameterDefinitionsValue { /** @@ -570,6 +571,26 @@ export type PolicyAssignmentsListForResourceResponse = PolicyAssignmentListResul }; }; +/** + * Contains response data for the listForManagementGroup operation. + */ +export type PolicyAssignmentsListForManagementGroupResponse = PolicyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PolicyAssignmentListResult; + }; +}; + /** * Contains response data for the list operation. */ @@ -690,6 +711,26 @@ export type PolicyAssignmentsListForResourceNextResponse = PolicyAssignmentListR }; }; +/** + * Contains response data for the listForManagementGroupNext operation. + */ +export type PolicyAssignmentsListForManagementGroupNextResponse = PolicyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PolicyAssignmentListResult; + }; +}; + /** * Contains response data for the listNext operation. */ diff --git a/sdk/policy/arm-policy/src/models/parameters.ts b/sdk/policy/arm-policy/src/models/parameters.ts index ac112355dc69..2c6297682f08 100644 --- a/sdk/policy/arm-policy/src/models/parameters.ts +++ b/sdk/policy/arm-policy/src/models/parameters.ts @@ -55,6 +55,17 @@ export const filter1: msRest.OperationQueryParameter = { } } }; +export const filter2: msRest.OperationQueryParameter = { + parameterPath: "filter", + mapper: { + required: true, + serializedName: "$filter", + type: { + name: "String" + } + }, + skipEncoding: true +}; export const managementGroupId: msRest.OperationURLParameter = { parameterPath: "managementGroupId", mapper: { diff --git a/sdk/policy/arm-policy/src/operations/policyAssignments.ts b/sdk/policy/arm-policy/src/operations/policyAssignments.ts index 056032f1b01a..5faabeda2709 100644 --- a/sdk/policy/arm-policy/src/operations/policyAssignments.ts +++ b/sdk/policy/arm-policy/src/operations/policyAssignments.ts @@ -280,6 +280,50 @@ export class PolicyAssignments { callback) as Promise; } + /** + * This operation retrieves the list of all policy assignments applicable to the management group + * that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId + * eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy + * assignments that are assigned to the management group or the management group's ancestors. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + * assignments of the policy definition whose id is {value} that apply to the management group. + * @summary Retrieves all policy assignments that apply to a management group. + * @param managementGroupId The ID of the management group. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at + * management group scope. + * @param [options] The optional parameters + * @returns Promise + */ + listForManagementGroup(managementGroupId: string, filter: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param managementGroupId The ID of the management group. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at + * management group scope. + * @param callback The callback + */ + listForManagementGroup(managementGroupId: string, filter: string, callback: msRest.ServiceCallback): void; + /** + * @param managementGroupId The ID of the management group. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. A filter is required when listing policy assignments at + * management group scope. + * @param options The optional parameters + * @param callback The callback + */ + listForManagementGroup(managementGroupId: string, filter: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listForManagementGroup(managementGroupId: string, filter: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + managementGroupId, + filter, + options + }, + listForManagementGroupOperationSpec, + callback) as Promise; + } + /** * This operation retrieves the list of all policy assignments associated with the given * subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or @@ -523,6 +567,40 @@ export class PolicyAssignments { callback) as Promise; } + /** + * This operation retrieves the list of all policy assignments applicable to the management group + * that match the given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId + * eq '{value}''. If $filter=atScope() is provided, the returned list includes all policy + * assignments that are assigned to the management group or the management group's ancestors. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + * assignments of the policy definition whose id is {value} that apply to the management group. + * @summary Retrieves all policy assignments that apply to a management group. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listForManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listForManagementGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listForManagementGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listForManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listForManagementGroupNextOperationSpec, + callback) as Promise; + } + /** * This operation retrieves the list of all policy assignments associated with the given * subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or @@ -698,6 +776,30 @@ const listForResourceOperationSpec: msRest.OperationSpec = { serializer }; +const listForManagementGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", + urlParameters: [ + Parameters.managementGroupId + ], + queryParameters: [ + Parameters.filter2, + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PolicyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments", @@ -841,6 +943,27 @@ const listForResourceNextOperationSpec: msRest.OperationSpec = { serializer }; +const listForManagementGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PolicyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com",