From e04cde7f40667e7a0f6cfa207b0118a38eac2fb9 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 11 Nov 2020 04:04:13 +0000 Subject: [PATCH] Generated from 73677f19181157fb0c154a084922a92fa6b528cd --- sdk/policy/arm-policy/README.md | 21 +- sdk/policy/arm-policy/rollup.config.js | 4 +- .../src/models/dataPolicyManifestsMappers.ts | 23 + sdk/policy/arm-policy/src/models/index.ts | 1062 +++-------------- sdk/policy/arm-policy/src/models/mappers.ts | 527 +++----- .../arm-policy/src/models/parameters.ts | 155 +-- .../src/models/policyAssignmentsMappers.ts | 25 - .../src/models/policyDefinitionsMappers.ts | 25 - .../src/models/policySetDefinitionsMappers.ts | 25 - .../src/operations/dataPolicyManifests.ts | 189 +++ sdk/policy/arm-policy/src/operations/index.ts | 9 +- .../src/operations/policyAssignments.ts | 986 --------------- .../src/operations/policyDefinitions.ts | 730 ----------- .../src/operations/policySetDefinitions.ts | 740 ------------ sdk/policy/arm-policy/src/policyClient.ts | 18 +- .../arm-policy/src/policyClientContext.ts | 15 +- 16 files changed, 547 insertions(+), 4007 deletions(-) create mode 100644 sdk/policy/arm-policy/src/models/dataPolicyManifestsMappers.ts delete mode 100644 sdk/policy/arm-policy/src/models/policyAssignmentsMappers.ts delete mode 100644 sdk/policy/arm-policy/src/models/policyDefinitionsMappers.ts delete mode 100644 sdk/policy/arm-policy/src/models/policySetDefinitionsMappers.ts create mode 100644 sdk/policy/arm-policy/src/operations/dataPolicyManifests.ts delete mode 100644 sdk/policy/arm-policy/src/operations/policyAssignments.ts delete mode 100644 sdk/policy/arm-policy/src/operations/policyDefinitions.ts delete mode 100644 sdk/policy/arm-policy/src/operations/policySetDefinitions.ts diff --git a/sdk/policy/arm-policy/README.md b/sdk/policy/arm-policy/README.md index 1bc9c1c86980..4db32281acad 100644 --- a/sdk/policy/arm-policy/README.md +++ b/sdk/policy/arm-policy/README.md @@ -15,7 +15,7 @@ npm install @azure/arm-policy ### How to use -#### nodejs - Authentication, client creation and get policyAssignments as an example written in TypeScript. +#### nodejs - client creation and getByPolicyMode dataPolicyManifests as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth @@ -26,18 +26,16 @@ npm install @azure/ms-rest-nodeauth@"^3.0.0" ##### Sample code +While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package ```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { PolicyClient, PolicyModels, PolicyMappers } from "@azure/arm-policy"; +const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +const { PolicyClient } = require("@azure/arm-policy"); const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { const client = new PolicyClient(creds, subscriptionId); - const scope = "testscope"; - const policyAssignmentName = "testpolicyAssignmentName"; - client.policyAssignments.get(scope, policyAssignmentName).then((result) => { + const policyMode = "testpolicyMode"; + client.dataPolicyManifests.getByPolicyMode(policyMode).then((result) => { console.log("The result is:"); console.log(result); }); @@ -46,7 +44,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### browser - Authentication, client creation and get policyAssignments as an example written in JavaScript. +#### browser - Authentication, client creation and getByPolicyMode dataPolicyManifests as an example written in JavaScript. ##### Install @azure/ms-rest-browserauth @@ -80,9 +78,8 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to authManager.login(); } const client = new Azure.ArmPolicy.PolicyClient(res.creds, subscriptionId); - const scope = "testscope"; - const policyAssignmentName = "testpolicyAssignmentName"; - client.policyAssignments.get(scope, policyAssignmentName).then((result) => { + const policyMode = "testpolicyMode"; + client.dataPolicyManifests.getByPolicyMode(policyMode).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { diff --git a/sdk/policy/arm-policy/rollup.config.js b/sdk/policy/arm-policy/rollup.config.js index 8747e388192c..156fb323dbb5 100644 --- a/sdk/policy/arm-policy/rollup.config.js +++ b/sdk/policy/arm-policy/rollup.config.js @@ -21,8 +21,8 @@ const config = { "@azure/ms-rest-azure-js": "msRestAzure" }, banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. diff --git a/sdk/policy/arm-policy/src/models/dataPolicyManifestsMappers.ts b/sdk/policy/arm-policy/src/models/dataPolicyManifestsMappers.ts new file mode 100644 index 000000000000..32799ed2efb9 --- /dev/null +++ b/sdk/policy/arm-policy/src/models/dataPolicyManifestsMappers.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + Alias, + AliasPath, + AliasPathMetadata, + AliasPattern, + BaseResource, + CloudError, + DataEffect, + DataManifestCustomResourceFunctionDefinition, + DataPolicyManifest, + DataPolicyManifestListResult, + ErrorAdditionalInfo, + ErrorDetail, + ResourceTypeAliases +} from "../models/mappers"; diff --git a/sdk/policy/arm-policy/src/models/index.ts b/sdk/policy/arm-policy/src/models/index.ts index a3c35f1d4fe8..e4a459446831 100644 --- a/sdk/policy/arm-policy/src/models/index.ts +++ b/sdk/policy/arm-policy/src/models/index.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -28,9 +28,9 @@ export interface ErrorAdditionalInfo { } /** - * The resource management error response. + * The error detail. */ -export interface ErrorResponse { +export interface ErrorDetail { /** * The error code. * **NOTE: This property will not be serialized. It can only be populated by the server.** @@ -50,7 +50,7 @@ export interface ErrorResponse { * The error details. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly details?: ErrorResponse[]; + readonly details?: ErrorDetail[]; /** * The error additional info. * **NOTE: This property will not be serialized. It can only be populated by the server.** @@ -59,305 +59,209 @@ export interface ErrorResponse { } /** - * The value of a parameter. + * Common error response for all Azure Resource Manager APIs to return error details for failed + * operations. (This also follows the OData error response format.). + * @summary Error response */ -export interface ParameterValuesValue { +export interface CloudError { /** - * The value of the parameter. + * The error object. */ - value?: any; + error?: ErrorDetail; } /** - * The policy sku. This property is optional, obsolete, and will be ignored. + * The custom resource function definition. */ -export interface PolicySku { +export interface DataManifestCustomResourceFunctionDefinition { /** - * The name of the policy sku. Possible values are A0 and A1. + * The function name as it will appear in the policy rule. eg - 'vault'. */ - name: string; + name?: string; /** - * The policy sku tier. Possible values are Free and Standard. + * The fully qualified control plane resource type that this function represents. eg - + * 'Microsoft.KeyVault/vaults'. */ - tier?: string; -} - -/** - * Identity for the resource. - */ -export interface Identity { + fullyQualifiedResourceType?: string; /** - * The principal ID of the resource identity. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly principalId?: string; - /** - * The tenant ID of the resource identity. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The top-level properties that can be selected on the function's output. eg - [ "name", + * "location" ] if vault().name and vault().location are supported */ - readonly tenantId?: string; + defaultProperties?: string[]; /** - * The identity type. This is the only required field when adding a system assigned identity to a - * resource. Possible values include: 'SystemAssigned', 'None' + * A value indicating whether the custom properties within the property bag are allowed. Needs + * api-version to be specified in the policy rule eg - vault('2019-06-01'). */ - type?: ResourceIdentityType; + allowCustomProperties?: boolean; } /** - * The policy assignment. + * The data effect definition. */ -export interface PolicyAssignment extends BaseResource { - /** - * The display name of the policy assignment. - */ - displayName?: string; - /** - * The ID of the policy definition or policy set definition being assigned. - */ - policyDefinitionId?: string; - /** - * The scope for the policy assignment. - */ - scope?: string; - /** - * The policy's excluded scopes. - */ - notScopes?: string[]; - /** - * The parameter values for the assigned policy rule. The keys are the parameter names. - */ - parameters?: { [propertyName: string]: ParameterValuesValue }; - /** - * This message will be part of response in case of policy violation. - */ - description?: string; - /** - * The policy assignment metadata. Metadata is an open ended object and is typically a collection - * of key value pairs. - */ - metadata?: any; - /** - * The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible - * values include: 'Default', 'DoNotEnforce' - */ - enforcementMode?: EnforcementMode; - /** - * The ID of the policy assignment. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The type of the policy assignment. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; +export interface DataEffect { /** - * The name of the policy assignment. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The policy sku. This property is optional, obsolete, and will be ignored. + * The data effect name. */ - sku?: PolicySku; + name?: string; /** - * The location of the policy assignment. Only required when utilizing managed identity. + * The data effect details schema. */ - location?: string; - /** - * The managed identity associated with the policy assignment. - */ - identity?: Identity; + detailsSchema?: any; } /** - * General metadata for the parameter. + * The type of the pattern for an alias path. */ -export interface ParameterDefinitionsValueMetadata { +export interface AliasPattern { /** - * The display name for the parameter. + * The alias pattern phrase. */ - displayName?: string; + phrase?: string; /** - * The description of the parameter. + * The alias pattern variable. */ - description?: string; + variable?: string; /** - * Describes unknown properties. The value of an unknown property can be of "any" type. + * The type of alias pattern. Possible values include: 'NotSpecified', 'Extract' */ - [property: string]: any; + type?: AliasPatternType; } /** - * The definition of a parameter that can be provided to the policy. + * An interface representing AliasPathMetadata. */ -export interface ParameterDefinitionsValue { - /** - * The data type of the parameter. Possible values include: 'String', 'Array', 'Object', - * 'Boolean', 'Integer', 'Float', 'DateTime' - */ - type?: ParameterType; +export interface AliasPathMetadata { /** - * The allowed values for the parameter. - */ - allowedValues?: any[]; - /** - * The default value for the parameter if no value is provided. + * The type of the token that the alias path is referring to. Possible values include: + * 'NotSpecified', 'Any', 'String', 'Object', 'Array', 'Integer', 'Number', 'Boolean' + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - defaultValue?: any; + readonly type?: AliasPathTokenType; /** - * General metadata for the parameter. + * The attributes of the token that the alias path is referring to. Possible values include: + * 'None', 'Modifiable' + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - metadata?: ParameterDefinitionsValueMetadata; + readonly attributes?: AliasPathAttributes; } /** - * The policy definition. + * The type of the paths for alias. */ -export interface PolicyDefinition extends BaseResource { +export interface AliasPath { /** - * The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. - * Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static' + * The path of an alias. */ - policyType?: PolicyType; + path?: string; /** - * The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + * The API versions. */ - mode?: string; + apiVersions?: string[]; /** - * The display name of the policy definition. + * The pattern for an alias path. */ - displayName?: string; + pattern?: AliasPattern; /** - * The policy definition description. + * The metadata of the alias path. If missing, fall back to the default metadata of the alias. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - description?: string; + readonly metadata?: AliasPathMetadata; +} + +/** + * The alias type. + */ +export interface Alias { /** - * The policy rule. + * The alias name. */ - policyRule?: any; + name?: string; /** - * The policy definition metadata. Metadata is an open ended object and is typically a - * collection of key value pairs. + * The paths for an alias. */ - metadata?: any; + paths?: AliasPath[]; /** - * The parameter definitions for parameters used in the policy rule. The keys are the parameter - * names. + * The type of the alias. Possible values include: 'NotSpecified', 'PlainText', 'Mask' */ - parameters?: { [propertyName: string]: ParameterDefinitionsValue }; + type?: AliasType; /** - * The ID of the policy definition. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The default path for an alias. */ - readonly id?: string; + defaultPath?: string; /** - * The name of the policy definition. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The default pattern for an alias. */ - readonly name?: string; + defaultPattern?: AliasPattern; /** - * The type of the resource (Microsoft.Authorization/policyDefinitions). + * The default alias path metadata. Applies to the default path and to any alias path that + * doesn't have metadata * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly type?: string; + readonly defaultMetadata?: AliasPathMetadata; } /** - * The policy definition reference. + * The resource type aliases definition. */ -export interface PolicyDefinitionReference { - /** - * The ID of the policy definition or policy set definition. - */ - policyDefinitionId: string; +export interface ResourceTypeAliases { /** - * The parameter values for the referenced policy rule. The keys are the parameter names. + * The resource type name. */ - parameters?: { [propertyName: string]: ParameterValuesValue }; + resourceType?: string; /** - * A unique id (within the policy set definition) for this policy definition reference. + * The aliases for property names. */ - policyDefinitionReferenceId?: string; - /** - * The name of the groups that this policy definition reference belongs to. - */ - groupNames?: string[]; + aliases?: Alias[]; } /** - * The policy definition group. + * The data policy manifest. */ -export interface PolicyDefinitionGroup { - /** - * The name of the group. - */ - name: string; - /** - * The group's display name. - */ - displayName?: string; - /** - * The group's category. - */ - category?: string; +export interface DataPolicyManifest extends BaseResource { /** - * The group's description. + * The list of namespaces for the data policy manifest. */ - description?: string; + namespaces?: string[]; /** - * A resource ID of a resource that contains additional metadata about the group. + * The policy mode of the data policy manifest. */ - additionalMetadataId?: string; -} - -/** - * The policy set definition. - */ -export interface PolicySetDefinition extends BaseResource { + policyMode?: string; /** - * The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. - * Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static' + * A value indicating whether policy mode is allowed only in built-in definitions. */ - policyType?: PolicyType; + isBuiltInOnly?: boolean; /** - * The display name of the policy set definition. + * An array of resource type aliases. */ - displayName?: string; + resourceTypeAliases?: ResourceTypeAliases[]; /** - * The policy set definition description. + * The effect definition. */ - description?: string; + effects?: DataEffect[]; /** - * The policy set definition metadata. Metadata is an open ended object and is typically a - * collection of key value pairs. + * The non-alias field accessor values that can be used in the policy rule. */ - metadata?: any; + fieldValues?: string[]; /** - * The policy set definition parameters that can be used in policy definition references. + * The standard resource functions (subscription and/or resourceGroup). */ - parameters?: { [propertyName: string]: ParameterDefinitionsValue }; + standard?: string[]; /** - * An array of policy definition references. + * An array of data manifest custom resource definition. */ - policyDefinitions: PolicyDefinitionReference[]; + custom?: DataManifestCustomResourceFunctionDefinition[]; /** - * The metadata describing groups of policy definition references within the policy set - * definition. - */ - policyDefinitionGroups?: PolicyDefinitionGroup[]; - /** - * The ID of the policy set definition. + * The ID of the data policy manifest. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * The name of the policy set definition. + * The name of the data policy manifest (it's the same as the Policy Mode). * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly name?: string; /** - * The type of the resource (Microsoft.Authorization/policySetDefinitions). + * The type of the resource (Microsoft.Authorization/dataPolicyManifests). * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly type?: string; @@ -366,21 +270,12 @@ export interface PolicySetDefinition extends BaseResource { /** * Optional Parameters. */ -export interface PolicyAssignmentsListForResourceGroupOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. Valid values for $filter are: 'atScope()' or - * 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. - */ - filter?: string; -} - -/** - * Optional Parameters. - */ -export interface PolicyAssignmentsListForResourceOptionalParams extends msRest.RequestOptionsBase { +export interface DataPolicyManifestsListOptionalParams extends msRest.RequestOptionsBase { /** - * The filter to apply on the operation. Valid values for $filter are: 'atScope()' or - * 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * The filter to apply on the operation. Valid values for $filter are: "namespace eq '{value}'". + * If $filter is not provided, no filtering is performed. If $filter=namespace eq '{value}' is + * provided, the returned list only includes all data policy manifests that have a namespace + * matching the provided value. */ filter?: string; } @@ -388,10 +283,12 @@ export interface PolicyAssignmentsListForResourceOptionalParams extends msRest.R /** * Optional Parameters. */ -export interface PolicyAssignmentsListOptionalParams extends msRest.RequestOptionsBase { +export interface DataPolicyManifestsListNextOptionalParams extends msRest.RequestOptionsBase { /** - * The filter to apply on the operation. Valid values for $filter are: 'atScope()' or - * 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * The filter to apply on the operation. Valid values for $filter are: "namespace eq '{value}'". + * If $filter is not provided, no filtering is performed. If $filter=namespace eq '{value}' is + * provided, the returned list only includes all data policy manifests that have a namespace + * matching the provided value. */ filter?: string; } @@ -405,34 +302,10 @@ export interface PolicyClientOptions extends AzureServiceClientOptions { /** * @interface - * List of policy assignments. - * @extends Array - */ -export interface PolicyAssignmentListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; -} - -/** - * @interface - * List of policy definitions. - * @extends Array - */ -export interface PolicyDefinitionListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; -} - -/** - * @interface - * List of policy set definitions. - * @extends Array + * List of data policy manifests. + * @extends Array */ -export interface PolicySetDefinitionListResult extends Array { +export interface DataPolicyManifestListResult extends Array { /** * The URL to use for getting the next set of results. */ @@ -440,141 +313,42 @@ export interface PolicySetDefinitionListResult extends Array + */ + getByPolicyMode(policyMode: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param policyMode The policy mode of the data policy manifest to get. + * @param callback The callback + */ + getByPolicyMode(policyMode: string, callback: msRest.ServiceCallback): void; + /** + * @param policyMode The policy mode of the data policy manifest to get. + * @param options The optional parameters + * @param callback The callback + */ + getByPolicyMode(policyMode: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getByPolicyMode(policyMode: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + policyMode, + options + }, + getByPolicyModeOperationSpec, + callback) as Promise; + } + + /** + * This operation retrieves a list of all the data policy manifests that match the optional given + * $filter. Valid values for $filter are: "$filter=namespace eq '{0}'". If $filter is not provided, + * the unfiltered list includes all data policy manifests for data resource types. If + * $filter=namespace is provided, the returned list only includes all data policy manifests that + * have a namespace matching the provided value. + * @summary Retrieves data policy manifests + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: Models.DataPolicyManifestsListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.DataPolicyManifestsListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.DataPolicyManifestsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * This operation retrieves a list of all the data policy manifests that match the optional given + * $filter. Valid values for $filter are: "$filter=namespace eq '{0}'". If $filter is not provided, + * the unfiltered list includes all data policy manifests for data resource types. If + * $filter=namespace is provided, the returned list only includes all data policy manifests that + * have a namespace matching the provided value. + * @summary Retrieves data policy manifests + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: Models.DataPolicyManifestsListNextOptionalParams): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(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 + */ + listNext(nextPageLink: string, options: Models.DataPolicyManifestsListNextOptionalParams, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: Models.DataPolicyManifestsListNextOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getByPolicyModeOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}", + urlParameters: [ + Parameters.policyMode + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DataPolicyManifest + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Authorization/dataPolicyManifests", + queryParameters: [ + Parameters.apiVersion, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DataPolicyManifestListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DataPolicyManifestListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/policy/arm-policy/src/operations/index.ts b/sdk/policy/arm-policy/src/operations/index.ts index 8fab2c121e51..c1330166d2c2 100644 --- a/sdk/policy/arm-policy/src/operations/index.ts +++ b/sdk/policy/arm-policy/src/operations/index.ts @@ -1,13 +1,10 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ -export * from "./policyAssignments"; -export * from "./policyDefinitions"; -export * from "./policySetDefinitions"; +export * from "./dataPolicyManifests"; diff --git a/sdk/policy/arm-policy/src/operations/policyAssignments.ts b/sdk/policy/arm-policy/src/operations/policyAssignments.ts deleted file mode 100644 index 5faabeda2709..000000000000 --- a/sdk/policy/arm-policy/src/operations/policyAssignments.ts +++ /dev/null @@ -1,986 +0,0 @@ -/* - * 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 * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/policyAssignmentsMappers"; -import * as Parameters from "../models/parameters"; -import { PolicyClientContext } from "../policyClientContext"; - -/** Class representing a PolicyAssignments. */ -export class PolicyAssignments { - private readonly client: PolicyClientContext; - - /** - * Create a PolicyAssignments. - * @param {PolicyClientContext} client Reference to the service client. - */ - constructor(client: PolicyClientContext) { - this.client = client; - } - - /** - * This operation deletes a policy assignment, given its name and the scope it was created in. The - * scope of a policy assignment is the part of its ID preceding - * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @summary Deletes a policy assignment. - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(scope: string, policyAssignmentName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment to delete. - * @param callback The callback - */ - deleteMethod(scope: string, policyAssignmentName: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment to delete. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(scope: string, policyAssignmentName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(scope: string, policyAssignmentName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - scope, - policyAssignmentName, - options - }, - deleteMethodOperationSpec, - callback) as Promise; - } - - /** - * This operation creates or updates a policy assignment with the given scope and name. Policy - * assignments apply to all resources contained within their scope. For example, when you assign a - * policy at resource group scope, that policy applies to all resources in the group. - * @summary Creates or updates a policy assignment. - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment. - * @param parameters Parameters for the policy assignment. - * @param [options] The optional parameters - * @returns Promise - */ - create(scope: string, policyAssignmentName: string, parameters: Models.PolicyAssignment, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment. - * @param parameters Parameters for the policy assignment. - * @param callback The callback - */ - create(scope: string, policyAssignmentName: string, parameters: Models.PolicyAssignment, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment. - * @param parameters Parameters for the policy assignment. - * @param options The optional parameters - * @param callback The callback - */ - create(scope: string, policyAssignmentName: string, parameters: Models.PolicyAssignment, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - create(scope: string, policyAssignmentName: string, parameters: Models.PolicyAssignment, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - scope, - policyAssignmentName, - parameters, - options - }, - createOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a single policy assignment, given its name and the scope it was created - * at. - * @summary Retrieves a policy assignment. - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment to get. - * @param [options] The optional parameters - * @returns Promise - */ - get(scope: string, policyAssignmentName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment to get. - * @param callback The callback - */ - get(scope: string, policyAssignmentName: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the policy assignment. Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * @param policyAssignmentName The name of the policy assignment to get. - * @param options The optional parameters - * @param callback The callback - */ - get(scope: string, policyAssignmentName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(scope: string, policyAssignmentName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - scope, - policyAssignmentName, - options - }, - getOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves the list of all policy assignments associated with the given resource - * group in the given subscription that match the optional given $filter. Valid values for $filter - * are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the - * unfiltered list includes all policy assignments associated with the resource group, including - * those that apply directly or apply from containing scopes, as well as any applied to resources - * contained within the resource group. If $filter=atScope() is provided, the returned list - * includes all policy assignments that apply to the resource group, which is everything in the - * unfiltered list except those applied to resources contained within the resource group. 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 resource group. - * @summary Retrieves all policy assignments that apply to a resource group. - * @param resourceGroupName The name of the resource group that contains policy assignments. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceGroup(resourceGroupName: string, options?: Models.PolicyAssignmentsListForResourceGroupOptionalParams): Promise; - /** - * @param resourceGroupName The name of the resource group that contains policy assignments. - * @param callback The callback - */ - listForResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains policy assignments. - * @param options The optional parameters - * @param callback The callback - */ - listForResourceGroup(resourceGroupName: string, options: Models.PolicyAssignmentsListForResourceGroupOptionalParams, callback: msRest.ServiceCallback): void; - listForResourceGroup(resourceGroupName: string, options?: Models.PolicyAssignmentsListForResourceGroupOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listForResourceGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves the list of all policy assignments associated with the specified - * resource in the given resource group and subscription that match the optional given $filter. - * Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is - * not provided, the unfiltered list includes all policy assignments associated with the resource, - * including those that apply directly or from all containing scopes, as well as any applied to - * resources contained within the resource. If $filter=atScope() is provided, the returned list - * includes all policy assignments that apply to the resource, which is everything in the - * unfiltered list except those applied to resources contained within the resource. 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 resource. Three - * parameters plus the resource name are used to identify a specific resource. If the resource is - * not part of a parent resource (the more common case), the parent resource path should not be - * provided (or provided as ''). For example a web app could be specified as - * ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == - * 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all - * parameters should be provided. For example a virtual machine DNS name could be specified as - * ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == - * 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == - * 'MyComputerName'). A convenient alternative to providing the namespace and type name separately - * is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', - * {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == - * 'MyWebApp'). - * @summary Retrieves all policy assignments that apply to a resource. - * @param resourceGroupName The name of the resource group containing the resource. - * @param resourceProviderNamespace The namespace of the resource provider. For example, the - * namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) - * @param parentResourcePath The parent resource path. Use empty string if there is none. - * @param resourceType The resource type name. For example the type name of a web app is 'sites' - * (from Microsoft.Web/sites). - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.PolicyAssignmentsListForResourceOptionalParams): Promise; - /** - * @param resourceGroupName The name of the resource group containing the resource. - * @param resourceProviderNamespace The namespace of the resource provider. For example, the - * namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) - * @param parentResourcePath The parent resource path. Use empty string if there is none. - * @param resourceType The resource type name. For example the type name of a web app is 'sites' - * (from Microsoft.Web/sites). - * @param resourceName The name of the resource. - * @param callback The callback - */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the resource. - * @param resourceProviderNamespace The namespace of the resource provider. For example, the - * namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) - * @param parentResourcePath The parent resource path. Use empty string if there is none. - * @param resourceType The resource type name. For example the type name of a web app is 'sites' - * (from Microsoft.Web/sites). - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: Models.PolicyAssignmentsListForResourceOptionalParams, callback: msRest.ServiceCallback): void; - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.PolicyAssignmentsListForResourceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - options - }, - listForResourceOperationSpec, - 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 - * 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all - * policy assignments associated with the subscription, including those that apply directly or from - * management groups that contain the given subscription, as well as any applied to objects - * contained within the subscription. If $filter=atScope() is provided, the returned list includes - * all policy assignments that apply to the subscription, which is everything in the unfiltered - * list except those applied to objects contained within the subscription. If - * $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy - * assignments of the policy definition whose id is {value}. - * @summary Retrieves all policy assignments that apply to a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: Models.PolicyAssignmentsListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: Models.PolicyAssignmentsListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.PolicyAssignmentsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; - } - - /** - * This operation deletes the policy with the given ID. Policy assignment IDs have this format: - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid - * formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' - * (management group), '/subscriptions/{subscriptionId}' (subscription), - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - * (resource). - * @summary Deletes a policy assignment. - * @param policyAssignmentId The ID of the policy assignment to delete. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param [options] The optional parameters - * @returns Promise - */ - deleteById(policyAssignmentId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyAssignmentId The ID of the policy assignment to delete. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param callback The callback - */ - deleteById(policyAssignmentId: string, callback: msRest.ServiceCallback): void; - /** - * @param policyAssignmentId The ID of the policy assignment to delete. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param options The optional parameters - * @param callback The callback - */ - deleteById(policyAssignmentId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteById(policyAssignmentId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyAssignmentId, - options - }, - deleteByIdOperationSpec, - callback) as Promise; - } - - /** - * This operation creates or updates the policy assignment with the given ID. Policy assignments - * made on a scope apply to all resources contained in that scope. For example, when you assign a - * policy to a resource group that policy applies to all resources in the group. Policy assignment - * IDs have this format: - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid - * scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - * @summary Creates or updates a policy assignment. - * @param policyAssignmentId The ID of the policy assignment to create. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param parameters Parameters for policy assignment. - * @param [options] The optional parameters - * @returns Promise - */ - createById(policyAssignmentId: string, parameters: Models.PolicyAssignment, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyAssignmentId The ID of the policy assignment to create. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param parameters Parameters for policy assignment. - * @param callback The callback - */ - createById(policyAssignmentId: string, parameters: Models.PolicyAssignment, callback: msRest.ServiceCallback): void; - /** - * @param policyAssignmentId The ID of the policy assignment to create. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param parameters Parameters for policy assignment. - * @param options The optional parameters - * @param callback The callback - */ - createById(policyAssignmentId: string, parameters: Models.PolicyAssignment, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createById(policyAssignmentId: string, parameters: Models.PolicyAssignment, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyAssignmentId, - parameters, - options - }, - createByIdOperationSpec, - callback) as Promise; - } - - /** - * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this - * format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * Valid scopes are: management group (format: - * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * '/subscriptions/{subscriptionId}'), resource group (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - * @summary Retrieves the policy assignment with the given ID. - * @param policyAssignmentId The ID of the policy assignment to get. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param [options] The optional parameters - * @returns Promise - */ - getById(policyAssignmentId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyAssignmentId The ID of the policy assignment to get. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param callback The callback - */ - getById(policyAssignmentId: string, callback: msRest.ServiceCallback): void; - /** - * @param policyAssignmentId The ID of the policy assignment to get. Use the format - * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - * @param options The optional parameters - * @param callback The callback - */ - getById(policyAssignmentId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getById(policyAssignmentId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyAssignmentId, - options - }, - getByIdOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves the list of all policy assignments associated with the given resource - * group in the given subscription that match the optional given $filter. Valid values for $filter - * are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the - * unfiltered list includes all policy assignments associated with the resource group, including - * those that apply directly or apply from containing scopes, as well as any applied to resources - * contained within the resource group. If $filter=atScope() is provided, the returned list - * includes all policy assignments that apply to the resource group, which is everything in the - * unfiltered list except those applied to resources contained within the resource group. 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 resource group. - * @summary Retrieves all policy assignments that apply to a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForResourceGroupNext(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 - */ - listForResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listForResourceGroupNextOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves the list of all policy assignments associated with the specified - * resource in the given resource group and subscription that match the optional given $filter. - * Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is - * not provided, the unfiltered list includes all policy assignments associated with the resource, - * including those that apply directly or from all containing scopes, as well as any applied to - * resources contained within the resource. If $filter=atScope() is provided, the returned list - * includes all policy assignments that apply to the resource, which is everything in the - * unfiltered list except those applied to resources contained within the resource. 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 resource. Three - * parameters plus the resource name are used to identify a specific resource. If the resource is - * not part of a parent resource (the more common case), the parent resource path should not be - * provided (or provided as ''). For example a web app could be specified as - * ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == - * 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all - * parameters should be provided. For example a virtual machine DNS name could be specified as - * ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == - * 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == - * 'MyComputerName'). A convenient alternative to providing the namespace and type name separately - * is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', - * {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == - * 'MyWebApp'). - * @summary Retrieves all policy assignments that apply to a resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForResourceNext(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 - */ - listForResourceNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listForResourceNextOperationSpec, - 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 - * 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all - * policy assignments associated with the subscription, including those that apply directly or from - * management groups that contain the given subscription, as well as any applied to objects - * contained within the subscription. If $filter=atScope() is provided, the returned list includes - * all policy assignments that apply to the subscription, which is everything in the unfiltered - * list except those applied to objects contained within the subscription. If - * $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy - * assignments of the policy definition whose id is {value}. - * @summary Retrieves all policy assignments that apply to a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(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 - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", - urlParameters: [ - Parameters.scope, - Parameters.policyAssignmentName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignment - }, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const createOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", - urlParameters: [ - Parameters.scope, - Parameters.policyAssignmentName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PolicyAssignment, - required: true - } - }, - responses: { - 201: { - bodyMapper: Mappers.PolicyAssignment - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", - urlParameters: [ - Parameters.scope, - Parameters.policyAssignmentName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignment - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listForResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.filter0, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignmentListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listForResourceOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.resourceProviderNamespace, - Parameters.parentResourcePath, - Parameters.resourceType, - Parameters.resourceName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.filter1, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignmentListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - 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", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.filter1, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignmentListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const deleteByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "{policyAssignmentId}", - urlParameters: [ - Parameters.policyAssignmentId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignment - }, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const createByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "{policyAssignmentId}", - urlParameters: [ - Parameters.policyAssignmentId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PolicyAssignment, - required: true - } - }, - responses: { - 201: { - bodyMapper: Mappers.PolicyAssignment - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{policyAssignmentId}", - urlParameters: [ - Parameters.policyAssignmentId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignment - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listForResourceGroupNextOperationSpec: 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 listForResourceNextOperationSpec: 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 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", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyAssignmentListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/sdk/policy/arm-policy/src/operations/policyDefinitions.ts b/sdk/policy/arm-policy/src/operations/policyDefinitions.ts deleted file mode 100644 index b2d5d0e40635..000000000000 --- a/sdk/policy/arm-policy/src/operations/policyDefinitions.ts +++ /dev/null @@ -1,730 +0,0 @@ -/* - * 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 * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/policyDefinitionsMappers"; -import * as Parameters from "../models/parameters"; -import { PolicyClientContext } from "../policyClientContext"; - -/** Class representing a PolicyDefinitions. */ -export class PolicyDefinitions { - private readonly client: PolicyClientContext; - - /** - * Create a PolicyDefinitions. - * @param {PolicyClientContext} client Reference to the service client. - */ - constructor(client: PolicyClientContext) { - this.client = client; - } - - /** - * This operation creates or updates a policy definition in the given subscription with the given - * name. - * @summary Creates or updates a policy definition in a subscription. - * @param policyDefinitionName The name of the policy definition to create. - * @param parameters The policy definition properties. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(policyDefinitionName: string, parameters: Models.PolicyDefinition, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the policy definition to create. - * @param parameters The policy definition properties. - * @param callback The callback - */ - createOrUpdate(policyDefinitionName: string, parameters: Models.PolicyDefinition, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the policy definition to create. - * @param parameters The policy definition properties. - * @param options The optional parameters - * @param callback The callback - */ - createOrUpdate(policyDefinitionName: string, parameters: Models.PolicyDefinition, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(policyDefinitionName: string, parameters: Models.PolicyDefinition, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - parameters, - options - }, - createOrUpdateOperationSpec, - callback) as Promise; - } - - /** - * This operation deletes the policy definition in the given subscription with the given name. - * @summary Deletes a policy definition in a subscription. - * @param policyDefinitionName The name of the policy definition to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(policyDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the policy definition to delete. - * @param callback The callback - */ - deleteMethod(policyDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the policy definition to delete. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(policyDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(policyDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - options - }, - deleteMethodOperationSpec, - callback); - } - - /** - * This operation retrieves the policy definition in the given subscription with the given name. - * @summary Retrieves a policy definition in a subscription. - * @param policyDefinitionName The name of the policy definition to get. - * @param [options] The optional parameters - * @returns Promise - */ - get(policyDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the policy definition to get. - * @param callback The callback - */ - get(policyDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the policy definition to get. - * @param options The optional parameters - * @param callback The callback - */ - get(policyDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(policyDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - options - }, - getOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves the built-in policy definition with the given name. - * @summary Retrieves a built-in policy definition. - * @param policyDefinitionName The name of the built-in policy definition to get. - * @param [options] The optional parameters - * @returns Promise - */ - getBuiltIn(policyDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the built-in policy definition to get. - * @param callback The callback - */ - getBuiltIn(policyDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the built-in policy definition to get. - * @param options The optional parameters - * @param callback The callback - */ - getBuiltIn(policyDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getBuiltIn(policyDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - options - }, - getBuiltInOperationSpec, - callback) as Promise; - } - - /** - * This operation creates or updates a policy definition in the given management group with the - * given name. - * @summary Creates or updates a policy definition in a management group. - * @param policyDefinitionName The name of the policy definition to create. - * @param parameters The policy definition properties. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: Models.PolicyDefinition, managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the policy definition to create. - * @param parameters The policy definition properties. - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: Models.PolicyDefinition, managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the policy definition to create. - * @param parameters The policy definition properties. - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: Models.PolicyDefinition, managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: Models.PolicyDefinition, managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - parameters, - managementGroupId, - options - }, - createOrUpdateAtManagementGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation deletes the policy definition in the given management group with the given name. - * @summary Deletes a policy definition in a management group. - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the policy definition to delete. - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - managementGroupId, - options - }, - deleteAtManagementGroupOperationSpec, - callback); - } - - /** - * This operation retrieves the policy definition in the given management group with the given - * name. - * @summary Retrieve a policy definition in a management group. - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param policyDefinitionName The name of the policy definition to get. - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policyDefinitionName, - managementGroupId, - options - }, - getAtManagementGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the policy definitions in a given subscription. - * @summary Retrieves policy definitions in a subscription - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the built-in policy definitions. - * @summary Retrieve built-in policy definitions - * @param [options] The optional parameters - * @returns Promise - */ - listBuiltIn(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listBuiltIn(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listBuiltIn(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBuiltIn(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listBuiltInOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the policy definitions in a given management group. - * @summary Retrieve policy definitions in a management group - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - listByManagementGroup(managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - listByManagementGroup(managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - listByManagementGroup(managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByManagementGroup(managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - managementGroupId, - options - }, - listByManagementGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the policy definitions in a given subscription. - * @summary Retrieves policy definitions in a subscription - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(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 - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the built-in policy definitions. - * @summary Retrieve built-in policy definitions - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listBuiltInNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listBuiltInNext(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 - */ - listBuiltInNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBuiltInNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listBuiltInNextOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the policy definitions in a given management group. - * @summary Retrieve policy definitions in a management group - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByManagementGroupNext(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 - */ - listByManagementGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByManagementGroupNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PolicyDefinition, - required: true - } - }, - responses: { - 201: { - bodyMapper: Mappers.PolicyDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getBuiltInOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const createOrUpdateAtManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName, - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PolicyDefinition, - required: true - } - }, - responses: { - 201: { - bodyMapper: Mappers.PolicyDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const deleteAtManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName, - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getAtManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - urlParameters: [ - Parameters.policyDefinitionName, - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listBuiltInOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Authorization/policyDefinitions", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listByManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - urlParameters: [ - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listBuiltInNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listByManagementGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicyDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/sdk/policy/arm-policy/src/operations/policySetDefinitions.ts b/sdk/policy/arm-policy/src/operations/policySetDefinitions.ts deleted file mode 100644 index 5cce445c14f0..000000000000 --- a/sdk/policy/arm-policy/src/operations/policySetDefinitions.ts +++ /dev/null @@ -1,740 +0,0 @@ -/* - * 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 * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/policySetDefinitionsMappers"; -import * as Parameters from "../models/parameters"; -import { PolicyClientContext } from "../policyClientContext"; - -/** Class representing a PolicySetDefinitions. */ -export class PolicySetDefinitions { - private readonly client: PolicyClientContext; - - /** - * Create a PolicySetDefinitions. - * @param {PolicyClientContext} client Reference to the service client. - */ - constructor(client: PolicyClientContext) { - this.client = client; - } - - /** - * This operation creates or updates a policy set definition in the given subscription with the - * given name. - * @summary Creates or updates a policy set definition. - * @param policySetDefinitionName The name of the policy set definition to create. - * @param parameters The policy set definition properties. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to create. - * @param parameters The policy set definition properties. - * @param callback The callback - */ - createOrUpdate(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to create. - * @param parameters The policy set definition properties. - * @param options The optional parameters - * @param callback The callback - */ - createOrUpdate(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - parameters, - options - }, - createOrUpdateOperationSpec, - callback) as Promise; - } - - /** - * This operation deletes the policy set definition in the given subscription with the given name. - * @summary Deletes a policy set definition. - * @param policySetDefinitionName The name of the policy set definition to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(policySetDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to delete. - * @param callback The callback - */ - deleteMethod(policySetDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to delete. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(policySetDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(policySetDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - options - }, - deleteMethodOperationSpec, - callback); - } - - /** - * This operation retrieves the policy set definition in the given subscription with the given - * name. - * @summary Retrieves a policy set definition. - * @param policySetDefinitionName The name of the policy set definition to get. - * @param [options] The optional parameters - * @returns Promise - */ - get(policySetDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to get. - * @param callback The callback - */ - get(policySetDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to get. - * @param options The optional parameters - * @param callback The callback - */ - get(policySetDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(policySetDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - options - }, - getOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves the built-in policy set definition with the given name. - * @summary Retrieves a built in policy set definition. - * @param policySetDefinitionName The name of the policy set definition to get. - * @param [options] The optional parameters - * @returns Promise - */ - getBuiltIn(policySetDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to get. - * @param callback The callback - */ - getBuiltIn(policySetDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to get. - * @param options The optional parameters - * @param callback The callback - */ - getBuiltIn(policySetDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getBuiltIn(policySetDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - options - }, - getBuiltInOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the policy set definitions in the given subscription. - * @summary Retrieves the policy set definitions for a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the built-in policy set definitions. - * @summary Retrieves built-in policy set definitions. - * @param [options] The optional parameters - * @returns Promise - */ - listBuiltIn(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listBuiltIn(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listBuiltIn(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBuiltIn(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listBuiltInOperationSpec, - callback) as Promise; - } - - /** - * This operation creates or updates a policy set definition in the given management group with the - * given name. - * @summary Creates or updates a policy set definition. - * @param policySetDefinitionName The name of the policy set definition to create. - * @param parameters The policy set definition properties. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to create. - * @param parameters The policy set definition properties. - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to create. - * @param parameters The policy set definition properties. - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: Models.PolicySetDefinition, managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - parameters, - managementGroupId, - options - }, - createOrUpdateAtManagementGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation deletes the policy set definition in the given management group with the given - * name. - * @summary Deletes a policy set definition. - * @param policySetDefinitionName The name of the policy set definition to delete. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to delete. - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to delete. - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - managementGroupId, - options - }, - deleteAtManagementGroupOperationSpec, - callback); - } - - /** - * This operation retrieves the policy set definition in the given management group with the given - * name. - * @summary Retrieves a policy set definition. - * @param policySetDefinitionName The name of the policy set definition to get. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param policySetDefinitionName The name of the policy set definition to get. - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param policySetDefinitionName The name of the policy set definition to get. - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - policySetDefinitionName, - managementGroupId, - options - }, - getAtManagementGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the a policy set definition in the given management - * group. - * @summary Retrieves all policy set definitions in management group. - * @param managementGroupId The ID of the management group. - * @param [options] The optional parameters - * @returns Promise - */ - listByManagementGroup(managementGroupId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param managementGroupId The ID of the management group. - * @param callback The callback - */ - listByManagementGroup(managementGroupId: string, callback: msRest.ServiceCallback): void; - /** - * @param managementGroupId The ID of the management group. - * @param options The optional parameters - * @param callback The callback - */ - listByManagementGroup(managementGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByManagementGroup(managementGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - managementGroupId, - options - }, - listByManagementGroupOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the policy set definitions in the given subscription. - * @summary Retrieves the policy set definitions for a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(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 - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the built-in policy set definitions. - * @summary Retrieves built-in policy set definitions. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listBuiltInNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listBuiltInNext(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 - */ - listBuiltInNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBuiltInNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listBuiltInNextOperationSpec, - callback) as Promise; - } - - /** - * This operation retrieves a list of all the a policy set definition in the given management - * group. - * @summary Retrieves all policy set definitions in management group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByManagementGroupNext(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 - */ - listByManagementGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByManagementGroupNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PolicySetDefinition, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinition - }, - 201: { - bodyMapper: Mappers.PolicySetDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getBuiltInOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listBuiltInOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Authorization/policySetDefinitions", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const createOrUpdateAtManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName, - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PolicySetDefinition, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinition - }, - 201: { - bodyMapper: Mappers.PolicySetDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const deleteAtManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName, - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getAtManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - urlParameters: [ - Parameters.policySetDefinitionName, - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinition - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listByManagementGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - urlParameters: [ - Parameters.managementGroupId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listBuiltInNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listByManagementGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PolicySetDefinitionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/sdk/policy/arm-policy/src/policyClient.ts b/sdk/policy/arm-policy/src/policyClient.ts index dc8f8dbde966..9a0b35a66f0b 100644 --- a/sdk/policy/arm-policy/src/policyClient.ts +++ b/sdk/policy/arm-policy/src/policyClient.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is @@ -17,21 +16,16 @@ import { PolicyClientContext } from "./policyClientContext"; class PolicyClient extends PolicyClientContext { // Operation groups - policyAssignments: operations.PolicyAssignments; - policyDefinitions: operations.PolicyDefinitions; - policySetDefinitions: operations.PolicySetDefinitions; + dataPolicyManifests: operations.DataPolicyManifests; /** * Initializes a new instance of the PolicyClient class. * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.PolicyClientOptions) { - super(credentials, subscriptionId, options); - this.policyAssignments = new operations.PolicyAssignments(this); - this.policyDefinitions = new operations.PolicyDefinitions(this); - this.policySetDefinitions = new operations.PolicySetDefinitions(this); + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.PolicyClientOptions) { + super(credentials, options); + this.dataPolicyManifests = new operations.DataPolicyManifests(this); } } diff --git a/sdk/policy/arm-policy/src/policyClientContext.ts b/sdk/policy/arm-policy/src/policyClientContext.ts index 60c107079f2e..da05318c48ff 100644 --- a/sdk/policy/arm-policy/src/policyClientContext.ts +++ b/sdk/policy/arm-policy/src/policyClientContext.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is @@ -17,22 +16,17 @@ const packageVersion = "3.1.0"; export class PolicyClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; - subscriptionId: string; apiVersion?: string; /** * Initializes a new instance of the PolicyClient class. * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.PolicyClientOptions) { + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.PolicyClientOptions) { if (credentials == undefined) { throw new Error('\'credentials\' cannot be null.'); } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } if (!options) { options = {}; @@ -44,13 +38,12 @@ export class PolicyClientContext extends msRestAzure.AzureServiceClient { super(credentials, options); - this.apiVersion = '2019-09-01'; + this.apiVersion = '2020-09-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; this.requestContentType = "application/json; charset=utf-8"; this.credentials = credentials; - this.subscriptionId = subscriptionId; if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage;