diff --git a/sdk/authorization/arm-authorization/LICENSE.txt b/sdk/authorization/arm-authorization/LICENSE.txt new file mode 100644 index 000000000000..8f3d856145c5 --- /dev/null +++ b/sdk/authorization/arm-authorization/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/authorization/arm-authorization/README.md b/sdk/authorization/arm-authorization/README.md new file mode 100644 index 000000000000..2afcdf32e3ab --- /dev/null +++ b/sdk/authorization/arm-authorization/README.md @@ -0,0 +1,96 @@ +## Azure AuthorizationManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for AuthorizationManagementClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-authorization +``` + +### How to use + +#### nodejs - Authentication, client creation and list classicAdministrators as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```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 { AuthorizationManagementClient, AuthorizationManagementModels, AuthorizationManagementMappers } from "@azure/arm-authorization"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new AuthorizationManagementClient(creds, subscriptionId); + client.classicAdministrators.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list classicAdministrators as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-authorization sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/sdk/authorization/arm-authorization/lib/authorizationManagementClient.ts b/sdk/authorization/arm-authorization/lib/authorizationManagementClient.ts new file mode 100644 index 000000000000..bfa0a6ebcadf --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/authorizationManagementClient.ts @@ -0,0 +1,52 @@ +/* + * 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/mappers"; +import * as operations from "./operations"; +import { AuthorizationManagementClientContext } from "./authorizationManagementClientContext"; + + +class AuthorizationManagementClient extends AuthorizationManagementClientContext { + // Operation groups + classicAdministrators: operations.ClassicAdministrators; + providerOperationsMetadata: operations.ProviderOperationsMetadataOperations; + roleAssignments: operations.RoleAssignments; + permissions: operations.Permissions; + roleDefinitions: operations.RoleDefinitions; + denyAssignments: operations.DenyAssignments; + + /** + * Initializes a new instance of the AuthorizationManagementClient 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.AuthorizationManagementClientOptions) { + super(credentials, subscriptionId, options); + this.classicAdministrators = new operations.ClassicAdministrators(this); + this.providerOperationsMetadata = new operations.ProviderOperationsMetadataOperations(this); + this.roleAssignments = new operations.RoleAssignments(this); + this.permissions = new operations.Permissions(this); + this.roleDefinitions = new operations.RoleDefinitions(this); + this.denyAssignments = new operations.DenyAssignments(this); + } +} + +// Operation Specifications + +export { + AuthorizationManagementClient, + AuthorizationManagementClientContext, + Models as AuthorizationManagementModels, + Mappers as AuthorizationManagementMappers +}; +export * from "./operations"; diff --git a/sdk/authorization/arm-authorization/lib/authorizationManagementClientContext.ts b/sdk/authorization/arm-authorization/lib/authorizationManagementClientContext.ts new file mode 100644 index 000000000000..363f0fe6bd84 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/authorizationManagementClientContext.ts @@ -0,0 +1,60 @@ +/* + * 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 Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; + +const packageName = "@azure/arm-authorization"; +const packageVersion = "8.3.1"; + +export class AuthorizationManagementClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + subscriptionId: string; + + /** + * Initializes a new instance of the AuthorizationManagementClient 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.AuthorizationManagementClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + 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; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/authorization/arm-authorization/lib/models/classicAdministratorsMappers.ts b/sdk/authorization/arm-authorization/lib/models/classicAdministratorsMappers.ts new file mode 100644 index 000000000000..067623eb438c --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/classicAdministratorsMappers.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ + +export { + ClassicAdministratorListResult, + ClassicAdministrator, + CloudError +} from "../models/mappers"; + diff --git a/sdk/authorization/arm-authorization/lib/models/denyAssignmentsMappers.ts b/sdk/authorization/arm-authorization/lib/models/denyAssignmentsMappers.ts new file mode 100644 index 000000000000..cdabfc4bf0c8 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/denyAssignmentsMappers.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { + DenyAssignmentListResult, + DenyAssignment, + DenyAssignmentPermission, + Principal, + CloudError +} from "../models/mappers"; + diff --git a/sdk/authorization/arm-authorization/lib/models/index.ts b/sdk/authorization/arm-authorization/lib/models/index.ts new file mode 100644 index 000000000000..bec3b883f90a --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/index.ts @@ -0,0 +1,1541 @@ +/* + * 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 { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + + +/** + * @interface + * An interface representing ClassicAdministrator. + * Classic Administrators + * + */ +export interface ClassicAdministrator { + /** + * @member {string} [id] The ID of the administrator. + */ + id?: string; + /** + * @member {string} [name] The name of the administrator. + */ + name?: string; + /** + * @member {string} [type] The type of the administrator. + */ + type?: string; + /** + * @member {string} [emailAddress] The email address of the administrator. + */ + emailAddress?: string; + /** + * @member {string} [role] The role of the administrator. + */ + role?: string; +} + +/** + * @interface + * An interface representing ProviderOperation. + * Operation + * + */ +export interface ProviderOperation { + /** + * @member {string} [name] The operation name. + */ + name?: string; + /** + * @member {string} [displayName] The operation display name. + */ + displayName?: string; + /** + * @member {string} [description] The operation description. + */ + description?: string; + /** + * @member {string} [origin] The operation origin. + */ + origin?: string; + /** + * @member {any} [properties] The operation properties. + */ + properties?: any; + /** + * @member {boolean} [isDataAction] The dataAction flag to specify the + * operation type. + */ + isDataAction?: boolean; +} + +/** + * @interface + * An interface representing ResourceType. + * Resource Type + * + */ +export interface ResourceType { + /** + * @member {string} [name] The resource type name. + */ + name?: string; + /** + * @member {string} [displayName] The resource type display name. + */ + displayName?: string; + /** + * @member {ProviderOperation[]} [operations] The resource type operations. + */ + operations?: ProviderOperation[]; +} + +/** + * @interface + * An interface representing ProviderOperationsMetadata. + * Provider Operations metadata + * + */ +export interface ProviderOperationsMetadata { + /** + * @member {string} [id] The provider id. + */ + id?: string; + /** + * @member {string} [name] The provider name. + */ + name?: string; + /** + * @member {string} [type] The provider type. + */ + type?: string; + /** + * @member {string} [displayName] The provider display name. + */ + displayName?: string; + /** + * @member {ResourceType[]} [resourceTypes] The provider resource types + */ + resourceTypes?: ResourceType[]; + /** + * @member {ProviderOperation[]} [operations] The provider operations. + */ + operations?: ProviderOperation[]; +} + +/** + * @interface + * An interface representing RoleAssignmentFilter. + * Role Assignments filter + * + */ +export interface RoleAssignmentFilter { + /** + * @member {string} [principalId] Returns role assignment of the specific + * principal. + */ + principalId?: string; + /** + * @member {boolean} [canDelegate] The Delegation flag for the role + * assignment + */ + canDelegate?: boolean; +} + +/** + * @interface + * An interface representing RoleAssignment. + * Role Assignments + * + */ +export interface RoleAssignment { + /** + * @member {string} [id] The role assignment ID. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] The role assignment name. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [type] The role assignment type. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {string} [scope] The role assignment scope. + */ + scope?: string; + /** + * @member {string} [roleDefinitionId] The role definition ID. + */ + roleDefinitionId?: string; + /** + * @member {string} [principalId] The principal ID. + */ + principalId?: string; + /** + * @member {PrincipalType} [principalType] The principal type of the assigned + * principal ID. Possible values include: 'User', 'Group', + * 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', + * 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + */ + principalType?: PrincipalType; + /** + * @member {boolean} [canDelegate] The Delegation flag for the role + * assignment + */ + canDelegate?: boolean; +} + +/** + * @interface + * An interface representing RoleAssignmentCreateParameters. + * Role assignment create parameters. + * + */ +export interface RoleAssignmentCreateParameters { + /** + * @member {string} roleDefinitionId The role definition ID used in the role + * assignment. + */ + roleDefinitionId: string; + /** + * @member {string} principalId The principal ID assigned to the role. This + * maps to the ID inside the Active Directory. It can point to a user, + * service principal, or security group. + */ + principalId: string; + /** + * @member {PrincipalType} [principalType] The principal type of the assigned + * principal ID. Possible values include: 'User', 'Group', + * 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', + * 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + */ + principalType?: PrincipalType; + /** + * @member {boolean} [canDelegate] The delegation flag used for creating a + * role assignment + */ + canDelegate?: boolean; +} + +/** + * @interface + * An interface representing RoleDefinitionFilter. + * Role Definitions filter + * + */ +export interface RoleDefinitionFilter { + /** + * @member {string} [roleName] Returns role definition with the specific + * name. + */ + roleName?: string; + /** + * @member {string} [type] Returns role definition with the specific type. + */ + type?: string; +} + +/** + * @interface + * An interface representing Permission. + * Role definition permissions. + * + */ +export interface Permission { + /** + * @member {string[]} [actions] Allowed actions. + */ + actions?: string[]; + /** + * @member {string[]} [notActions] Denied actions. + */ + notActions?: string[]; + /** + * @member {string[]} [dataActions] Allowed Data actions. + */ + dataActions?: string[]; + /** + * @member {string[]} [notDataActions] Denied Data actions. + */ + notDataActions?: string[]; +} + +/** + * @interface + * An interface representing RoleDefinition. + * Role definition. + * + */ +export interface RoleDefinition { + /** + * @member {string} [id] The role definition ID. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] The role definition name. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [type] The role definition type. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {string} [roleName] The role name. + */ + roleName?: string; + /** + * @member {string} [description] The role definition description. + */ + description?: string; + /** + * @member {string} [roleType] The role type. + */ + roleType?: string; + /** + * @member {Permission[]} [permissions] Role definition permissions. + */ + permissions?: Permission[]; + /** + * @member {string[]} [assignableScopes] Role definition assignable scopes. + */ + assignableScopes?: string[]; +} + +/** + * @interface + * An interface representing DenyAssignmentFilter. + * Deny Assignments filter + * + */ +export interface DenyAssignmentFilter { + /** + * @member {string} [denyAssignmentName] Return deny assignment with + * specified name. + */ + denyAssignmentName?: string; + /** + * @member {string} [principalId] Return all deny assignments where the + * specified principal is listed in the principals list of deny assignments. + */ + principalId?: string; + /** + * @member {string} [gdprExportPrincipalId] Return all deny assignments where + * the specified principal is listed either in the principals list or exclude + * principals list of deny assignments. + */ + gdprExportPrincipalId?: string; +} + +/** + * @interface + * An interface representing DenyAssignmentPermission. + * Deny assignment permissions. + * + */ +export interface DenyAssignmentPermission { + /** + * @member {string[]} [actions] Actions to which the deny assignment does not + * grant access. + */ + actions?: string[]; + /** + * @member {string[]} [notActions] Actions to exclude from that the deny + * assignment does not grant access. + */ + notActions?: string[]; + /** + * @member {string[]} [dataActions] Data actions to which the deny assignment + * does not grant access. + */ + dataActions?: string[]; + /** + * @member {string[]} [notDataActions] Data actions to exclude from that the + * deny assignment does not grant access. + */ + notDataActions?: string[]; +} + +/** + * @interface + * An interface representing Principal. + * Deny assignment principal. + * + */ +export interface Principal { + /** + * @member {string} [id] Object ID of the Azure AD principal (user, group, or + * service principal) to which the deny assignment applies. An empty guid + * '00000000-0000-0000-0000-000000000000' as principal id and principal type + * as 'Everyone' represents all users, groups and service principals. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [type] Type of object represented by principal id (user, + * group, or service principal). An empty guid + * '00000000-0000-0000-0000-000000000000' as principal id and principal type + * as 'Everyone' represents all users, groups and service principals. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; +} + +/** + * @interface + * An interface representing DenyAssignment. + * Deny Assignment + * + */ +export interface DenyAssignment { + /** + * @member {string} [id] The deny assignment ID. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] The deny assignment name. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [type] The deny assignment type. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {string} [denyAssignmentName] The display name of the deny + * assignment. + */ + denyAssignmentName?: string; + /** + * @member {string} [description] The description of the deny assignment. + */ + description?: string; + /** + * @member {DenyAssignmentPermission[]} [permissions] An array of permissions + * that are denied by the deny assignment. + */ + permissions?: DenyAssignmentPermission[]; + /** + * @member {string} [scope] The deny assignment scope. + */ + scope?: string; + /** + * @member {boolean} [doNotApplyToChildScopes] Determines if the deny + * assignment applies to child scopes. Default value is false. + */ + doNotApplyToChildScopes?: boolean; + /** + * @member {Principal[]} [principals] Array of principals to which the deny + * assignment applies. + */ + principals?: Principal[]; + /** + * @member {Principal[]} [excludePrincipals] Array of principals to which the + * deny assignment does not apply. + */ + excludePrincipals?: Principal[]; + /** + * @member {boolean} [isSystemProtected] Specifies whether this deny + * assignment was created by Azure and cannot be edited or deleted. + */ + isSystemProtected?: boolean; +} + +/** + * @interface + * An interface representing ProviderOperationsMetadataGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface ProviderOperationsMetadataGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [expand] Specifies whether to expand the values. Default + * value: 'resourceTypes' . + */ + expand?: string; +} + +/** + * @interface + * An interface representing ProviderOperationsMetadataListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface ProviderOperationsMetadataListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [expand] Specifies whether to expand the values. Default + * value: 'resourceTypes' . + */ + expand?: string; +} + +/** + * @interface + * An interface representing RoleAssignmentsListForResourceOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface RoleAssignmentsListForResourceOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all role assignments at or above the scope. + * Use $filter=principalId eq {id} to return all role assignments at, above + * or below the scope for the specified principal. + */ + filter?: string; +} + +/** + * @interface + * An interface representing RoleAssignmentsListForResourceGroupOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface RoleAssignmentsListForResourceGroupOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all role assignments at or above the scope. + * Use $filter=principalId eq {id} to return all role assignments at, above + * or below the scope for the specified principal. + */ + filter?: string; +} + +/** + * @interface + * An interface representing RoleAssignmentsListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface RoleAssignmentsListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all role assignments at or above the scope. + * Use $filter=principalId eq {id} to return all role assignments at, above + * or below the scope for the specified principal. + */ + filter?: string; +} + +/** + * @interface + * An interface representing RoleAssignmentsListForScopeOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface RoleAssignmentsListForScopeOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all role assignments at or above the scope. + * Use $filter=principalId eq {id} to return all role assignments at, above + * or below the scope for the specified principal. + */ + filter?: string; +} + +/** + * @interface + * An interface representing RoleDefinitionsListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface RoleDefinitionsListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * atScopeAndBelow filter to search below the given scope as well. + */ + filter?: string; +} + +/** + * @interface + * An interface representing DenyAssignmentsListForResourceOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface DenyAssignmentsListForResourceOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all deny assignments at or above the scope. + * Use $filter=denyAssignmentName eq '{name}' to search deny assignments by + * name at specified scope. Use $filter=principalId eq '{id}' to return all + * deny assignments at, above and below the scope for the specified + * principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny + * assignments at, above and below the scope for the specified principal. + * This filter is different from the principalId filter as it returns not + * only those deny assignments that contain the specified principal is the + * Principals list but also those deny assignments that contain the specified + * principal is the ExcludePrincipals list. Additionally, when + * gdprExportPrincipalId filter is used, only the deny assignment name and + * description properties are returned. + */ + filter?: string; +} + +/** + * @interface + * An interface representing DenyAssignmentsListForResourceGroupOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface DenyAssignmentsListForResourceGroupOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all deny assignments at or above the scope. + * Use $filter=denyAssignmentName eq '{name}' to search deny assignments by + * name at specified scope. Use $filter=principalId eq '{id}' to return all + * deny assignments at, above and below the scope for the specified + * principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny + * assignments at, above and below the scope for the specified principal. + * This filter is different from the principalId filter as it returns not + * only those deny assignments that contain the specified principal is the + * Principals list but also those deny assignments that contain the specified + * principal is the ExcludePrincipals list. Additionally, when + * gdprExportPrincipalId filter is used, only the deny assignment name and + * description properties are returned. + */ + filter?: string; +} + +/** + * @interface + * An interface representing DenyAssignmentsListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface DenyAssignmentsListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all deny assignments at or above the scope. + * Use $filter=denyAssignmentName eq '{name}' to search deny assignments by + * name at specified scope. Use $filter=principalId eq '{id}' to return all + * deny assignments at, above and below the scope for the specified + * principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny + * assignments at, above and below the scope for the specified principal. + * This filter is different from the principalId filter as it returns not + * only those deny assignments that contain the specified principal is the + * Principals list but also those deny assignments that contain the specified + * principal is the ExcludePrincipals list. Additionally, when + * gdprExportPrincipalId filter is used, only the deny assignment name and + * description properties are returned. + */ + filter?: string; +} + +/** + * @interface + * An interface representing DenyAssignmentsListForScopeOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface DenyAssignmentsListForScopeOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] The filter to apply on the operation. Use + * $filter=atScope() to return all deny assignments at or above the scope. + * Use $filter=denyAssignmentName eq '{name}' to search deny assignments by + * name at specified scope. Use $filter=principalId eq '{id}' to return all + * deny assignments at, above and below the scope for the specified + * principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny + * assignments at, above and below the scope for the specified principal. + * This filter is different from the principalId filter as it returns not + * only those deny assignments that contain the specified principal is the + * Principals list but also those deny assignments that contain the specified + * principal is the ExcludePrincipals list. Additionally, when + * gdprExportPrincipalId filter is used, only the deny assignment name and + * description properties are returned. + */ + filter?: string; +} + +/** + * @interface + * An interface representing AuthorizationManagementClientOptions. + * @extends AzureServiceClientOptions + */ +export interface AuthorizationManagementClientOptions extends AzureServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + + +/** + * @interface + * An interface representing the ClassicAdministratorListResult. + * ClassicAdministrator list result information. + * + * @extends Array + */ +export interface ClassicAdministratorListResult extends Array { + /** + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the ProviderOperationsMetadataListResult. + * Provider operations metadata list + * + * @extends Array + */ +export interface ProviderOperationsMetadataListResult extends Array { + /** + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the RoleAssignmentListResult. + * Role assignment list operation result. + * + * @extends Array + */ +export interface RoleAssignmentListResult extends Array { + /** + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the PermissionGetResult. + * Permissions information. + * + * @extends Array + */ +export interface PermissionGetResult extends Array { + /** + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the RoleDefinitionListResult. + * Role definition list operation result. + * + * @extends Array + */ +export interface RoleDefinitionListResult extends Array { + /** + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the DenyAssignmentListResult. + * Deny assignment list operation result. + * + * @extends Array + */ +export interface DenyAssignmentListResult extends Array { + /** + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + nextLink?: string; +} + +/** + * Defines values for PrincipalType. + * Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', + * 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', + * 'Everyone' + * @readonly + * @enum {string} + */ +export type PrincipalType = 'User' | 'Group' | 'ServicePrincipal' | 'Unknown' | 'DirectoryRoleTemplate' | 'ForeignGroup' | 'Application' | 'MSI' | 'DirectoryObjectOrGroup' | 'Everyone'; + +/** + * Contains response data for the list operation. + */ +export type ClassicAdministratorsListResponse = ClassicAdministratorListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ClassicAdministratorListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ClassicAdministratorsListNextResponse = ClassicAdministratorListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ClassicAdministratorListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ProviderOperationsMetadataGetResponse = ProviderOperationsMetadata & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderOperationsMetadata; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ProviderOperationsMetadataListResponse = ProviderOperationsMetadataListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderOperationsMetadataListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ProviderOperationsMetadataListNextResponse = ProviderOperationsMetadataListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderOperationsMetadataListResult; + }; +}; + +/** + * Contains response data for the listForResource operation. + */ +export type RoleAssignmentsListForResourceResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceGroup operation. + */ +export type RoleAssignmentsListForResourceGroupResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the deleteMethod operation. + */ +export type RoleAssignmentsDeleteMethodResponse = RoleAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignment; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type RoleAssignmentsCreateResponse = RoleAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignment; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type RoleAssignmentsGetResponse = RoleAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignment; + }; +}; + +/** + * Contains response data for the deleteById operation. + */ +export type RoleAssignmentsDeleteByIdResponse = RoleAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignment; + }; +}; + +/** + * Contains response data for the createById operation. + */ +export type RoleAssignmentsCreateByIdResponse = RoleAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignment; + }; +}; + +/** + * Contains response data for the getById operation. + */ +export type RoleAssignmentsGetByIdResponse = RoleAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignment; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type RoleAssignmentsListResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForScope operation. + */ +export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceNext operation. + */ +export type RoleAssignmentsListForResourceNextResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceGroupNext operation. + */ +export type RoleAssignmentsListForResourceGroupNextResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type RoleAssignmentsListNextResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForScopeNext operation. + */ +export type RoleAssignmentsListForScopeNextResponse = RoleAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceGroup operation. + */ +export type PermissionsListForResourceGroupResponse = PermissionGetResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PermissionGetResult; + }; +}; + +/** + * Contains response data for the listForResource operation. + */ +export type PermissionsListForResourceResponse = PermissionGetResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PermissionGetResult; + }; +}; + +/** + * Contains response data for the listForResourceGroupNext operation. + */ +export type PermissionsListForResourceGroupNextResponse = PermissionGetResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PermissionGetResult; + }; +}; + +/** + * Contains response data for the listForResourceNext operation. + */ +export type PermissionsListForResourceNextResponse = PermissionGetResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PermissionGetResult; + }; +}; + +/** + * Contains response data for the deleteMethod operation. + */ +export type RoleDefinitionsDeleteMethodResponse = RoleDefinition & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleDefinition; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type RoleDefinitionsGetResponse = RoleDefinition & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleDefinition; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type RoleDefinitionsCreateOrUpdateResponse = RoleDefinition & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleDefinition; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type RoleDefinitionsListResponse = RoleDefinitionListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleDefinitionListResult; + }; +}; + +/** + * Contains response data for the getById operation. + */ +export type RoleDefinitionsGetByIdResponse = RoleDefinition & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleDefinition; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type RoleDefinitionsListNextResponse = RoleDefinitionListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RoleDefinitionListResult; + }; +}; + +/** + * Contains response data for the listForResource operation. + */ +export type DenyAssignmentsListForResourceResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceGroup operation. + */ +export type DenyAssignmentsListForResourceGroupResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type DenyAssignmentsListResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type DenyAssignmentsGetResponse = DenyAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignment; + }; +}; + +/** + * Contains response data for the getById operation. + */ +export type DenyAssignmentsGetByIdResponse = DenyAssignment & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignment; + }; +}; + +/** + * Contains response data for the listForScope operation. + */ +export type DenyAssignmentsListForScopeResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceNext operation. + */ +export type DenyAssignmentsListForResourceNextResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForResourceGroupNext operation. + */ +export type DenyAssignmentsListForResourceGroupNextResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type DenyAssignmentsListNextResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; + +/** + * Contains response data for the listForScopeNext operation. + */ +export type DenyAssignmentsListForScopeNextResponse = DenyAssignmentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DenyAssignmentListResult; + }; +}; diff --git a/sdk/authorization/arm-authorization/lib/models/mappers.ts b/sdk/authorization/arm-authorization/lib/models/mappers.ts new file mode 100644 index 000000000000..0c981efe515c --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/mappers.ts @@ -0,0 +1,831 @@ +/* + * 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const ClassicAdministrator: msRest.CompositeMapper = { + serializedName: "ClassicAdministrator", + type: { + name: "Composite", + className: "ClassicAdministrator", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + emailAddress: { + serializedName: "properties.emailAddress", + type: { + name: "String" + } + }, + role: { + serializedName: "properties.role", + type: { + name: "String" + } + } + } + } +}; + +export const ProviderOperation: msRest.CompositeMapper = { + serializedName: "ProviderOperation", + type: { + name: "Composite", + className: "ProviderOperation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ResourceType: msRest.CompositeMapper = { + serializedName: "ResourceType", + type: { + name: "Composite", + className: "ResourceType", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + operations: { + serializedName: "operations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderOperation" + } + } + } + } + } + } +}; + +export const ProviderOperationsMetadata: msRest.CompositeMapper = { + serializedName: "ProviderOperationsMetadata", + type: { + name: "Composite", + className: "ProviderOperationsMetadata", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceType" + } + } + } + }, + operations: { + serializedName: "operations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderOperation" + } + } + } + } + } + } +}; + +export const RoleAssignmentFilter: msRest.CompositeMapper = { + serializedName: "RoleAssignmentFilter", + type: { + name: "Composite", + className: "RoleAssignmentFilter", + modelProperties: { + principalId: { + serializedName: "principalId", + type: { + name: "String" + } + }, + canDelegate: { + serializedName: "canDelegate", + type: { + name: "Boolean" + } + } + } + } +}; + +export const RoleAssignment: msRest.CompositeMapper = { + serializedName: "RoleAssignment", + type: { + name: "Composite", + className: "RoleAssignment", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + scope: { + serializedName: "properties.scope", + type: { + name: "String" + } + }, + roleDefinitionId: { + serializedName: "properties.roleDefinitionId", + type: { + name: "String" + } + }, + principalId: { + serializedName: "properties.principalId", + type: { + name: "String" + } + }, + principalType: { + serializedName: "properties.principalType", + type: { + name: "String" + } + }, + canDelegate: { + serializedName: "properties.canDelegate", + type: { + name: "Boolean" + } + } + } + } +}; + +export const RoleAssignmentCreateParameters: msRest.CompositeMapper = { + serializedName: "RoleAssignmentCreateParameters", + type: { + name: "Composite", + className: "RoleAssignmentCreateParameters", + modelProperties: { + roleDefinitionId: { + required: true, + serializedName: "properties.roleDefinitionId", + type: { + name: "String" + } + }, + principalId: { + required: true, + serializedName: "properties.principalId", + type: { + name: "String" + } + }, + principalType: { + serializedName: "properties.principalType", + type: { + name: "String" + } + }, + canDelegate: { + serializedName: "properties.canDelegate", + type: { + name: "Boolean" + } + } + } + } +}; + +export const RoleDefinitionFilter: msRest.CompositeMapper = { + serializedName: "RoleDefinitionFilter", + type: { + name: "Composite", + className: "RoleDefinitionFilter", + modelProperties: { + roleName: { + serializedName: "roleName", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const Permission: msRest.CompositeMapper = { + serializedName: "Permission", + type: { + name: "Composite", + className: "Permission", + modelProperties: { + actions: { + serializedName: "actions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + notActions: { + serializedName: "notActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + dataActions: { + serializedName: "dataActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + notDataActions: { + serializedName: "notDataActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const RoleDefinition: msRest.CompositeMapper = { + serializedName: "RoleDefinition", + type: { + name: "Composite", + className: "RoleDefinition", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + roleName: { + serializedName: "properties.roleName", + type: { + name: "String" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + roleType: { + serializedName: "properties.type", + type: { + name: "String" + } + }, + permissions: { + serializedName: "properties.permissions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Permission" + } + } + } + }, + assignableScopes: { + serializedName: "properties.assignableScopes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const DenyAssignmentFilter: msRest.CompositeMapper = { + serializedName: "DenyAssignmentFilter", + type: { + name: "Composite", + className: "DenyAssignmentFilter", + modelProperties: { + denyAssignmentName: { + serializedName: "denyAssignmentName", + type: { + name: "String" + } + }, + principalId: { + serializedName: "principalId", + type: { + name: "String" + } + }, + gdprExportPrincipalId: { + serializedName: "gdprExportPrincipalId", + type: { + name: "String" + } + } + } + } +}; + +export const DenyAssignmentPermission: msRest.CompositeMapper = { + serializedName: "DenyAssignmentPermission", + type: { + name: "Composite", + className: "DenyAssignmentPermission", + modelProperties: { + actions: { + serializedName: "actions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + notActions: { + serializedName: "notActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + dataActions: { + serializedName: "dataActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + notDataActions: { + serializedName: "notDataActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const Principal: msRest.CompositeMapper = { + serializedName: "Principal", + type: { + name: "Composite", + className: "Principal", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const DenyAssignment: msRest.CompositeMapper = { + serializedName: "DenyAssignment", + type: { + name: "Composite", + className: "DenyAssignment", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + denyAssignmentName: { + serializedName: "properties.denyAssignmentName", + type: { + name: "String" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + permissions: { + serializedName: "properties.permissions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DenyAssignmentPermission" + } + } + } + }, + scope: { + serializedName: "properties.scope", + type: { + name: "String" + } + }, + doNotApplyToChildScopes: { + serializedName: "properties.doNotApplyToChildScopes", + type: { + name: "Boolean" + } + }, + principals: { + serializedName: "properties.principals", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Principal" + } + } + } + }, + excludePrincipals: { + serializedName: "properties.excludePrincipals", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Principal" + } + } + } + }, + isSystemProtected: { + serializedName: "properties.isSystemProtected", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ClassicAdministratorListResult: msRest.CompositeMapper = { + serializedName: "ClassicAdministratorListResult", + type: { + name: "Composite", + className: "ClassicAdministratorListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClassicAdministrator" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ProviderOperationsMetadataListResult: msRest.CompositeMapper = { + serializedName: "ProviderOperationsMetadataListResult", + type: { + name: "Composite", + className: "ProviderOperationsMetadataListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderOperationsMetadata" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const RoleAssignmentListResult: msRest.CompositeMapper = { + serializedName: "RoleAssignmentListResult", + type: { + name: "Composite", + className: "RoleAssignmentListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RoleAssignment" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const PermissionGetResult: msRest.CompositeMapper = { + serializedName: "PermissionGetResult", + type: { + name: "Composite", + className: "PermissionGetResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Permission" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const RoleDefinitionListResult: msRest.CompositeMapper = { + serializedName: "RoleDefinitionListResult", + type: { + name: "Composite", + className: "RoleDefinitionListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RoleDefinition" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DenyAssignmentListResult: msRest.CompositeMapper = { + serializedName: "DenyAssignmentListResult", + type: { + name: "Composite", + className: "DenyAssignmentListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DenyAssignment" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/authorization/arm-authorization/lib/models/parameters.ts b/sdk/authorization/arm-authorization/lib/models/parameters.ts new file mode 100644 index 000000000000..5b073d2abf51 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/parameters.ts @@ -0,0 +1,231 @@ +/* + * 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"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion0: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + isConstant: true, + serializedName: "api-version", + defaultValue: '2015-06-01', + type: { + name: "String" + } + } +}; +export const apiVersion1: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + isConstant: true, + serializedName: "api-version", + defaultValue: '2018-01-01-preview', + type: { + name: "String" + } + } +}; +export const apiVersion2: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + isConstant: true, + serializedName: "api-version", + defaultValue: '2018-09-01-preview', + type: { + name: "String" + } + } +}; +export const apiVersion3: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + isConstant: true, + serializedName: "api-version", + defaultValue: '2018-07-01-preview', + type: { + name: "String" + } + } +}; +export const denyAssignmentId0: msRest.OperationURLParameter = { + parameterPath: "denyAssignmentId", + mapper: { + required: true, + serializedName: "denyAssignmentId", + type: { + name: "String" + } + } +}; +export const denyAssignmentId1: msRest.OperationURLParameter = { + parameterPath: "denyAssignmentId", + mapper: { + required: true, + serializedName: "denyAssignmentId", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const expand: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "expand" + ], + mapper: { + serializedName: "$expand", + defaultValue: 'resourceTypes', + type: { + name: "String" + } + } +}; +export const filter: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "filter" + ], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const parentResourcePath: msRest.OperationURLParameter = { + parameterPath: "parentResourcePath", + mapper: { + required: true, + serializedName: "parentResourcePath", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + type: { + name: "String" + } + } +}; +export const resourceName: msRest.OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + required: true, + serializedName: "resourceName", + type: { + name: "String" + } + } +}; +export const resourceProviderNamespace: msRest.OperationURLParameter = { + parameterPath: "resourceProviderNamespace", + mapper: { + required: true, + serializedName: "resourceProviderNamespace", + type: { + name: "String" + } + } +}; +export const resourceType: msRest.OperationURLParameter = { + parameterPath: "resourceType", + mapper: { + required: true, + serializedName: "resourceType", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const roleAssignmentName: msRest.OperationURLParameter = { + parameterPath: "roleAssignmentName", + mapper: { + required: true, + serializedName: "roleAssignmentName", + type: { + name: "String" + } + } +}; +export const roleDefinitionId: msRest.OperationURLParameter = { + parameterPath: "roleDefinitionId", + mapper: { + required: true, + serializedName: "roleDefinitionId", + type: { + name: "String" + } + } +}; +export const roleId: msRest.OperationURLParameter = { + parameterPath: "roleId", + mapper: { + required: true, + serializedName: "roleId", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const scope: msRest.OperationURLParameter = { + parameterPath: "scope", + mapper: { + required: true, + serializedName: "scope", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/authorization/arm-authorization/lib/models/permissionsMappers.ts b/sdk/authorization/arm-authorization/lib/models/permissionsMappers.ts new file mode 100644 index 000000000000..4dafccb64adc --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/permissionsMappers.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ + +export { + PermissionGetResult, + Permission, + CloudError +} from "../models/mappers"; + diff --git a/sdk/authorization/arm-authorization/lib/models/providerOperationsMetadataOperationsMappers.ts b/sdk/authorization/arm-authorization/lib/models/providerOperationsMetadataOperationsMappers.ts new file mode 100644 index 000000000000..ee946386a312 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/providerOperationsMetadataOperationsMappers.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { + ProviderOperationsMetadata, + ResourceType, + ProviderOperation, + CloudError, + ProviderOperationsMetadataListResult +} from "../models/mappers"; + diff --git a/sdk/authorization/arm-authorization/lib/models/roleAssignmentsMappers.ts b/sdk/authorization/arm-authorization/lib/models/roleAssignmentsMappers.ts new file mode 100644 index 000000000000..6b32348ab1b2 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/roleAssignmentsMappers.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export { + RoleAssignmentListResult, + RoleAssignment, + CloudError, + RoleAssignmentCreateParameters +} from "../models/mappers"; + diff --git a/sdk/authorization/arm-authorization/lib/models/roleDefinitionsMappers.ts b/sdk/authorization/arm-authorization/lib/models/roleDefinitionsMappers.ts new file mode 100644 index 000000000000..e1ed35fac8c0 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/models/roleDefinitionsMappers.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export { + RoleDefinition, + Permission, + CloudError, + RoleDefinitionListResult +} from "../models/mappers"; + diff --git a/sdk/authorization/arm-authorization/lib/operations/classicAdministrators.ts b/sdk/authorization/arm-authorization/lib/operations/classicAdministrators.ts new file mode 100644 index 000000000000..d9d06e7c6bfe --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/classicAdministrators.ts @@ -0,0 +1,126 @@ +/* + * 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/classicAdministratorsMappers"; +import * as Parameters from "../models/parameters"; +import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; + +/** Class representing a ClassicAdministrators. */ +export class ClassicAdministrators { + private readonly client: AuthorizationManagementClientContext; + + /** + * Create a ClassicAdministrators. + * @param {AuthorizationManagementClientContext} client Reference to the service client. + */ + constructor(client: AuthorizationManagementClientContext) { + this.client = client; + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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; + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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 listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ClassicAdministratorListResult + }, + 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.ClassicAdministratorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/authorization/arm-authorization/lib/operations/denyAssignments.ts b/sdk/authorization/arm-authorization/lib/operations/denyAssignments.ts new file mode 100644 index 000000000000..0ec0af80b2b8 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/denyAssignments.ts @@ -0,0 +1,571 @@ +/* + * 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/denyAssignmentsMappers"; +import * as Parameters from "../models/parameters"; +import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; + +/** Class representing a DenyAssignments. */ +export class DenyAssignments { + private readonly client: AuthorizationManagementClientContext; + + /** + * Create a DenyAssignments. + * @param {AuthorizationManagementClientContext} client Reference to the service client. + */ + constructor(client: AuthorizationManagementClientContext) { + this.client = client; + } + + /** + * Gets deny assignments for a resource. + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @param [options] The optional parameters + * @returns Promise + */ + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.DenyAssignmentsListForResourceOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @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. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @param options The optional parameters + * @param callback The callback + */ + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: Models.DenyAssignmentsListForResourceOptionalParams, callback: msRest.ServiceCallback): void; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.DenyAssignmentsListForResourceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + }, + listForResourceOperationSpec, + callback) as Promise; + } + + /** + * Gets deny assignments for a resource group. + * @param resourceGroupName The name of the resource group. + * @param [options] The optional parameters + * @returns Promise + */ + listForResourceGroup(resourceGroupName: string, options?: Models.DenyAssignmentsListForResourceGroupOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param callback The callback + */ + listForResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param options The optional parameters + * @param callback The callback + */ + listForResourceGroup(resourceGroupName: string, options: Models.DenyAssignmentsListForResourceGroupOptionalParams, callback: msRest.ServiceCallback): void; + listForResourceGroup(resourceGroupName: string, options?: Models.DenyAssignmentsListForResourceGroupOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listForResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Gets all deny assignments for the subscription. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: Models.DenyAssignmentsListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.DenyAssignmentsListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.DenyAssignmentsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Get the specified deny assignment. + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @param [options] The optional parameters + * @returns Promise + */ + get(scope: string, denyAssignmentId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @param callback The callback + */ + get(scope: string, denyAssignmentId: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @param options The optional parameters + * @param callback The callback + */ + get(scope: string, denyAssignmentId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(scope: string, denyAssignmentId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + denyAssignmentId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Gets a deny assignment by ID. + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for + * subscription level deny assignments, or + * /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny + * assignments. + * @param [options] The optional parameters + * @returns Promise + */ + getById(denyAssignmentId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for + * subscription level deny assignments, or + * /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny + * assignments. + * @param callback The callback + */ + getById(denyAssignmentId: string, callback: msRest.ServiceCallback): void; + /** + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for + * subscription level deny assignments, or + * /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny + * assignments. + * @param options The optional parameters + * @param callback The callback + */ + getById(denyAssignmentId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getById(denyAssignmentId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + denyAssignmentId, + options + }, + getByIdOperationSpec, + callback) as Promise; + } + + /** + * Gets deny assignments for a scope. + * @param scope The scope of the deny assignments. + * @param [options] The optional parameters + * @returns Promise + */ + listForScope(scope: string, options?: Models.DenyAssignmentsListForScopeOptionalParams): Promise; + /** + * @param scope The scope of the deny assignments. + * @param callback The callback + */ + listForScope(scope: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the deny assignments. + * @param options The optional parameters + * @param callback The callback + */ + listForScope(scope: string, options: Models.DenyAssignmentsListForScopeOptionalParams, callback: msRest.ServiceCallback): void; + listForScope(scope: string, options?: Models.DenyAssignmentsListForScopeOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + options + }, + listForScopeOperationSpec, + callback) as Promise; + } + + /** + * Gets deny assignments for 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; + } + + /** + * Gets deny assignments for 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; + } + + /** + * Gets all deny assignments for the 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; + } + + /** + * Gets deny assignments for a scope. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listForScopeNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listForScopeNext(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 + */ + listForScopeNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listForScopeNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listForScopeNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listForResourceOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName + ], + queryParameters: [ + Parameters.apiVersion3, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + queryParameters: [ + Parameters.apiVersion3, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion3, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}", + urlParameters: [ + Parameters.scope, + Parameters.denyAssignmentId0 + ], + queryParameters: [ + Parameters.apiVersion3 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getByIdOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{denyAssignmentId}", + urlParameters: [ + Parameters.denyAssignmentId1 + ], + queryParameters: [ + Parameters.apiVersion3 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForScopeOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Authorization/denyAssignments", + urlParameters: [ + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion3, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignmentListResult + }, + 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.DenyAssignmentListResult + }, + 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.DenyAssignmentListResult + }, + 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.DenyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForScopeNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DenyAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/authorization/arm-authorization/lib/operations/index.ts b/sdk/authorization/arm-authorization/lib/operations/index.ts new file mode 100644 index 000000000000..b8d60f65908b --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/index.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ + +export * from "./classicAdministrators"; +export * from "./providerOperationsMetadataOperations"; +export * from "./roleAssignments"; +export * from "./permissions"; +export * from "./roleDefinitions"; +export * from "./denyAssignments"; diff --git a/sdk/authorization/arm-authorization/lib/operations/permissions.ts b/sdk/authorization/arm-authorization/lib/operations/permissions.ts new file mode 100644 index 000000000000..a2a0b8e63efe --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/permissions.ts @@ -0,0 +1,252 @@ +/* + * 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/permissionsMappers"; +import * as Parameters from "../models/parameters"; +import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; + +/** Class representing a Permissions. */ +export class Permissions { + private readonly client: AuthorizationManagementClientContext; + + /** + * Create a Permissions. + * @param {AuthorizationManagementClientContext} client Reference to the service client. + */ + constructor(client: AuthorizationManagementClientContext) { + this.client = client; + } + + /** + * Gets all permissions the caller has for a resource group. + * @param resourceGroupName The name of the resource group. + * @param [options] The optional parameters + * @returns Promise + */ + listForResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param callback The callback + */ + listForResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param options The optional parameters + * @param callback The callback + */ + listForResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listForResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listForResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Gets all permissions the caller has for a resource. + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get the permissions for. + * @param [options] The optional parameters + * @returns Promise + */ + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get the permissions for. + * @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. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get the permissions for. + * @param options The optional parameters + * @param callback The callback + */ + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + }, + listForResourceOperationSpec, + callback) as Promise; + } + + /** + * Gets all permissions the caller has for 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; + } + + /** + * Gets all permissions the caller has for 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; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listForResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PermissionGetResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForResourceOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PermissionGetResult + }, + 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.PermissionGetResult + }, + 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.PermissionGetResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/authorization/arm-authorization/lib/operations/providerOperationsMetadataOperations.ts b/sdk/authorization/arm-authorization/lib/operations/providerOperationsMetadataOperations.ts new file mode 100644 index 000000000000..c61f46db1e11 --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/providerOperationsMetadataOperations.ts @@ -0,0 +1,176 @@ +/* + * 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/providerOperationsMetadataOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; + +/** Class representing a ProviderOperationsMetadataOperations. */ +export class ProviderOperationsMetadataOperations { + private readonly client: AuthorizationManagementClientContext; + + /** + * Create a ProviderOperationsMetadataOperations. + * @param {AuthorizationManagementClientContext} client Reference to the service client. + */ + constructor(client: AuthorizationManagementClientContext) { + this.client = client; + } + + /** + * Gets provider operations metadata for the specified resource provider. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceProviderNamespace: string, options?: Models.ProviderOperationsMetadataGetOptionalParams): Promise; + /** + * @param resourceProviderNamespace The namespace of the resource provider. + * @param callback The callback + */ + get(resourceProviderNamespace: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceProviderNamespace The namespace of the resource provider. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceProviderNamespace: string, options: Models.ProviderOperationsMetadataGetOptionalParams, callback: msRest.ServiceCallback): void; + get(resourceProviderNamespace: string, options?: Models.ProviderOperationsMetadataGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceProviderNamespace, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Gets provider operations metadata for all resource providers. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: Models.ProviderOperationsMetadataListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.ProviderOperationsMetadataListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.ProviderOperationsMetadataListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets provider operations metadata for all resource providers. + * @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 getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", + urlParameters: [ + Parameters.resourceProviderNamespace + ], + queryParameters: [ + Parameters.apiVersion1, + Parameters.expand + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ProviderOperationsMetadata + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Authorization/providerOperations", + queryParameters: [ + Parameters.apiVersion1, + Parameters.expand + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ProviderOperationsMetadataListResult + }, + 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.ProviderOperationsMetadataListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/authorization/arm-authorization/lib/operations/roleAssignments.ts b/sdk/authorization/arm-authorization/lib/operations/roleAssignments.ts new file mode 100644 index 000000000000..a2c56f828b8d --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/roleAssignments.ts @@ -0,0 +1,810 @@ +/* + * 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/roleAssignmentsMappers"; +import * as Parameters from "../models/parameters"; +import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; + +/** Class representing a RoleAssignments. */ +export class RoleAssignments { + private readonly client: AuthorizationManagementClientContext; + + /** + * Create a RoleAssignments. + * @param {AuthorizationManagementClientContext} client Reference to the service client. + */ + constructor(client: AuthorizationManagementClientContext) { + this.client = client; + } + + /** + * Gets role assignments for a resource. + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get role assignments for. + * @param [options] The optional parameters + * @returns Promise + */ + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.RoleAssignmentsListForResourceOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get role assignments for. + * @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. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get role assignments for. + * @param options The optional parameters + * @param callback The callback + */ + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: Models.RoleAssignmentsListForResourceOptionalParams, callback: msRest.ServiceCallback): void; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.RoleAssignmentsListForResourceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + }, + listForResourceOperationSpec, + callback) as Promise; + } + + /** + * Gets role assignments for a resource group. + * @param resourceGroupName The name of the resource group. + * @param [options] The optional parameters + * @returns Promise + */ + listForResourceGroup(resourceGroupName: string, options?: Models.RoleAssignmentsListForResourceGroupOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param callback The callback + */ + listForResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param options The optional parameters + * @param callback The callback + */ + listForResourceGroup(resourceGroupName: string, options: Models.RoleAssignmentsListForResourceGroupOptionalParams, callback: msRest.ServiceCallback): void; + listForResourceGroup(resourceGroupName: string, options?: Models.RoleAssignmentsListForResourceGroupOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listForResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Deletes a role assignment. + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param callback The callback + */ + deleteMethod(scope: string, roleAssignmentName: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(scope: string, roleAssignmentName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + roleAssignmentName, + options + }, + deleteMethodOperationSpec, + callback) as Promise; + } + + /** + * Creates a role assignment. + * @param scope The scope of the role assignment to create. The scope can be any REST resource + * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, + * and + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @param [options] The optional parameters + * @returns Promise + */ + create(scope: string, roleAssignmentName: string, parameters: Models.RoleAssignmentCreateParameters, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the role assignment to create. The scope can be any REST resource + * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, + * and + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @param callback The callback + */ + create(scope: string, roleAssignmentName: string, parameters: Models.RoleAssignmentCreateParameters, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role assignment to create. The scope can be any REST resource + * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, + * and + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @param options The optional parameters + * @param callback The callback + */ + create(scope: string, roleAssignmentName: string, parameters: Models.RoleAssignmentCreateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + create(scope: string, roleAssignmentName: string, parameters: Models.RoleAssignmentCreateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + roleAssignmentName, + parameters, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * Get the specified role assignment. + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @param [options] The optional parameters + * @returns Promise + */ + get(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @param callback The callback + */ + get(scope: string, roleAssignmentName: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @param options The optional parameters + * @param callback The callback + */ + get(scope: string, roleAssignmentName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + roleAssignmentName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Deletes a role assignment. + * @param roleId The ID of the role assignment to delete. + * @param [options] The optional parameters + * @returns Promise + */ + deleteById(roleId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param roleId The ID of the role assignment to delete. + * @param callback The callback + */ + deleteById(roleId: string, callback: msRest.ServiceCallback): void; + /** + * @param roleId The ID of the role assignment to delete. + * @param options The optional parameters + * @param callback The callback + */ + deleteById(roleId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteById(roleId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + roleId, + options + }, + deleteByIdOperationSpec, + callback) as Promise; + } + + /** + * Creates a role assignment by ID. + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param [options] The optional parameters + * @returns Promise + */ + createById(roleId: string, parameters: Models.RoleAssignmentCreateParameters, options?: msRest.RequestOptionsBase): Promise; + /** + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param callback The callback + */ + createById(roleId: string, parameters: Models.RoleAssignmentCreateParameters, callback: msRest.ServiceCallback): void; + /** + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param options The optional parameters + * @param callback The callback + */ + createById(roleId: string, parameters: Models.RoleAssignmentCreateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + createById(roleId: string, parameters: Models.RoleAssignmentCreateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + roleId, + parameters, + options + }, + createByIdOperationSpec, + callback) as Promise; + } + + /** + * Gets a role assignment by ID. + * @param roleId The ID of the role assignment to get. + * @param [options] The optional parameters + * @returns Promise + */ + getById(roleId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param roleId The ID of the role assignment to get. + * @param callback The callback + */ + getById(roleId: string, callback: msRest.ServiceCallback): void; + /** + * @param roleId The ID of the role assignment to get. + * @param options The optional parameters + * @param callback The callback + */ + getById(roleId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getById(roleId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + roleId, + options + }, + getByIdOperationSpec, + callback) as Promise; + } + + /** + * Gets all role assignments for the subscription. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: Models.RoleAssignmentsListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.RoleAssignmentsListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.RoleAssignmentsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets role assignments for a scope. + * @param scope The scope of the role assignments. + * @param [options] The optional parameters + * @returns Promise + */ + listForScope(scope: string, options?: Models.RoleAssignmentsListForScopeOptionalParams): Promise; + /** + * @param scope The scope of the role assignments. + * @param callback The callback + */ + listForScope(scope: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role assignments. + * @param options The optional parameters + * @param callback The callback + */ + listForScope(scope: string, options: Models.RoleAssignmentsListForScopeOptionalParams, callback: msRest.ServiceCallback): void; + listForScope(scope: string, options?: Models.RoleAssignmentsListForScopeOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + options + }, + listForScopeOperationSpec, + callback) as Promise; + } + + /** + * Gets role assignments for 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; + } + + /** + * Gets role assignments for 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; + } + + /** + * Gets all role assignments for the 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; + } + + /** + * Gets role assignments for a scope. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listForScopeNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listForScopeNext(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 + */ + listForScopeNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listForScopeNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listForScopeNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listForResourceOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + urlParameters: [ + Parameters.scope, + Parameters.roleAssignmentName + ], + queryParameters: [ + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + urlParameters: [ + Parameters.scope, + Parameters.roleAssignmentName + ], + queryParameters: [ + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.RoleAssignmentCreateParameters, + required: true + } + }, + responses: { + 201: { + bodyMapper: Mappers.RoleAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + urlParameters: [ + Parameters.scope, + Parameters.roleAssignmentName + ], + queryParameters: [ + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const deleteByIdOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "{roleId}", + urlParameters: [ + Parameters.roleId + ], + queryParameters: [ + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const createByIdOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "{roleId}", + urlParameters: [ + Parameters.roleId + ], + queryParameters: [ + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.RoleAssignmentCreateParameters, + required: true + } + }, + responses: { + 201: { + bodyMapper: Mappers.RoleAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getByIdOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{roleId}", + urlParameters: [ + Parameters.roleId + ], + queryParameters: [ + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignment + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForScopeOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Authorization/roleAssignments", + urlParameters: [ + Parameters.scope + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion2 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignmentListResult + }, + 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.RoleAssignmentListResult + }, + 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.RoleAssignmentListResult + }, + 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.RoleAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listForScopeNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleAssignmentListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/authorization/arm-authorization/lib/operations/roleDefinitions.ts b/sdk/authorization/arm-authorization/lib/operations/roleDefinitions.ts new file mode 100644 index 000000000000..5e8ca07273af --- /dev/null +++ b/sdk/authorization/arm-authorization/lib/operations/roleDefinitions.ts @@ -0,0 +1,373 @@ +/* + * 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/roleDefinitionsMappers"; +import * as Parameters from "../models/parameters"; +import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; + +/** Class representing a RoleDefinitions. */ +export class RoleDefinitions { + private readonly client: AuthorizationManagementClientContext; + + /** + * Create a RoleDefinitions. + * @param {AuthorizationManagementClientContext} client Reference to the service client. + */ + constructor(client: AuthorizationManagementClientContext) { + this.client = client; + } + + /** + * Deletes a role definition. + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @param callback The callback + */ + deleteMethod(scope: string, roleDefinitionId: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(scope: string, roleDefinitionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + roleDefinitionId, + options + }, + deleteMethodOperationSpec, + callback) as Promise; + } + + /** + * Get role definition by name (GUID). + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param [options] The optional parameters + * @returns Promise + */ + get(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param callback The callback + */ + get(scope: string, roleDefinitionId: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param options The optional parameters + * @param callback The callback + */ + get(scope: string, roleDefinitionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + roleDefinitionId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Creates or updates a role definition. + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. + * @param callback The callback + */ + createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. + * @param options The optional parameters + * @param callback The callback + */ + createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + roleDefinitionId, + roleDefinition, + options + }, + createOrUpdateOperationSpec, + callback) as Promise; + } + + /** + * Get all role definitions that are applicable at scope and above. + * @param scope The scope of the role definition. + * @param [options] The optional parameters + * @returns Promise + */ + list(scope: string, options?: Models.RoleDefinitionsListOptionalParams): Promise; + /** + * @param scope The scope of the role definition. + * @param callback The callback + */ + list(scope: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The scope of the role definition. + * @param options The optional parameters + * @param callback The callback + */ + list(scope: string, options: Models.RoleDefinitionsListOptionalParams, callback: msRest.ServiceCallback): void; + list(scope: string, options?: Models.RoleDefinitionsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets a role definition by ID. + * @param roleId The fully qualified role definition ID. Use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for + * subscription level role definitions, or + * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role + * definitions. + * @param [options] The optional parameters + * @returns Promise + */ + getById(roleId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param roleId The fully qualified role definition ID. Use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for + * subscription level role definitions, or + * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role + * definitions. + * @param callback The callback + */ + getById(roleId: string, callback: msRest.ServiceCallback): void; + /** + * @param roleId The fully qualified role definition ID. Use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for + * subscription level role definitions, or + * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role + * definitions. + * @param options The optional parameters + * @param callback The callback + */ + getById(roleId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getById(roleId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + roleId, + options + }, + getByIdOperationSpec, + callback) as Promise; + } + + /** + * Get all role definitions that are applicable at scope and above. + * @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/roleDefinitions/{roleDefinitionId}", + urlParameters: [ + Parameters.scope, + Parameters.roleDefinitionId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleDefinition + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", + urlParameters: [ + Parameters.scope, + Parameters.roleDefinitionId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleDefinition + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const createOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", + urlParameters: [ + Parameters.scope, + Parameters.roleDefinitionId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "roleDefinition", + mapper: { + ...Mappers.RoleDefinition, + required: true + } + }, + responses: { + 201: { + bodyMapper: Mappers.RoleDefinition + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Authorization/roleDefinitions", + urlParameters: [ + Parameters.scope + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleDefinitionListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getByIdOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{roleId}", + urlParameters: [ + Parameters.roleId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RoleDefinition + }, + 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.RoleDefinitionListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/authorization/arm-authorization/package.json b/sdk/authorization/arm-authorization/package.json new file mode 100644 index 000000000000..14ea4e466b1d --- /dev/null +++ b/sdk/authorization/arm-authorization/package.json @@ -0,0 +1,56 @@ +{ + "name": "@azure/arm-authorization", + "author": "Microsoft Corporation", + "description": "AuthorizationManagementClient Library with typescript type definitions for node.js and browser.", + "version": "8.3.1", + "dependencies": { + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-authorization.js", + "module": "./esm/authorizationManagementClient.js", + "types": "./esm/authorizationManagementClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-authorization.js.map'\" -o ./dist/arm-authorization.min.js ./dist/arm-authorization.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false +} diff --git a/sdk/authorization/arm-authorization/rollup.config.js b/sdk/authorization/arm-authorization/rollup.config.js new file mode 100644 index 000000000000..72dc3f8ec5c7 --- /dev/null +++ b/sdk/authorization/arm-authorization/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/authorizationManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-authorization.js", + format: "umd", + name: "Azure.ArmAuthorization", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@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. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */` + }, + plugins: [ + nodeResolve({ module: true }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/authorization/arm-authorization/tsconfig.json b/sdk/authorization/arm-authorization/tsconfig.json new file mode 100644 index 000000000000..51ea90961ce5 --- /dev/null +++ b/sdk/authorization/arm-authorization/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./lib/**/*.ts"], + "exclude": ["node_modules"] +}