From 51280f1ac0519647d9958653295dff39c7e4f0cf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 8 Mar 2019 01:25:16 +0000 Subject: [PATCH 1/3] Generated from 21bcf7ed4779c90a805e5b2fc1c2bb5736743cf2 address review feedbacks --- packages/@azure/graph/LICENSE.txt | 42 +- packages/@azure/graph/README.md | 192 ++-- .../lib/graphRbacManagementClientContext.ts | 2 +- .../graph/lib/models/applicationsMappers.ts | 8 + .../lib/models/deletedApplicationsMappers.ts | 9 + .../@azure/graph/lib/models/groupsMappers.ts | 9 + packages/@azure/graph/lib/models/index.ts | 803 ++++++++++---- packages/@azure/graph/lib/models/mappers.ts | 981 +++++++++++++----- .../@azure/graph/lib/models/oAuth2Mappers.ts | 4 +- .../@azure/graph/lib/models/objectsMappers.ts | 9 + .../lib/models/servicePrincipalsMappers.ts | 8 + .../graph/lib/models/signedInUserMappers.ts | 9 + .../@azure/graph/lib/models/usersMappers.ts | 9 + .../@azure/graph/lib/operations/oAuth2.ts | 109 +- packages/@azure/graph/package.json | 8 +- packages/@azure/graph/rollup.config.js | 22 +- 16 files changed, 1658 insertions(+), 566 deletions(-) diff --git a/packages/@azure/graph/LICENSE.txt b/packages/@azure/graph/LICENSE.txt index a70e8cf66038..8f3d856145c5 100644 --- a/packages/@azure/graph/LICENSE.txt +++ b/packages/@azure/graph/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 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. +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/packages/@azure/graph/README.md b/packages/@azure/graph/README.md index 30ed73d24a30..06973b2b634a 100644 --- a/packages/@azure/graph/README.md +++ b/packages/@azure/graph/README.md @@ -1,96 +1,96 @@ -## Azure GraphRbacManagementClient SDK for JavaScript - -This package contains an isomorphic SDK for GraphRbacManagementClient. - -### Currently supported environments - -- Node.js version 6.x.x or higher -- Browser JavaScript - -### How to Install - -``` -npm install @azure/graph -``` - -### How to use - -#### nodejs - Authentication, client creation and get signedInUser as an example written in TypeScript. - -##### Install @azure/ms-rest-nodeauth - -``` -npm install @azure/ms-rest-nodeauth -``` - -##### Sample code - -```ts -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 { GraphRbacManagementClient, GraphRbacManagementModels, GraphRbacManagementMappers } from "@azure/graph"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new GraphRbacManagementClient(creds, subscriptionId); - client.signedInUser.get().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -#### browser - Authentication, client creation and get signedInUser as an example written in JavaScript. - -##### Install @azure/ms-rest-browserauth - -``` -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/graph sample - - - - - - - - -``` - -## Related projects - -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +## Azure GraphRbacManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for GraphRbacManagementClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/graph +``` + +### How to use + +#### nodejs - Authentication, client creation and get signedInUser 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 { GraphRbacManagementClient, GraphRbacManagementModels, GraphRbacManagementMappers } from "@azure/graph"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new GraphRbacManagementClient(creds, subscriptionId); + client.signedInUser.get().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and get signedInUser 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/graph sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/graph/lib/graphRbacManagementClientContext.ts b/packages/@azure/graph/lib/graphRbacManagementClientContext.ts index 6ad0e2233daa..26036f978fcd 100644 --- a/packages/@azure/graph/lib/graphRbacManagementClientContext.ts +++ b/packages/@azure/graph/lib/graphRbacManagementClientContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/graph"; -const packageVersion = "0.1.0"; +const packageVersion = "4.3.0"; export class GraphRbacManagementClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; diff --git a/packages/@azure/graph/lib/models/applicationsMappers.ts b/packages/@azure/graph/lib/models/applicationsMappers.ts index 2caa29495098..ed2d709655b8 100644 --- a/packages/@azure/graph/lib/models/applicationsMappers.ts +++ b/packages/@azure/graph/lib/models/applicationsMappers.ts @@ -11,9 +11,17 @@ export { discriminators, ApplicationCreateParameters, + ApplicationBase, AppRole, + InformationalUrl, KeyCredential, + OAuth2Permission, + OptionalClaims, + OptionalClaim, PasswordCredential, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, Application, diff --git a/packages/@azure/graph/lib/models/deletedApplicationsMappers.ts b/packages/@azure/graph/lib/models/deletedApplicationsMappers.ts index 8f257066e9f6..a9a225be7da7 100644 --- a/packages/@azure/graph/lib/models/deletedApplicationsMappers.ts +++ b/packages/@azure/graph/lib/models/deletedApplicationsMappers.ts @@ -13,6 +13,15 @@ export { Application, DirectoryObject, AppRole, + InformationalUrl, + KeyCredential, + OAuth2Permission, + OptionalClaims, + OptionalClaim, + PasswordCredential, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, GraphError, diff --git a/packages/@azure/graph/lib/models/groupsMappers.ts b/packages/@azure/graph/lib/models/groupsMappers.ts index 3d00ed56ed4c..aee690e89f0a 100644 --- a/packages/@azure/graph/lib/models/groupsMappers.ts +++ b/packages/@azure/graph/lib/models/groupsMappers.ts @@ -24,6 +24,15 @@ export { AddOwnerParameters, Application, AppRole, + InformationalUrl, + KeyCredential, + OAuth2Permission, + OptionalClaims, + OptionalClaim, + PasswordCredential, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, ServicePrincipal, diff --git a/packages/@azure/graph/lib/models/index.ts b/packages/@azure/graph/lib/models/index.ts index e18d2325314b..5e067bc4a14d 100644 --- a/packages/@azure/graph/lib/models/index.ts +++ b/packages/@azure/graph/lib/models/index.ts @@ -14,6 +14,195 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; +/** + * @interface + * An interface representing InformationalUrl. + * Represents a group of URIs that provide terms of service, marketing, support + * and privacy policy information about an application. The default value for + * each string is null. + * + */ +export interface InformationalUrl { + /** + * @member {string} [termsOfService] The terms of service URI + */ + termsOfService?: string; + /** + * @member {string} [marketing] The marketing URI + */ + marketing?: string; + /** + * @member {string} [privacy] The privacy policy URI + */ + privacy?: string; + /** + * @member {string} [support] The support URI + */ + support?: string; +} + +/** + * @interface + * An interface representing OAuth2Permission. + * Represents an OAuth 2.0 delegated permission scope. The specified OAuth 2.0 + * delegated permission scopes may be requested by client applications (through + * the requiredResourceAccess collection on the Application object) when + * calling a resource application. The oauth2Permissions property of the + * ServicePrincipal entity and of the Application entity is a collection of + * OAuth2Permission. + * + */ +export interface OAuth2Permission { + /** + * @member {string} [adminConsentDescription] Permission help text that + * appears in the admin consent and app assignment experiences. + */ + adminConsentDescription?: string; + /** + * @member {string} [adminConsentDisplayName] Display name for the permission + * that appears in the admin consent and app assignment experiences. + */ + adminConsentDisplayName?: string; + /** + * @member {string} [id] Unique scope permission identifier inside the + * oauth2Permissions collection. + */ + id?: string; + /** + * @member {boolean} [isEnabled] When creating or updating a permission, this + * property must be set to true (which is the default). To delete a + * permission, this property must first be set to false. At that point, in a + * subsequent call, the permission may be removed. + */ + isEnabled?: boolean; + /** + * @member {string} [type] Specifies whether this scope permission can be + * consented to by an end user, or whether it is a tenant-wide permission + * that must be consented to by a Company Administrator. Possible values are + * "User" or "Admin". + */ + type?: string; + /** + * @member {string} [userConsentDescription] Permission help text that + * appears in the end user consent experience. + */ + userConsentDescription?: string; + /** + * @member {string} [userConsentDisplayName] Display name for the permission + * that appears in the end user consent experience. + */ + userConsentDisplayName?: string; + /** + * @member {string} [value] The value of the scope claim that the resource + * application should expect in the OAuth 2.0 access token. + */ + value?: string; +} + +/** + * @interface + * An interface representing OptionalClaim. + * Specifying the claims to be included in a token. + * + */ +export interface OptionalClaim { + /** + * @member {string} [name] Claim name. + */ + name?: string; + /** + * @member {string} [source] Claim source. + */ + source?: string; + /** + * @member {boolean} [essential] Is this a requied claim. + */ + essential?: boolean; + /** + * @member {any} [additionalProperties] + */ + additionalProperties?: any; +} + +/** + * @interface + * An interface representing OptionalClaims. + * Specifying the claims to be included in the token. + * + */ +export interface OptionalClaims { + /** + * @member {OptionalClaim[]} [idToken] Optional claims requested to be + * included in the id token. + */ + idToken?: OptionalClaim[]; + /** + * @member {OptionalClaim[]} [accessToken] Optional claims requested to be + * included in the access token. + */ + accessToken?: OptionalClaim[]; + /** + * @member {OptionalClaim[]} [samlToken] Optional claims requested to be + * included in the saml token. + */ + samlToken?: OptionalClaim[]; +} + +/** + * @interface + * An interface representing PreAuthorizedApplicationPermission. + * Contains information about the pre-authorized permissions. + * + */ +export interface PreAuthorizedApplicationPermission { + /** + * @member {boolean} [directAccessGrant] Indicates whether the permission set + * is DirectAccess or impersonation. + */ + directAccessGrant?: boolean; + /** + * @member {string[]} [accessGrants] The list of permissions. + */ + accessGrants?: string[]; +} + +/** + * @interface + * An interface representing PreAuthorizedApplicationExtension. + * Representation of an app PreAuthorizedApplicationExtension required by a pre + * authorized client app. + * + */ +export interface PreAuthorizedApplicationExtension { + /** + * @member {string[]} [conditions] The extension's conditions. + */ + conditions?: string[]; +} + +/** + * @interface + * An interface representing PreAuthorizedApplication. + * Contains information about pre authorized client application. + * + */ +export interface PreAuthorizedApplication { + /** + * @member {string} [appId] Represents the application id. + */ + appId?: string; + /** + * @member {PreAuthorizedApplicationPermission[]} [permissions] Collection of + * required app permissions/entitlements from the resource application. + */ + permissions?: PreAuthorizedApplicationPermission[]; + /** + * @member {PreAuthorizedApplicationExtension[]} [extensions] Collection of + * extensions from the resource application. + */ + extensions?: PreAuthorizedApplicationExtension[]; +} + /** * @interface * An interface representing GraphError. @@ -100,9 +289,9 @@ export interface KeyCredential { */ type?: string; /** - * @member {Uint8Array} [customKeyIdentifier] Custom Key Identifier + * @member {string} [customKeyIdentifier] Custom Key Identifier */ - customKeyIdentifier?: Uint8Array; + customKeyIdentifier?: string; /** * @property Describes unknown properties. The value of an unknown property * can be of "any" type. @@ -133,6 +322,10 @@ export interface PasswordCredential { * @member {string} [value] Key value. */ value?: string; + /** + * @member {Uint8Array} [customKeyIdentifier] Custom Key Identifier + */ + customKeyIdentifier?: Uint8Array; /** * @property Describes unknown properties. The value of an unknown property * can be of "any" type. @@ -174,7 +367,7 @@ export interface ResourceAccess { * OAuth 2.0 permission scopes may be requested by client applications (through * the requiredResourceAccess collection) when calling a resource application. * The requiredResourceAccess property of the Application entity is a - * collection of ReqiredResourceAccess. + * collection of RequiredResourceAccess. * */ export interface RequiredResourceAccess { @@ -240,11 +433,28 @@ export interface AppRole { /** * @interface - * An interface representing ApplicationCreateParameters. - * Request parameters for creating a new application. + * An interface representing ApplicationBase. + * Active Directive Application common properties shared among GET, POST and + * PATCH * */ -export interface ApplicationCreateParameters { +export interface ApplicationBase { + /** + * @member {boolean} [allowGuestsSignIn] A property on the application to + * indicate if the application accepts other IDPs or not or partially + * accepts. + */ + allowGuestsSignIn?: boolean; + /** + * @member {boolean} [allowPassthroughUsers] Indicates that the application + * supports pass through users who have no presence in the resource tenant. + */ + allowPassthroughUsers?: boolean; + /** + * @member {string} [appLogoUrl] The url for the application logo image + * stored in a CDN. + */ + appLogoUrl?: string; /** * @member {AppRole[]} [appRoles] The collection of application roles that an * application may declare. These roles can be assigned to users, groups or @@ -252,109 +462,111 @@ export interface ApplicationCreateParameters { */ appRoles?: AppRole[]; /** - * @member {boolean} availableToOtherTenants Whether the application is + * @member {string[]} [appPermissions] The application permissions. + */ + appPermissions?: string[]; + /** + * @member {boolean} [availableToOtherTenants] Whether the application is * available to other tenants. */ - availableToOtherTenants: boolean; + availableToOtherTenants?: boolean; /** - * @member {string} displayName The display name of the application. + * @member {string} [errorUrl] A URL provided by the author of the + * application to report errors when using the application. */ - displayName: string; + errorUrl?: string; /** * @member {string} [homepage] The home page of the application. */ homepage?: string; /** - * @member {string[]} identifierUris A collection of URIs for the - * application. + * @member {InformationalUrl} [informationalUrls] urls with more informations + * of the application. */ - identifierUris: string[]; + informationalUrls?: InformationalUrl; /** - * @member {string[]} [replyUrls] A collection of reply URLs for the - * application. + * @member {boolean} [isDeviceOnlyAuthSupported] Specifies whether this + * application supports device authentication without a user. The default is + * false. */ - replyUrls?: string[]; + isDeviceOnlyAuthSupported?: boolean; /** - * @member {KeyCredential[]} [keyCredentials] The list of KeyCredential + * @member {KeyCredential[]} [keyCredentials] A collection of KeyCredential * objects. */ keyCredentials?: KeyCredential[]; /** - * @member {PasswordCredential[]} [passwordCredentials] The list of - * PasswordCredential objects. + * @member {string[]} [knownClientApplications] Client applications that are + * tied to this resource application. Consent to any of the known client + * applications will result in implicit consent to the resource application + * through a combined consent dialog (showing the OAuth permission scopes + * required by the client and the resource). */ - passwordCredentials?: PasswordCredential[]; + knownClientApplications?: string[]; + /** + * @member {string} [logoutUrl] the url of the logout page + */ + logoutUrl?: string; /** * @member {boolean} [oauth2AllowImplicitFlow] Whether to allow implicit * grant flow for OAuth2 */ oauth2AllowImplicitFlow?: boolean; /** - * @member {RequiredResourceAccess[]} [requiredResourceAccess] Specifies - * resources that this application requires access to and the set of OAuth - * permission scopes and application roles that it needs under each of those - * resources. This pre-configuration of required resource access drives the - * consent experience. + * @member {boolean} [oauth2AllowUrlPathMatching] Specifies whether during a + * token Request Azure AD will allow path matching of the redirect URI + * against the applications collection of replyURLs. The default is false. */ - requiredResourceAccess?: RequiredResourceAccess[]; + oauth2AllowUrlPathMatching?: boolean; /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. + * @member {OAuth2Permission[]} [oauth2Permissions] The collection of OAuth + * 2.0 permission scopes that the web API (resource) application exposes to + * client applications. These permission scopes may be granted to client + * applications during consent. */ - [property: string]: any; -} - -/** - * @interface - * An interface representing ApplicationUpdateParameters. - * Request parameters for updating an existing application. - * - */ -export interface ApplicationUpdateParameters { + oauth2Permissions?: OAuth2Permission[]; /** - * @member {AppRole[]} [appRoles] The collection of application roles that an - * application may declare. These roles can be assigned to users, groups or - * service principals. - */ - appRoles?: AppRole[]; - /** - * @member {boolean} [availableToOtherTenants] Whether the application is - * available to other tenants + * @member {boolean} [oauth2RequirePostResponse] Specifies whether, as part + * of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed + * to GET requests. The default is false, which specifies that only GET + * requests will be allowed. */ - availableToOtherTenants?: boolean; + oauth2RequirePostResponse?: boolean; /** - * @member {string} [displayName] The display name of the application. + * @member {string[]} [orgRestrictions] A list of tenants allowed to access + * application. */ - displayName?: string; + orgRestrictions?: string[]; /** - * @member {string} [homepage] The home page of the application. + * @member {OptionalClaims} [optionalClaims] */ - homepage?: string; + optionalClaims?: OptionalClaims; /** - * @member {string[]} [identifierUris] A collection of URIs for the - * application. + * @member {PasswordCredential[]} [passwordCredentials] A collection of + * PasswordCredential objects */ - identifierUris?: string[]; + passwordCredentials?: PasswordCredential[]; /** - * @member {string[]} [replyUrls] A collection of reply URLs for the - * application. + * @member {PreAuthorizedApplication[]} [preAuthorizedApplications] list of + * pre-authorizaed applications. */ - replyUrls?: string[]; + preAuthorizedApplications?: PreAuthorizedApplication[]; /** - * @member {KeyCredential[]} [keyCredentials] The list of KeyCredential - * objects. + * @member {boolean} [publicClient] Specifies whether this application is a + * public client (such as an installed application running on a mobile + * device). Default is false. */ - keyCredentials?: KeyCredential[]; + publicClient?: boolean; /** - * @member {PasswordCredential[]} [passwordCredentials] The list of - * PasswordCredential objects. + * @member {string} [publisherDomain] Reliable domain which can be used to + * identify an application. */ - passwordCredentials?: PasswordCredential[]; + publisherDomain?: string; /** - * @member {boolean} [oauth2AllowImplicitFlow] Whether to allow implicit - * grant flow for OAuth2 + * @member {string[]} [replyUrls] A collection of reply URLs for the + * application. */ - oauth2AllowImplicitFlow?: boolean; + replyUrls?: string[]; /** * @member {RequiredResourceAccess[]} [requiredResourceAccess] Specifies * resources that this application requires access to and the set of OAuth @@ -364,10 +576,58 @@ export interface ApplicationUpdateParameters { */ requiredResourceAccess?: RequiredResourceAccess[]; /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. + * @member {string} [samlMetadataUrl] The URL to the SAML metadata for the + * application. */ - [property: string]: any; + samlMetadataUrl?: string; + /** + * @member {string} [signInAudience] Audience for signing in to the + * application (AzureADMyOrganizatio, AzureADAllorganizations, + * AzureADAndMicrosofAccounts). + */ + signInAudience?: string; + /** + * @member {string} [wwwHomepage] The primary Web page. + */ + wwwHomepage?: string; +} + +/** + * @interface + * An interface representing ApplicationCreateParameters. + * Request parameters for creating a new application. + * + * @extends ApplicationBase + */ +export interface ApplicationCreateParameters extends ApplicationBase { + /** + * @member {string} displayName The display name of the application. + */ + displayName: string; + /** + * @member {string[]} identifierUris A collection of URIs for the + * application. + */ + identifierUris: string[]; +} + +/** + * @interface + * An interface representing ApplicationUpdateParameters. + * Request parameters for updating a new application. + * + * @extends ApplicationBase + */ +export interface ApplicationUpdateParameters extends ApplicationBase { + /** + * @member {string} [displayName] The display name of the application. + */ + displayName?: string; + /** + * @member {string[]} [identifierUris] A collection of URIs for the + * application. + */ + identifierUris?: string[]; } /** @@ -398,6 +658,22 @@ export interface Application { * @member {string} [appId] The application ID. */ appId?: string; + /** + * @member {boolean} [allowGuestsSignIn] A property on the application to + * indicate if the application accepts other IDPs or not or partially + * accepts. + */ + allowGuestsSignIn?: boolean; + /** + * @member {boolean} [allowPassthroughUsers] Indicates that the application + * supports pass through users who have no presence in the resource tenant. + */ + allowPassthroughUsers?: boolean; + /** + * @member {string} [appLogoUrl] The url for the application logo image + * stored in a CDN. + */ + appLogoUrl?: string; /** * @member {AppRole[]} [appRoles] The collection of application roles that an * application may declare. These roles can be assigned to users, groups or @@ -409,7 +685,7 @@ export interface Application { */ appPermissions?: string[]; /** - * @member {boolean} [availableToOtherTenants] Whether the application is be + * @member {boolean} [availableToOtherTenants] Whether the application is * available to other tenants. */ availableToOtherTenants?: boolean; @@ -417,25 +693,108 @@ export interface Application { * @member {string} [displayName] The display name of the application. */ displayName?: string; + /** + * @member {string} [errorUrl] A URL provided by the author of the + * application to report errors when using the application. + */ + errorUrl?: string; + /** + * @member {string} [homepage] The home page of the application. + */ + homepage?: string; /** * @member {string[]} [identifierUris] A collection of URIs for the * application. */ identifierUris?: string[]; /** - * @member {string[]} [replyUrls] A collection of reply URLs for the - * application. + * @member {InformationalUrl} [informationalUrls] urls with more informations + * of the application. */ - replyUrls?: string[]; + informationalUrls?: InformationalUrl; /** - * @member {string} [homepage] The home page of the application. + * @member {boolean} [isDeviceOnlyAuthSupported] Specifies whether this + * application supports device authentication without a user. The default is + * false. */ - homepage?: string; + isDeviceOnlyAuthSupported?: boolean; + /** + * @member {KeyCredential[]} [keyCredentials] A collection of KeyCredential + * objects. + */ + keyCredentials?: KeyCredential[]; + /** + * @member {string[]} [knownClientApplications] Client applications that are + * tied to this resource application. Consent to any of the known client + * applications will result in implicit consent to the resource application + * through a combined consent dialog (showing the OAuth permission scopes + * required by the client and the resource). + */ + knownClientApplications?: string[]; + /** + * @member {string} [logoutUrl] the url of the logout page + */ + logoutUrl?: string; /** * @member {boolean} [oauth2AllowImplicitFlow] Whether to allow implicit * grant flow for OAuth2 */ oauth2AllowImplicitFlow?: boolean; + /** + * @member {boolean} [oauth2AllowUrlPathMatching] Specifies whether during a + * token Request Azure AD will allow path matching of the redirect URI + * against the applications collection of replyURLs. The default is false. + */ + oauth2AllowUrlPathMatching?: boolean; + /** + * @member {OAuth2Permission[]} [oauth2Permissions] The collection of OAuth + * 2.0 permission scopes that the web API (resource) application exposes to + * client applications. These permission scopes may be granted to client + * applications during consent. + */ + oauth2Permissions?: OAuth2Permission[]; + /** + * @member {boolean} [oauth2RequirePostResponse] Specifies whether, as part + * of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed + * to GET requests. The default is false, which specifies that only GET + * requests will be allowed. + */ + oauth2RequirePostResponse?: boolean; + /** + * @member {string[]} [orgRestrictions] A list of tenants allowed to access + * application. + */ + orgRestrictions?: string[]; + /** + * @member {OptionalClaims} [optionalClaims] + */ + optionalClaims?: OptionalClaims; + /** + * @member {PasswordCredential[]} [passwordCredentials] A collection of + * PasswordCredential objects + */ + passwordCredentials?: PasswordCredential[]; + /** + * @member {PreAuthorizedApplication[]} [preAuthorizedApplications] list of + * pre-authorizaed applications. + */ + preAuthorizedApplications?: PreAuthorizedApplication[]; + /** + * @member {boolean} [publicClient] Specifies whether this application is a + * public client (such as an installed application running on a mobile + * device). Default is false. + */ + publicClient?: boolean; + /** + * @member {string} [publisherDomain] Reliable domain which can be used to + * identify an application. + */ + publisherDomain?: string; + /** + * @member {string[]} [replyUrls] A collection of reply URLs for the + * application. + */ + replyUrls?: string[]; /** * @member {RequiredResourceAccess[]} [requiredResourceAccess] Specifies * resources that this application requires access to and the set of OAuth @@ -444,6 +803,21 @@ export interface Application { * consent experience. */ requiredResourceAccess?: RequiredResourceAccess[]; + /** + * @member {string} [samlMetadataUrl] The URL to the SAML metadata for the + * application. + */ + samlMetadataUrl?: string; + /** + * @member {string} [signInAudience] Audience for signing in to the + * application (AzureADMyOrganizatio, AzureADAllorganizations, + * AzureADAndMicrosofAccounts). + */ + signInAudience?: string; + /** + * @member {string} [wwwHomepage] The primary Web page. + */ + wwwHomepage?: string; } /** @@ -651,195 +1025,195 @@ export interface CheckGroupMembershipResult { /** * @interface - * An interface representing ServicePrincipalCreateParameters. - * Request parameters for creating a new service principal. + * An interface representing ServicePrincipalBase. + * Active Directory service principal common perperties shared among GET, POST + * and PATCH * */ -export interface ServicePrincipalCreateParameters { - /** - * @member {boolean} [accountEnabled] Whether the account is enabled - */ - accountEnabled?: boolean; +export interface ServicePrincipalBase { /** - * @member {string} appId application Id - */ - appId: string; - /** - * @member {boolean} [appRoleAssignmentRequired] Specifies whether an - * AppRoleAssignment to a user or group is required before Azure AD will - * issue a user or access token to the application. - */ - appRoleAssignmentRequired?: boolean; - /** - * @member {string} [displayName] The display name for the service principal. - */ - displayName?: string; - /** - * @member {string} [errorUrl] - */ - errorUrl?: string; - /** - * @member {string} [homepage] The URL to the homepage of the associated - * application. - */ - homepage?: string; - /** - * @member {KeyCredential[]} [keyCredentials] A collection of KeyCredential - * objects. + * @member {KeyCredential[]} [keyCredentials] The collection of key + * credentials associated with the service principal. */ keyCredentials?: KeyCredential[]; /** - * @member {PasswordCredential[]} [passwordCredentials] A collection of - * PasswordCredential objects + * @member {PasswordCredential[]} [passwordCredentials] The collection of + * password credentials associated with the service principal. */ passwordCredentials?: PasswordCredential[]; /** - * @member {string} [publisherName] The display name of the tenant in which - * the associated application is specified. - */ - publisherName?: string; - /** - * @member {string[]} [replyUrls] A collection of reply URLs for the service - * principal. + * @member {string} [servicePrincipalType] the type of the servie principal */ - replyUrls?: string[]; + servicePrincipalType?: string; /** - * @member {string} [samlMetadataUrl] + * @member {string} [accountEnabled] whether or not the service principal + * account is enabled */ - samlMetadataUrl?: string; - /** - * @member {string[]} [servicePrincipalNames] A collection of service - * principal names. - */ - servicePrincipalNames?: string[]; + accountEnabled?: string; /** - * @member {string[]} [tags] + * @member {string[]} [tags] Optional list of tags that you can apply to your + * service principals. Not nullable. */ tags?: string[]; +} + +/** + * @interface + * An interface representing ServicePrincipalCreateParameters. + * Request parameters for creating a new service principal. + * + * @extends ServicePrincipalBase + */ +export interface ServicePrincipalCreateParameters extends ServicePrincipalBase { /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. + * @member {string} appId The application ID. */ - [property: string]: any; + appId: string; } /** * @interface * An interface representing ServicePrincipalUpdateParameters. - * Request parameters for creating a new service principal. + * Request parameters for update an existing service principal. * + * @extends ServicePrincipalBase */ -export interface ServicePrincipalUpdateParameters { +export interface ServicePrincipalUpdateParameters extends ServicePrincipalBase { +} + +/** + * @interface + * An interface representing ServicePrincipal. + * Active Directory service principal information. + * + */ +export interface ServicePrincipal { /** - * @member {boolean} [accountEnabled] Whether the account is enabled + * @member {string} objectType Polymorphic Discriminator */ - accountEnabled?: boolean; + objectType: "ServicePrincipal"; /** - * @member {string} [appId] application Id + * @member {string} [objectId] The object ID. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** */ - appId?: string; + readonly objectId?: string; /** - * @member {boolean} [appRoleAssignmentRequired] Specifies whether an - * AppRoleAssignment to a user or group is required before Azure AD will - * issue a user or access token to the application. + * @member {Date} [deletionTimestamp] The time at which the directory object + * was deleted. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** */ - appRoleAssignmentRequired?: boolean; + readonly deletionTimestamp?: Date; /** - * @member {string} [displayName] The display name for the service principal. + * @member {string} [accountEnabled] whether or not the service principal + * account is enabled */ - displayName?: string; + accountEnabled?: string; /** - * @member {string} [errorUrl] + * @member {string[]} [alternativeNames] altenative names */ - errorUrl?: string; + alternativeNames?: string[]; /** - * @member {string} [homepage] The URL to the homepage of the associated - * application. + * @member {string} [appDisplayName] The display name exposed by the + * associated application. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** */ - homepage?: string; + readonly appDisplayName?: string; /** - * @member {KeyCredential[]} [keyCredentials] A collection of KeyCredential - * objects. + * @member {string} [appId] The application ID. */ - keyCredentials?: KeyCredential[]; + appId?: string; /** - * @member {PasswordCredential[]} [passwordCredentials] A collection of - * PasswordCredential objects + * @member {string} [appOwnerTenantId] **NOTE: This property will not be + * serialized. It can only be populated by the server.** */ - passwordCredentials?: PasswordCredential[]; + readonly appOwnerTenantId?: string; /** - * @member {string} [publisherName] The display name of the tenant in which - * the associated application is specified. + * @member {boolean} [appRoleAssignmentRequired] Specifies whether an + * AppRoleAssignment to a user or group is required before Azure AD will + * issue a user or access token to the application. */ - publisherName?: string; + appRoleAssignmentRequired?: boolean; /** - * @member {string[]} [replyUrls] A collection of reply URLs for the service - * principal. + * @member {AppRole[]} [appRoles] The collection of application roles that an + * application may declare. These roles can be assigned to users, groups or + * service principals. */ - replyUrls?: string[]; + appRoles?: AppRole[]; /** - * @member {string} [samlMetadataUrl] + * @member {string} [displayName] The display name of the service principal. */ - samlMetadataUrl?: string; + displayName?: string; /** - * @member {string[]} [servicePrincipalNames] A collection of service - * principal names. + * @member {string} [errorUrl] A URL provided by the author of the associated + * application to report errors when using the application. */ - servicePrincipalNames?: string[]; + errorUrl?: string; /** - * @member {string[]} [tags] + * @member {string} [homepage] The URL to the homepage of the associated + * application. */ - tags?: string[]; + homepage?: string; /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. + * @member {KeyCredential[]} [keyCredentials] The collection of key + * credentials associated with the service principal. */ - [property: string]: any; -} - -/** - * @interface - * An interface representing ServicePrincipal. - * Active Directory service principal information. - * - */ -export interface ServicePrincipal { + keyCredentials?: KeyCredential[]; /** - * @member {string} objectType Polymorphic Discriminator + * @member {string} [logoutUrl] A URL provided by the author of the + * associated application to logout */ - objectType: "ServicePrincipal"; + logoutUrl?: string; /** - * @member {string} [objectId] The object ID. + * @member {OAuth2Permission[]} [oauth2Permissions] The OAuth 2.0 permissions + * exposed by the associated application. * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ - readonly objectId?: string; + readonly oauth2Permissions?: OAuth2Permission[]; /** - * @member {Date} [deletionTimestamp] The time at which the directory object - * was deleted. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * @member {PasswordCredential[]} [passwordCredentials] The collection of + * password credentials associated with the service principal. */ - readonly deletionTimestamp?: Date; + passwordCredentials?: PasswordCredential[]; /** - * @member {string} [displayName] The display name of the service principal. + * @member {string} [preferredTokenSigningKeyThumbprint] The thubmbprint of + * preferred certificate to sign the token */ - displayName?: string; + preferredTokenSigningKeyThumbprint?: string; /** - * @member {string} [appId] The application ID. + * @member {string} [publisherName] The publisher's name of the associated + * application */ - appId?: string; + publisherName?: string; /** - * @member {AppRole[]} [appRoles] The collection of application roles that an - * application may declare. These roles can be assigned to users, groups or - * service principals. + * @member {string[]} [replyUrls] The URLs that user tokens are sent to for + * sign in with the associated application. The redirect URIs that the oAuth + * 2.0 authorization code and access tokens are sent to for the associated + * application. */ - appRoles?: AppRole[]; + replyUrls?: string[]; + /** + * @member {string} [samlMetadataUrl] The URL to the SAML metadata of the + * associated application + */ + samlMetadataUrl?: string; /** * @member {string[]} [servicePrincipalNames] A collection of service * principal names. */ servicePrincipalNames?: string[]; + /** + * @member {string} [servicePrincipalType] the type of the servie principal + */ + servicePrincipalType?: string; + /** + * @member {string[]} [tags] Optional list of tags that you can apply to your + * service principals. Not nullable. + */ + tags?: string[]; } /** @@ -1176,6 +1550,10 @@ export interface Permissions { * associated with the app */ clientId?: string; + /** + * @member {string} [objectId] The objectId of the permission grant + */ + objectId?: string; /** * @member {string} [consentType] Typically set to AllPrincipals */ @@ -1312,7 +1690,7 @@ export interface OAuth2GetOptionalParams extends msRest.RequestOptionsBase { export interface OAuth2GrantOptionalParams extends msRest.RequestOptionsBase { /** * @member {Permissions} [body] The relevant app Service Principal Object Id - * and the Service Principal Objecit Id you want to grant. + * and the Service Principal Object Id you want to grant. */ body?: Permissions; } @@ -1450,6 +1828,20 @@ export interface UserGetMemberGroupsResult extends Array { export interface DomainListResult extends Array { } +/** + * @interface + * An interface representing the PermissionsListResult. + * Server response for get permissions grants + * + * @extends Array + */ +export interface PermissionsListResult extends Array { + /** + * @member {string} [odatanextLink] the URL to get the next set of results. + */ + odatanextLink?: string; +} + /** * Defines values for UserType. * Possible values include: 'Member', 'Guest' @@ -2240,7 +2632,7 @@ export type DomainsGetResponse = Domain & { /** * Contains response data for the get operation. */ -export type OAuth2GetResponse = Permissions & { +export type OAuth2GetResponse = PermissionsListResult & { /** * The underlying HTTP response. */ @@ -2252,7 +2644,7 @@ export type OAuth2GetResponse = Permissions & { /** * The response body as parsed JSON or XML */ - parsedBody: Permissions; + parsedBody: PermissionsListResult; }; }; @@ -2274,3 +2666,22 @@ export type OAuth2GrantResponse = Permissions & { parsedBody: Permissions; }; }; + +/** + * Contains response data for the getNext operation. + */ +export type OAuth2GetNextResponse = PermissionsListResult & { + /** + * 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: PermissionsListResult; + }; +}; diff --git a/packages/@azure/graph/lib/models/mappers.ts b/packages/@azure/graph/lib/models/mappers.ts index 7022f2da87d4..f335b625bcca 100644 --- a/packages/@azure/graph/lib/models/mappers.ts +++ b/packages/@azure/graph/lib/models/mappers.ts @@ -14,6 +14,266 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; +export const InformationalUrl: msRest.CompositeMapper = { + serializedName: "InformationalUrl", + type: { + name: "Composite", + className: "InformationalUrl", + modelProperties: { + termsOfService: { + serializedName: "termsOfService", + type: { + name: "String" + } + }, + marketing: { + serializedName: "marketing", + type: { + name: "String" + } + }, + privacy: { + serializedName: "privacy", + type: { + name: "String" + } + }, + support: { + serializedName: "support", + type: { + name: "String" + } + } + } + } +}; + +export const OAuth2Permission: msRest.CompositeMapper = { + serializedName: "OAuth2Permission", + type: { + name: "Composite", + className: "OAuth2Permission", + modelProperties: { + adminConsentDescription: { + serializedName: "adminConsentDescription", + type: { + name: "String" + } + }, + adminConsentDisplayName: { + serializedName: "adminConsentDisplayName", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + isEnabled: { + serializedName: "isEnabled", + type: { + name: "Boolean" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + userConsentDescription: { + serializedName: "userConsentDescription", + type: { + name: "String" + } + }, + userConsentDisplayName: { + serializedName: "userConsentDisplayName", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const OptionalClaim: msRest.CompositeMapper = { + serializedName: "OptionalClaim", + type: { + name: "Composite", + className: "OptionalClaim", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + source: { + serializedName: "source", + type: { + name: "String" + } + }, + essential: { + serializedName: "essential", + type: { + name: "Boolean" + } + }, + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "Object" + } + } + } + } +}; + +export const OptionalClaims: msRest.CompositeMapper = { + serializedName: "OptionalClaims", + type: { + name: "Composite", + className: "OptionalClaims", + modelProperties: { + idToken: { + serializedName: "idToken", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OptionalClaim" + } + } + } + }, + accessToken: { + serializedName: "accessToken", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OptionalClaim" + } + } + } + }, + samlToken: { + serializedName: "samlToken", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OptionalClaim" + } + } + } + } + } + } +}; + +export const PreAuthorizedApplicationPermission: msRest.CompositeMapper = { + serializedName: "PreAuthorizedApplicationPermission", + type: { + name: "Composite", + className: "PreAuthorizedApplicationPermission", + modelProperties: { + directAccessGrant: { + serializedName: "directAccessGrant", + type: { + name: "Boolean" + } + }, + accessGrants: { + serializedName: "accessGrants", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const PreAuthorizedApplicationExtension: msRest.CompositeMapper = { + serializedName: "PreAuthorizedApplicationExtension", + type: { + name: "Composite", + className: "PreAuthorizedApplicationExtension", + modelProperties: { + conditions: { + serializedName: "conditions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const PreAuthorizedApplication: msRest.CompositeMapper = { + serializedName: "PreAuthorizedApplication", + type: { + name: "Composite", + className: "PreAuthorizedApplication", + modelProperties: { + appId: { + serializedName: "appId", + type: { + name: "String" + } + }, + permissions: { + serializedName: "permissions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PreAuthorizedApplicationPermission" + } + } + } + }, + extensions: { + serializedName: "extensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PreAuthorizedApplicationExtension" + } + } + } + } + } + } +}; + export const GraphError: msRest.CompositeMapper = { serializedName: "GraphError", type: { @@ -122,7 +382,7 @@ export const KeyCredential: msRest.CompositeMapper = { customKeyIdentifier: { serializedName: "customKeyIdentifier", type: { - name: "ByteArray" + name: "String" } } }, @@ -163,6 +423,12 @@ export const PasswordCredential: msRest.CompositeMapper = { type: { name: "String" } + }, + customKeyIdentifier: { + serializedName: "customKeyIdentifier", + type: { + name: "ByteArray" + } } }, additionalProperties: { @@ -291,12 +557,30 @@ export const AppRole: msRest.CompositeMapper = { } }; -export const ApplicationCreateParameters: msRest.CompositeMapper = { - serializedName: "ApplicationCreateParameters", +export const ApplicationBase: msRest.CompositeMapper = { + serializedName: "ApplicationBase", type: { name: "Composite", - className: "ApplicationCreateParameters", + className: "ApplicationBase", modelProperties: { + allowGuestsSignIn: { + serializedName: "allowGuestsSignIn", + type: { + name: "Boolean" + } + }, + allowPassthroughUsers: { + serializedName: "allowPassthroughUsers", + type: { + name: "Boolean" + } + }, + appLogoUrl: { + serializedName: "appLogoUrl", + type: { + name: "String" + } + }, appRoles: { serializedName: "appRoles", type: { @@ -309,16 +593,25 @@ export const ApplicationCreateParameters: msRest.CompositeMapper = { } } }, + appPermissions: { + serializedName: "appPermissions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, availableToOtherTenants: { - required: true, serializedName: "availableToOtherTenants", type: { name: "Boolean" } }, - displayName: { - required: true, - serializedName: "displayName", + errorUrl: { + serializedName: "errorUrl", type: { name: "String" } @@ -329,27 +622,17 @@ export const ApplicationCreateParameters: msRest.CompositeMapper = { name: "String" } }, - identifierUris: { - required: true, - serializedName: "identifierUris", + informationalUrls: { + serializedName: "informationalUrls", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "Composite", + className: "InformationalUrl" } }, - replyUrls: { - serializedName: "replyUrls", + isDeviceOnlyAuthSupported: { + serializedName: "isDeviceOnlyAuthSupported", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "Boolean" } }, keyCredentials: { @@ -369,102 +652,112 @@ export const ApplicationCreateParameters: msRest.CompositeMapper = { } } }, - passwordCredentials: { - serializedName: "passwordCredentials", + knownClientApplications: { + serializedName: "knownClientApplications", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "PasswordCredential", - additionalProperties: { - type: { - name: "Object" - } - } + name: "String" } } } }, + logoutUrl: { + serializedName: "logoutUrl", + type: { + name: "String" + } + }, oauth2AllowImplicitFlow: { serializedName: "oauth2AllowImplicitFlow", type: { name: "Boolean" } }, - requiredResourceAccess: { - serializedName: "requiredResourceAccess", + oauth2AllowUrlPathMatching: { + serializedName: "oauth2AllowUrlPathMatching", + type: { + name: "Boolean" + } + }, + oauth2Permissions: { + serializedName: "oauth2Permissions", type: { name: "Sequence", element: { type: { name: "Composite", - className: "RequiredResourceAccess", - additionalProperties: { - type: { - name: "Object" - } - } + className: "OAuth2Permission" } } } - } - }, - additionalProperties: { - type: { - name: "Object" - } - } - } -}; - -export const ApplicationUpdateParameters: msRest.CompositeMapper = { - serializedName: "ApplicationUpdateParameters", - type: { - name: "Composite", - className: "ApplicationUpdateParameters", - modelProperties: { - appRoles: { - serializedName: "appRoles", + }, + oauth2RequirePostResponse: { + serializedName: "oauth2RequirePostResponse", + type: { + name: "Boolean" + } + }, + orgRestrictions: { + serializedName: "orgRestrictions", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "AppRole" + name: "String" } } } }, - availableToOtherTenants: { - serializedName: "availableToOtherTenants", + optionalClaims: { + serializedName: "optionalClaims", type: { - name: "Boolean" - } - }, - displayName: { - serializedName: "displayName", - type: { - name: "String" + name: "Composite", + className: "OptionalClaims" } }, - homepage: { - serializedName: "homepage", + passwordCredentials: { + serializedName: "passwordCredentials", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PasswordCredential", + additionalProperties: { + type: { + name: "Object" + } + } + } + } } }, - identifierUris: { - serializedName: "identifierUris", + preAuthorizedApplications: { + serializedName: "preAuthorizedApplications", type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "PreAuthorizedApplication" } } } }, + publicClient: { + serializedName: "publicClient", + type: { + name: "Boolean" + } + }, + publisherDomain: { + serializedName: "publisherDomain", + type: { + name: "String" + } + }, replyUrls: { serializedName: "replyUrls", type: { @@ -476,14 +769,14 @@ export const ApplicationUpdateParameters: msRest.CompositeMapper = { } } }, - keyCredentials: { - serializedName: "keyCredentials", + requiredResourceAccess: { + serializedName: "requiredResourceAccess", type: { name: "Sequence", element: { type: { name: "Composite", - className: "KeyCredential", + className: "RequiredResourceAccess", additionalProperties: { type: { name: "Object" @@ -493,51 +786,82 @@ export const ApplicationUpdateParameters: msRest.CompositeMapper = { } } }, - passwordCredentials: { - serializedName: "passwordCredentials", + samlMetadataUrl: { + serializedName: "samlMetadataUrl", + type: { + name: "String" + } + }, + signInAudience: { + serializedName: "signInAudience", + type: { + name: "String" + } + }, + wwwHomepage: { + serializedName: "wwwHomepage", + type: { + name: "String" + } + } + } + } +}; + +export const ApplicationCreateParameters: msRest.CompositeMapper = { + serializedName: "ApplicationCreateParameters", + type: { + name: "Composite", + className: "ApplicationCreateParameters", + modelProperties: { + ...ApplicationBase.type.modelProperties, + displayName: { + required: true, + serializedName: "displayName", + type: { + name: "String" + } + }, + identifierUris: { + required: true, + serializedName: "identifierUris", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "PasswordCredential", - additionalProperties: { - type: { - name: "Object" - } - } + name: "String" } } } - }, - oauth2AllowImplicitFlow: { - serializedName: "oauth2AllowImplicitFlow", + } + } + } +}; + +export const ApplicationUpdateParameters: msRest.CompositeMapper = { + serializedName: "ApplicationUpdateParameters", + type: { + name: "Composite", + className: "ApplicationUpdateParameters", + modelProperties: { + ...ApplicationBase.type.modelProperties, + displayName: { + serializedName: "displayName", type: { - name: "Boolean" + name: "String" } }, - requiredResourceAccess: { - serializedName: "requiredResourceAccess", + identifierUris: { + serializedName: "identifierUris", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "RequiredResourceAccess", - additionalProperties: { - type: { - name: "Object" - } - } + name: "String" } } } } - }, - additionalProperties: { - type: { - name: "Object" - } } } }; @@ -557,6 +881,24 @@ export const Application: msRest.CompositeMapper = { name: "String" } }, + allowGuestsSignIn: { + serializedName: "allowGuestsSignIn", + type: { + name: "Boolean" + } + }, + allowPassthroughUsers: { + serializedName: "allowPassthroughUsers", + type: { + name: "Boolean" + } + }, + appLogoUrl: { + serializedName: "appLogoUrl", + type: { + name: "String" + } + }, appRoles: { serializedName: "appRoles", type: { @@ -592,6 +934,18 @@ export const Application: msRest.CompositeMapper = { name: "String" } }, + errorUrl: { + serializedName: "errorUrl", + type: { + name: "String" + } + }, + homepage: { + serializedName: "homepage", + type: { + name: "String" + } + }, identifierUris: { serializedName: "identifierUris", type: { @@ -603,8 +957,38 @@ export const Application: msRest.CompositeMapper = { } } }, - replyUrls: { - serializedName: "replyUrls", + informationalUrls: { + serializedName: "informationalUrls", + type: { + name: "Composite", + className: "InformationalUrl" + } + }, + isDeviceOnlyAuthSupported: { + serializedName: "isDeviceOnlyAuthSupported", + type: { + name: "Boolean" + } + }, + keyCredentials: { + serializedName: "keyCredentials", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "KeyCredential", + additionalProperties: { + type: { + name: "Object" + } + } + } + } + } + }, + knownClientApplications: { + serializedName: "knownClientApplications", type: { name: "Sequence", element: { @@ -614,8 +998,8 @@ export const Application: msRest.CompositeMapper = { } } }, - homepage: { - serializedName: "homepage", + logoutUrl: { + serializedName: "logoutUrl", type: { name: "String" } @@ -623,7 +1007,101 @@ export const Application: msRest.CompositeMapper = { oauth2AllowImplicitFlow: { serializedName: "oauth2AllowImplicitFlow", type: { - name: "Boolean" + name: "Boolean" + } + }, + oauth2AllowUrlPathMatching: { + serializedName: "oauth2AllowUrlPathMatching", + type: { + name: "Boolean" + } + }, + oauth2Permissions: { + serializedName: "oauth2Permissions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OAuth2Permission" + } + } + } + }, + oauth2RequirePostResponse: { + serializedName: "oauth2RequirePostResponse", + type: { + name: "Boolean" + } + }, + orgRestrictions: { + serializedName: "orgRestrictions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + optionalClaims: { + serializedName: "optionalClaims", + type: { + name: "Composite", + className: "OptionalClaims" + } + }, + passwordCredentials: { + serializedName: "passwordCredentials", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PasswordCredential", + additionalProperties: { + type: { + name: "Object" + } + } + } + } + } + }, + preAuthorizedApplications: { + serializedName: "preAuthorizedApplications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PreAuthorizedApplication" + } + } + } + }, + publicClient: { + serializedName: "publicClient", + type: { + name: "Boolean" + } + }, + publisherDomain: { + serializedName: "publisherDomain", + type: { + name: "String" + } + }, + replyUrls: { + serializedName: "replyUrls", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, requiredResourceAccess: { @@ -642,6 +1120,24 @@ export const Application: msRest.CompositeMapper = { } } } + }, + samlMetadataUrl: { + serializedName: "samlMetadataUrl", + type: { + name: "String" + } + }, + signInAudience: { + serializedName: "signInAudience", + type: { + name: "String" + } + }, + wwwHomepage: { + serializedName: "wwwHomepage", + type: { + name: "String" + } } }, additionalProperties: DirectoryObject.type.additionalProperties @@ -911,49 +1407,12 @@ export const CheckGroupMembershipResult: msRest.CompositeMapper = { } }; -export const ServicePrincipalCreateParameters: msRest.CompositeMapper = { - serializedName: "ServicePrincipalCreateParameters", +export const ServicePrincipalBase: msRest.CompositeMapper = { + serializedName: "ServicePrincipalBase", type: { name: "Composite", - className: "ServicePrincipalCreateParameters", + className: "ServicePrincipalBase", modelProperties: { - accountEnabled: { - serializedName: "accountEnabled", - type: { - name: "Boolean" - } - }, - appId: { - required: true, - serializedName: "appId", - type: { - name: "String" - } - }, - appRoleAssignmentRequired: { - serializedName: "appRoleAssignmentRequired", - type: { - name: "Boolean" - } - }, - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - }, - errorUrl: { - serializedName: "errorUrl", - type: { - name: "String" - } - }, - homepage: { - serializedName: "homepage", - type: { - name: "String" - } - }, keyCredentials: { serializedName: "keyCredentials", type: { @@ -988,40 +1447,18 @@ export const ServicePrincipalCreateParameters: msRest.CompositeMapper = { } } }, - publisherName: { - serializedName: "publisherName", + servicePrincipalType: { + serializedName: "servicePrincipalType", type: { name: "String" } }, - replyUrls: { - serializedName: "replyUrls", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - samlMetadataUrl: { - serializedName: "samlMetadataUrl", + accountEnabled: { + serializedName: "accountEnabled", type: { name: "String" } }, - servicePrincipalNames: { - serializedName: "servicePrincipalNames", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, tags: { serializedName: "tags", type: { @@ -1033,10 +1470,23 @@ export const ServicePrincipalCreateParameters: msRest.CompositeMapper = { } } } - }, - additionalProperties: { - type: { - name: "Object" + } + } +}; + +export const ServicePrincipalCreateParameters: msRest.CompositeMapper = { + serializedName: "ServicePrincipalCreateParameters", + type: { + name: "Composite", + className: "ServicePrincipalCreateParameters", + modelProperties: { + ...ServicePrincipalBase.type.modelProperties, + appId: { + required: true, + serializedName: "appId", + type: { + name: "String" + } } } } @@ -1048,10 +1498,42 @@ export const ServicePrincipalUpdateParameters: msRest.CompositeMapper = { name: "Composite", className: "ServicePrincipalUpdateParameters", modelProperties: { + ...ServicePrincipalBase.type.modelProperties + } + } +}; + +export const ServicePrincipal: msRest.CompositeMapper = { + serializedName: "ServicePrincipal", + type: { + name: "Composite", + polymorphicDiscriminator: DirectoryObject.type.polymorphicDiscriminator, + uberParent: "DirectoryObject", + className: "ServicePrincipal", + modelProperties: { + ...DirectoryObject.type.modelProperties, accountEnabled: { serializedName: "accountEnabled", type: { - name: "Boolean" + name: "String" + } + }, + alternativeNames: { + serializedName: "alternativeNames", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + appDisplayName: { + readOnly: true, + serializedName: "appDisplayName", + type: { + name: "String" } }, appId: { @@ -1060,12 +1542,31 @@ export const ServicePrincipalUpdateParameters: msRest.CompositeMapper = { name: "String" } }, + appOwnerTenantId: { + readOnly: true, + serializedName: "appOwnerTenantId", + type: { + name: "String" + } + }, appRoleAssignmentRequired: { serializedName: "appRoleAssignmentRequired", type: { name: "Boolean" } }, + appRoles: { + serializedName: "appRoles", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AppRole" + } + } + } + }, displayName: { serializedName: "displayName", type: { @@ -1101,6 +1602,25 @@ export const ServicePrincipalUpdateParameters: msRest.CompositeMapper = { } } }, + logoutUrl: { + serializedName: "logoutUrl", + type: { + name: "String" + } + }, + oauth2Permissions: { + readOnly: true, + serializedName: "oauth2Permissions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OAuth2Permission" + } + } + } + }, passwordCredentials: { serializedName: "passwordCredentials", type: { @@ -1118,6 +1638,12 @@ export const ServicePrincipalUpdateParameters: msRest.CompositeMapper = { } } }, + preferredTokenSigningKeyThumbprint: { + serializedName: "preferredTokenSigningKeyThumbprint", + type: { + name: "String" + } + }, publisherName: { serializedName: "publisherName", type: { @@ -1152,61 +1678,14 @@ export const ServicePrincipalUpdateParameters: msRest.CompositeMapper = { } } }, - tags: { - serializedName: "tags", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - }, - additionalProperties: { - type: { - name: "Object" - } - } - } -}; - -export const ServicePrincipal: msRest.CompositeMapper = { - serializedName: "ServicePrincipal", - type: { - name: "Composite", - polymorphicDiscriminator: DirectoryObject.type.polymorphicDiscriminator, - uberParent: "DirectoryObject", - className: "ServicePrincipal", - modelProperties: { - ...DirectoryObject.type.modelProperties, - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - }, - appId: { - serializedName: "appId", + servicePrincipalType: { + serializedName: "servicePrincipalType", type: { name: "String" } }, - appRoles: { - serializedName: "appRoles", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AppRole" - } - } - } - }, - servicePrincipalNames: { - serializedName: "servicePrincipalNames", + tags: { + serializedName: "tags", type: { name: "Sequence", element: { @@ -1645,6 +2124,12 @@ export const Permissions: msRest.CompositeMapper = { name: "String" } }, + objectId: { + serializedName: "objectId", + type: { + name: "String" + } + }, consentType: { serializedName: "consentType", type: { @@ -1957,6 +2442,34 @@ export const DomainListResult: msRest.CompositeMapper = { } }; +export const PermissionsListResult: msRest.CompositeMapper = { + serializedName: "PermissionsListResult", + type: { + name: "Composite", + className: "PermissionsListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Permissions" + } + } + } + }, + odatanextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + export const discriminators = { 'DirectoryObject' : DirectoryObject, 'DirectoryObject.Application' : Application, diff --git a/packages/@azure/graph/lib/models/oAuth2Mappers.ts b/packages/@azure/graph/lib/models/oAuth2Mappers.ts index 1270ee3a6e68..9744b0e5c30a 100644 --- a/packages/@azure/graph/lib/models/oAuth2Mappers.ts +++ b/packages/@azure/graph/lib/models/oAuth2Mappers.ts @@ -10,7 +10,9 @@ export { discriminators, + PermissionsListResult, Permissions, - CloudError + CloudError, + GraphError } from "../models/mappers"; diff --git a/packages/@azure/graph/lib/models/objectsMappers.ts b/packages/@azure/graph/lib/models/objectsMappers.ts index 48ec347b8ac6..b1f0869ea6d0 100644 --- a/packages/@azure/graph/lib/models/objectsMappers.ts +++ b/packages/@azure/graph/lib/models/objectsMappers.ts @@ -16,6 +16,15 @@ export { CloudError, Application, AppRole, + InformationalUrl, + KeyCredential, + OAuth2Permission, + OptionalClaims, + OptionalClaim, + PasswordCredential, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, ADGroup, diff --git a/packages/@azure/graph/lib/models/servicePrincipalsMappers.ts b/packages/@azure/graph/lib/models/servicePrincipalsMappers.ts index 8d81554f24cd..4822d3a57756 100644 --- a/packages/@azure/graph/lib/models/servicePrincipalsMappers.ts +++ b/packages/@azure/graph/lib/models/servicePrincipalsMappers.ts @@ -11,11 +11,13 @@ export { discriminators, ServicePrincipalCreateParameters, + ServicePrincipalBase, KeyCredential, PasswordCredential, ServicePrincipal, DirectoryObject, AppRole, + OAuth2Permission, GraphError, ServicePrincipalListResult, ServicePrincipalUpdateParameters, @@ -25,6 +27,12 @@ export { PasswordCredentialListResult, PasswordCredentialsUpdateParameters, Application, + InformationalUrl, + OptionalClaims, + OptionalClaim, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, ADGroup, diff --git a/packages/@azure/graph/lib/models/signedInUserMappers.ts b/packages/@azure/graph/lib/models/signedInUserMappers.ts index 8b06f0505013..23566a18bf11 100644 --- a/packages/@azure/graph/lib/models/signedInUserMappers.ts +++ b/packages/@azure/graph/lib/models/signedInUserMappers.ts @@ -17,6 +17,15 @@ export { DirectoryObjectListResult, Application, AppRole, + InformationalUrl, + KeyCredential, + OAuth2Permission, + OptionalClaims, + OptionalClaim, + PasswordCredential, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, ADGroup, diff --git a/packages/@azure/graph/lib/models/usersMappers.ts b/packages/@azure/graph/lib/models/usersMappers.ts index b5a83a95b4c9..6f30dccd8c46 100644 --- a/packages/@azure/graph/lib/models/usersMappers.ts +++ b/packages/@azure/graph/lib/models/usersMappers.ts @@ -23,6 +23,15 @@ export { UserGetMemberGroupsResult, Application, AppRole, + InformationalUrl, + KeyCredential, + OAuth2Permission, + OptionalClaims, + OptionalClaim, + PasswordCredential, + PreAuthorizedApplication, + PreAuthorizedApplicationPermission, + PreAuthorizedApplicationExtension, RequiredResourceAccess, ResourceAccess, ADGroup, diff --git a/packages/@azure/graph/lib/operations/oAuth2.ts b/packages/@azure/graph/lib/operations/oAuth2.ts index 4d14c94451bd..63f45b83ac56 100644 --- a/packages/@azure/graph/lib/operations/oAuth2.ts +++ b/packages/@azure/graph/lib/operations/oAuth2.ts @@ -27,7 +27,7 @@ export class OAuth2 { } /** - * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. * @param [options] The optional parameters * @returns Promise */ @@ -35,13 +35,13 @@ export class OAuth2 { /** * @param callback The callback */ - get(callback: msRest.ServiceCallback): void; + get(callback: msRest.ServiceCallback): void; /** * @param options The optional parameters * @param callback The callback */ - get(options: Models.OAuth2GetOptionalParams, callback: msRest.ServiceCallback): void; - get(options?: Models.OAuth2GetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get(options: Models.OAuth2GetOptionalParams, callback: msRest.ServiceCallback): void; + get(options?: Models.OAuth2GetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { options @@ -73,6 +73,62 @@ export class OAuth2 { grantOperationSpec, callback) as Promise; } + + /** + * Delete a OAuth2 permission grant for the relevant resource Ids of an app. + * @param objectId The object ID of a permission grant. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(objectId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param objectId The object ID of a permission grant. + * @param callback The callback + */ + deleteMethod(objectId: string, callback: msRest.ServiceCallback): void; + /** + * @param objectId The object ID of a permission grant. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(objectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(objectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + objectId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + getNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + getNext(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 + */ + getNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + getNextOperationSpec, + callback) as Promise; + } } // Operation Specifications @@ -92,7 +148,7 @@ const getOperationSpec: msRest.OperationSpec = { ], responses: { 200: { - bodyMapper: Mappers.Permissions + bodyMapper: Mappers.PermissionsListResult }, default: { bodyMapper: Mappers.CloudError @@ -130,3 +186,46 @@ const grantOperationSpec: msRest.OperationSpec = { }, serializer }; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "{tenantID}/oauth2PermissionGrants/{objectId}", + urlParameters: [ + Parameters.objectId, + Parameters.tenantID + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + serializer +}; + +const getNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://graph.windows.net", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PermissionsListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/packages/@azure/graph/package.json b/packages/@azure/graph/package.json index 27d4ee2f5b75..268a6918aae7 100644 --- a/packages/@azure/graph/package.json +++ b/packages/@azure/graph/package.json @@ -4,8 +4,8 @@ "description": "GraphRbacManagementClient Library with typescript type definitions for node.js and browser.", "version": "4.3.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.1.0", - "@azure/ms-rest-js": "^1.1.0", + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -23,6 +23,7 @@ "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/tree/master/packages/@azure/graph", @@ -51,6 +52,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/graph.js.map'\" -o ./dist/graph.min.js ./dist/graph.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "authPublish": true + "sideEffects": false } diff --git a/packages/@azure/graph/rollup.config.js b/packages/@azure/graph/rollup.config.js index ce8ffd7b2db8..8b52ed18d383 100644 --- a/packages/@azure/graph/rollup.config.js +++ b/packages/@azure/graph/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/graphRbacManagementClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/graphRbacManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/graph.js", format: "umd", @@ -16,16 +22,16 @@ const config = { }, banner: `/* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ module: true }), + sourcemaps() ] }; + export default config; From 4d0cb161a218a30483be3f16c9fc09c44e2294ee Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 10 Mar 2019 00:07:47 +0000 Subject: [PATCH 2/3] Generated from 2f2d0884b67b616ccdf637fb03dceec557a6e5ee clean up all --- .../graph/lib/graphRbacManagementClient.ts | 2 + packages/@azure/graph/lib/models/index.ts | 74 ++++++---- packages/@azure/graph/lib/models/mappers.ts | 16 +-- .../@azure/graph/lib/models/oAuth2Mappers.ts | 3 +- .../oAuth2PermissionGrantOperationsMappers.ts | 18 +++ packages/@azure/graph/lib/operations/index.ts | 1 + .../@azure/graph/lib/operations/oAuth2.ts | 107 +------------- .../oAuth2PermissionGrantOperations.ts | 130 ++++++++++++++++++ 8 files changed, 209 insertions(+), 142 deletions(-) create mode 100644 packages/@azure/graph/lib/models/oAuth2PermissionGrantOperationsMappers.ts create mode 100644 packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts diff --git a/packages/@azure/graph/lib/graphRbacManagementClient.ts b/packages/@azure/graph/lib/graphRbacManagementClient.ts index c9a03bdb6cf1..308fc28420af 100644 --- a/packages/@azure/graph/lib/graphRbacManagementClient.ts +++ b/packages/@azure/graph/lib/graphRbacManagementClient.ts @@ -25,6 +25,7 @@ class GraphRbacManagementClient extends GraphRbacManagementClientContext { users: operations.Users; objects: operations.Objects; domains: operations.Domains; + oAuth2PermissionGrant: operations.OAuth2PermissionGrantOperations; oAuth2: operations.OAuth2; /** @@ -43,6 +44,7 @@ class GraphRbacManagementClient extends GraphRbacManagementClientContext { this.users = new operations.Users(this); this.objects = new operations.Objects(this); this.domains = new operations.Domains(this); + this.oAuth2PermissionGrant = new operations.OAuth2PermissionGrantOperations(this); this.oAuth2 = new operations.OAuth2(this); } } diff --git a/packages/@azure/graph/lib/models/index.ts b/packages/@azure/graph/lib/models/index.ts index 5e067bc4a14d..cd53f3b7a5e0 100644 --- a/packages/@azure/graph/lib/models/index.ts +++ b/packages/@azure/graph/lib/models/index.ts @@ -1537,38 +1537,44 @@ export interface Domain { /** * @interface - * An interface representing Permissions. + * An interface representing OAuth2PermissionGrant. */ -export interface Permissions { +export interface OAuth2PermissionGrant { /** * @member {string} [odatatype] * Microsoft.DirectoryServices.OAuth2PermissionGrant */ odatatype?: string; /** - * @member {string} [clientId] The objectId of the Service Principal - * associated with the app + * @member {string} [clientId] The id of the resource's service principal + * granted consent to impersonate the user when accessing the resource + * (represented by the resourceId property). */ clientId?: string; /** - * @member {string} [objectId] The objectId of the permission grant + * @member {string} [objectId] The id of the permission grant */ objectId?: string; /** - * @member {string} [consentType] Typically set to AllPrincipals + * @member {ConsentType} [consentType] Indicates if consent was provided by + * the administrator (on behalf of the organization) or by an individual. + * Possible values include: 'AllPrincipals', 'Principal' */ - consentType?: string; + consentType?: ConsentType; /** - * @member {any} [principalId] Set to null if AllPrincipals is set + * @member {string} [principalId] When consent type is Principal, this + * property specifies the id of the user that granted consent and applies + * only for that user. */ - principalId?: any; + principalId?: string; /** - * @member {string} [resourceId] Service Principal Id of the resource you - * want to grant + * @member {string} [resourceId] Object Id of the resource you want to grant */ resourceId?: string; /** - * @member {string} [scope] Typically set to user_impersonation + * @member {string} [scope] Specifies the value of the scope claim that the + * resource application should expect in the OAuth 2.0 access token. For + * example, User.Read */ scope?: string; /** @@ -1667,12 +1673,12 @@ export interface DomainsListOptionalParams extends msRest.RequestOptionsBase { /** * @interface - * An interface representing OAuth2GetOptionalParams. + * An interface representing OAuth2PermissionGrantListOptionalParams. * Optional Parameters. * * @extends RequestOptionsBase */ -export interface OAuth2GetOptionalParams extends msRest.RequestOptionsBase { +export interface OAuth2PermissionGrantListOptionalParams extends msRest.RequestOptionsBase { /** * @member {string} [filter] This is the Service Principal ObjectId * associated with the app @@ -1689,10 +1695,10 @@ export interface OAuth2GetOptionalParams extends msRest.RequestOptionsBase { */ export interface OAuth2GrantOptionalParams extends msRest.RequestOptionsBase { /** - * @member {Permissions} [body] The relevant app Service Principal Object Id - * and the Service Principal Object Id you want to grant. + * @member {OAuth2PermissionGrant} [body] The relevant app Service Principal + * Object Id and the Service Principal Object Id you want to grant. */ - body?: Permissions; + body?: OAuth2PermissionGrant; } /** @@ -1830,12 +1836,12 @@ export interface DomainListResult extends Array { /** * @interface - * An interface representing the PermissionsListResult. - * Server response for get permissions grants + * An interface representing the OAuth2PermissionGrantListResult. + * Server response for get oauth2 permissions grants * - * @extends Array + * @extends Array */ -export interface PermissionsListResult extends Array { +export interface OAuth2PermissionGrantListResult extends Array { /** * @member {string} [odatanextLink] the URL to get the next set of results. */ @@ -1850,6 +1856,14 @@ export interface PermissionsListResult extends Array { */ export type UserType = 'Member' | 'Guest'; +/** + * Defines values for ConsentType. + * Possible values include: 'AllPrincipals', 'Principal' + * @readonly + * @enum {string} + */ +export type ConsentType = 'AllPrincipals' | 'Principal'; + /** * Contains response data for the get operation. */ @@ -2630,9 +2644,9 @@ export type DomainsGetResponse = Domain & { }; /** - * Contains response data for the get operation. + * Contains response data for the list operation. */ -export type OAuth2GetResponse = PermissionsListResult & { +export type OAuth2PermissionGrantListResponse = OAuth2PermissionGrantListResult & { /** * The underlying HTTP response. */ @@ -2644,14 +2658,14 @@ export type OAuth2GetResponse = PermissionsListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: PermissionsListResult; + parsedBody: OAuth2PermissionGrantListResult; }; }; /** - * Contains response data for the grant operation. + * Contains response data for the listNext operation. */ -export type OAuth2GrantResponse = Permissions & { +export type OAuth2PermissionGrantListNextResponse = OAuth2PermissionGrantListResult & { /** * The underlying HTTP response. */ @@ -2663,14 +2677,14 @@ export type OAuth2GrantResponse = Permissions & { /** * The response body as parsed JSON or XML */ - parsedBody: Permissions; + parsedBody: OAuth2PermissionGrantListResult; }; }; /** - * Contains response data for the getNext operation. + * Contains response data for the grant operation. */ -export type OAuth2GetNextResponse = PermissionsListResult & { +export type OAuth2GrantResponse = OAuth2PermissionGrant & { /** * The underlying HTTP response. */ @@ -2682,6 +2696,6 @@ export type OAuth2GetNextResponse = PermissionsListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: PermissionsListResult; + parsedBody: OAuth2PermissionGrant; }; }; diff --git a/packages/@azure/graph/lib/models/mappers.ts b/packages/@azure/graph/lib/models/mappers.ts index f335b625bcca..e55bf454ed9f 100644 --- a/packages/@azure/graph/lib/models/mappers.ts +++ b/packages/@azure/graph/lib/models/mappers.ts @@ -2106,11 +2106,11 @@ export const Domain: msRest.CompositeMapper = { } }; -export const Permissions: msRest.CompositeMapper = { - serializedName: "Permissions", +export const OAuth2PermissionGrant: msRest.CompositeMapper = { + serializedName: "OAuth2PermissionGrant", type: { name: "Composite", - className: "Permissions", + className: "OAuth2PermissionGrant", modelProperties: { odatatype: { serializedName: "odata\\.type", @@ -2139,7 +2139,7 @@ export const Permissions: msRest.CompositeMapper = { principalId: { serializedName: "principalId", type: { - name: "Object" + name: "String" } }, resourceId: { @@ -2442,11 +2442,11 @@ export const DomainListResult: msRest.CompositeMapper = { } }; -export const PermissionsListResult: msRest.CompositeMapper = { - serializedName: "PermissionsListResult", +export const OAuth2PermissionGrantListResult: msRest.CompositeMapper = { + serializedName: "OAuth2PermissionGrantListResult", type: { name: "Composite", - className: "PermissionsListResult", + className: "OAuth2PermissionGrantListResult", modelProperties: { value: { serializedName: "", @@ -2455,7 +2455,7 @@ export const PermissionsListResult: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "Permissions" + className: "OAuth2PermissionGrant" } } } diff --git a/packages/@azure/graph/lib/models/oAuth2Mappers.ts b/packages/@azure/graph/lib/models/oAuth2Mappers.ts index 9744b0e5c30a..1308464a36cb 100644 --- a/packages/@azure/graph/lib/models/oAuth2Mappers.ts +++ b/packages/@azure/graph/lib/models/oAuth2Mappers.ts @@ -10,8 +10,7 @@ export { discriminators, - PermissionsListResult, - Permissions, + OAuth2PermissionGrant, CloudError, GraphError } from "../models/mappers"; diff --git a/packages/@azure/graph/lib/models/oAuth2PermissionGrantOperationsMappers.ts b/packages/@azure/graph/lib/models/oAuth2PermissionGrantOperationsMappers.ts new file mode 100644 index 000000000000..f541c9cd9e14 --- /dev/null +++ b/packages/@azure/graph/lib/models/oAuth2PermissionGrantOperationsMappers.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 { + discriminators, + OAuth2PermissionGrantListResult, + OAuth2PermissionGrant, + CloudError, + GraphError +} from "../models/mappers"; + diff --git a/packages/@azure/graph/lib/operations/index.ts b/packages/@azure/graph/lib/operations/index.ts index eb96cda32036..2ba98d1bb68c 100644 --- a/packages/@azure/graph/lib/operations/index.ts +++ b/packages/@azure/graph/lib/operations/index.ts @@ -16,4 +16,5 @@ export * from "./servicePrincipals"; export * from "./users"; export * from "./objects"; export * from "./domains"; +export * from "./oAuth2PermissionGrantOperations"; export * from "./oAuth2"; diff --git a/packages/@azure/graph/lib/operations/oAuth2.ts b/packages/@azure/graph/lib/operations/oAuth2.ts index 63f45b83ac56..2140cf0751e2 100644 --- a/packages/@azure/graph/lib/operations/oAuth2.ts +++ b/packages/@azure/graph/lib/operations/oAuth2.ts @@ -26,30 +26,6 @@ export class OAuth2 { this.client = client; } - /** - * Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. - * @param [options] The optional parameters - * @returns Promise - */ - get(options?: Models.OAuth2GetOptionalParams): Promise; - /** - * @param callback The callback - */ - get(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - get(options: Models.OAuth2GetOptionalParams, callback: msRest.ServiceCallback): void; - get(options?: Models.OAuth2GetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - getOperationSpec, - callback) as Promise; - } - /** * Grants OAuth2 permissions for the relevant resource Ids of an app. * @param [options] The optional parameters @@ -59,13 +35,13 @@ export class OAuth2 { /** * @param callback The callback */ - grant(callback: msRest.ServiceCallback): void; + grant(callback: msRest.ServiceCallback): void; /** * @param options The optional parameters * @param callback The callback */ - grant(options: Models.OAuth2GrantOptionalParams, callback: msRest.ServiceCallback): void; - grant(options?: Models.OAuth2GrantOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + grant(options: Models.OAuth2GrantOptionalParams, callback: msRest.ServiceCallback): void; + grant(options?: Models.OAuth2GrantOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { options @@ -101,62 +77,10 @@ export class OAuth2 { deleteMethodOperationSpec, callback); } - - /** - * Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - getNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - getNext(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 - */ - getNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - getNextOperationSpec, - callback) as Promise; - } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{tenantID}/oauth2PermissionGrants", - urlParameters: [ - Parameters.tenantID - ], - queryParameters: [ - Parameters.filter, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PermissionsListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - const grantOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{tenantID}/oauth2PermissionGrants", @@ -174,11 +98,11 @@ const grantOperationSpec: msRest.OperationSpec = { "options", "body" ], - mapper: Mappers.Permissions + mapper: Mappers.OAuth2PermissionGrant }, responses: { 201: { - bodyMapper: Mappers.Permissions + bodyMapper: Mappers.OAuth2PermissionGrant }, default: { bodyMapper: Mappers.CloudError @@ -208,24 +132,3 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { }, serializer }; - -const getNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://graph.windows.net", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.PermissionsListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts b/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts new file mode 100644 index 000000000000..b617b947c9bb --- /dev/null +++ b/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts @@ -0,0 +1,130 @@ +/* + * 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/oAuth2PermissionGrantOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClientContext } from "../graphRbacManagementClientContext"; + +/** Class representing a OAuth2PermissionGrantOperations. */ +export class OAuth2PermissionGrantOperations { + private readonly client: GraphRbacManagementClientContext; + + /** + * Create a OAuth2PermissionGrantOperations. + * @param {GraphRbacManagementClientContext} client Reference to the service client. + */ + constructor(client: GraphRbacManagementClientContext) { + this.client = client; + } + + /** + * Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: Models.OAuth2PermissionGrantListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.OAuth2PermissionGrantListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.OAuth2PermissionGrantListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets the next page of OAuth2 permission grants + * @param nextLink Next link for the list operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextLink Next link for the list operation. + * @param callback The callback + */ + listNext(nextLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextLink Next link for the list operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{tenantID}/oauth2PermissionGrants", + urlParameters: [ + Parameters.tenantID + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OAuth2PermissionGrantListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{tenantID}/{nextLink}", + urlParameters: [ + Parameters.nextLink, + Parameters.tenantID + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OAuth2PermissionGrantListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + serializer +}; From 5b0b781c6647c96f204700e6de30b5daba0553af Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 10 Mar 2019 00:38:12 +0000 Subject: [PATCH 3/3] Generated from cc2979ca161aa49f917146542d14240d3f744d66 update operation id --- .../graph/lib/graphRbacManagementClient.ts | 2 - packages/@azure/graph/lib/models/index.ts | 16 +-- packages/@azure/graph/lib/operations/index.ts | 1 - .../oAuth2PermissionGrantOperations.ts | 104 ++++++++++++++++++ 4 files changed, 112 insertions(+), 11 deletions(-) diff --git a/packages/@azure/graph/lib/graphRbacManagementClient.ts b/packages/@azure/graph/lib/graphRbacManagementClient.ts index 308fc28420af..824208582344 100644 --- a/packages/@azure/graph/lib/graphRbacManagementClient.ts +++ b/packages/@azure/graph/lib/graphRbacManagementClient.ts @@ -26,7 +26,6 @@ class GraphRbacManagementClient extends GraphRbacManagementClientContext { objects: operations.Objects; domains: operations.Domains; oAuth2PermissionGrant: operations.OAuth2PermissionGrantOperations; - oAuth2: operations.OAuth2; /** * Initializes a new instance of the GraphRbacManagementClient class. @@ -45,7 +44,6 @@ class GraphRbacManagementClient extends GraphRbacManagementClientContext { this.objects = new operations.Objects(this); this.domains = new operations.Domains(this); this.oAuth2PermissionGrant = new operations.OAuth2PermissionGrantOperations(this); - this.oAuth2 = new operations.OAuth2(this); } } diff --git a/packages/@azure/graph/lib/models/index.ts b/packages/@azure/graph/lib/models/index.ts index cd53f3b7a5e0..afe2d579ae47 100644 --- a/packages/@azure/graph/lib/models/index.ts +++ b/packages/@azure/graph/lib/models/index.ts @@ -1688,12 +1688,12 @@ export interface OAuth2PermissionGrantListOptionalParams extends msRest.RequestO /** * @interface - * An interface representing OAuth2GrantOptionalParams. + * An interface representing OAuth2PermissionGrantCreateOptionalParams. * Optional Parameters. * * @extends RequestOptionsBase */ -export interface OAuth2GrantOptionalParams extends msRest.RequestOptionsBase { +export interface OAuth2PermissionGrantCreateOptionalParams extends msRest.RequestOptionsBase { /** * @member {OAuth2PermissionGrant} [body] The relevant app Service Principal * Object Id and the Service Principal Object Id you want to grant. @@ -2663,9 +2663,9 @@ export type OAuth2PermissionGrantListResponse = OAuth2PermissionGrantListResult }; /** - * Contains response data for the listNext operation. + * Contains response data for the create operation. */ -export type OAuth2PermissionGrantListNextResponse = OAuth2PermissionGrantListResult & { +export type OAuth2PermissionGrantCreateResponse = OAuth2PermissionGrant & { /** * The underlying HTTP response. */ @@ -2677,14 +2677,14 @@ export type OAuth2PermissionGrantListNextResponse = OAuth2PermissionGrantListRes /** * The response body as parsed JSON or XML */ - parsedBody: OAuth2PermissionGrantListResult; + parsedBody: OAuth2PermissionGrant; }; }; /** - * Contains response data for the grant operation. + * Contains response data for the listNext operation. */ -export type OAuth2GrantResponse = OAuth2PermissionGrant & { +export type OAuth2PermissionGrantListNextResponse = OAuth2PermissionGrantListResult & { /** * The underlying HTTP response. */ @@ -2696,6 +2696,6 @@ export type OAuth2GrantResponse = OAuth2PermissionGrant & { /** * The response body as parsed JSON or XML */ - parsedBody: OAuth2PermissionGrant; + parsedBody: OAuth2PermissionGrantListResult; }; }; diff --git a/packages/@azure/graph/lib/operations/index.ts b/packages/@azure/graph/lib/operations/index.ts index 2ba98d1bb68c..b53368ac7e91 100644 --- a/packages/@azure/graph/lib/operations/index.ts +++ b/packages/@azure/graph/lib/operations/index.ts @@ -17,4 +17,3 @@ export * from "./users"; export * from "./objects"; export * from "./domains"; export * from "./oAuth2PermissionGrantOperations"; -export * from "./oAuth2"; diff --git a/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts b/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts index b617b947c9bb..7bddae67b60e 100644 --- a/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts +++ b/packages/@azure/graph/lib/operations/oAuth2PermissionGrantOperations.ts @@ -50,6 +50,58 @@ export class OAuth2PermissionGrantOperations { callback) as Promise; } + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * @param [options] The optional parameters + * @returns Promise + */ + create(options?: Models.OAuth2PermissionGrantCreateOptionalParams): Promise; + /** + * @param callback The callback + */ + create(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + create(options: Models.OAuth2PermissionGrantCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(options?: Models.OAuth2PermissionGrantCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * Delete a OAuth2 permission grant for the relevant resource Ids of an app. + * @param objectId The object ID of a permission grant. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(objectId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param objectId The object ID of a permission grant. + * @param callback The callback + */ + deleteMethod(objectId: string, callback: msRest.ServiceCallback): void; + /** + * @param objectId The object ID of a permission grant. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(objectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(objectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + objectId, + options + }, + deleteMethodOperationSpec, + callback); + } + /** * Gets the next page of OAuth2 permission grants * @param nextLink Next link for the list operation. @@ -105,6 +157,58 @@ const listOperationSpec: msRest.OperationSpec = { serializer }; +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "{tenantID}/oauth2PermissionGrants", + urlParameters: [ + Parameters.tenantID + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "body" + ], + mapper: Mappers.OAuth2PermissionGrant + }, + responses: { + 201: { + bodyMapper: Mappers.OAuth2PermissionGrant + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "{tenantID}/oauth2PermissionGrants/{objectId}", + urlParameters: [ + Parameters.objectId, + Parameters.tenantID + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + serializer +}; + const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/{nextLink}",