diff --git a/packages/@azure/graph/lib/graphRbacManagementClient.ts b/packages/@azure/graph/lib/graphRbacManagementClient.ts index 824208582344..2cb75df6cd9e 100644 --- a/packages/@azure/graph/lib/graphRbacManagementClient.ts +++ b/packages/@azure/graph/lib/graphRbacManagementClient.ts @@ -22,6 +22,7 @@ class GraphRbacManagementClient extends GraphRbacManagementClientContext { deletedApplications: operations.DeletedApplications; groups: operations.Groups; servicePrincipals: operations.ServicePrincipals; + servicePrincipalsByAppId: operations.ServicePrincipalsByAppId; users: operations.Users; objects: operations.Objects; domains: operations.Domains; @@ -31,15 +32,17 @@ class GraphRbacManagementClient extends GraphRbacManagementClientContext { * Initializes a new instance of the GraphRbacManagementClient class. * @param credentials Credentials needed for the client to connect to Azure. * @param tenantID The tenant ID. + * @param applicationID The application ID. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, tenantID: string, options?: Models.GraphRbacManagementClientOptions) { - super(credentials, tenantID, options); + constructor(credentials: msRest.ServiceClientCredentials, tenantID: string, applicationID: string, options?: Models.GraphRbacManagementClientOptions) { + super(credentials, tenantID, applicationID, options); this.signedInUser = new operations.SignedInUser(this); this.applications = new operations.Applications(this); this.deletedApplications = new operations.DeletedApplications(this); this.groups = new operations.Groups(this); this.servicePrincipals = new operations.ServicePrincipals(this); + this.servicePrincipalsByAppId = new operations.ServicePrincipalsByAppId(this); this.users = new operations.Users(this); this.objects = new operations.Objects(this); this.domains = new operations.Domains(this); diff --git a/packages/@azure/graph/lib/graphRbacManagementClientContext.ts b/packages/@azure/graph/lib/graphRbacManagementClientContext.ts index 26036f978fcd..393a4c2cde66 100644 --- a/packages/@azure/graph/lib/graphRbacManagementClientContext.ts +++ b/packages/@azure/graph/lib/graphRbacManagementClientContext.ts @@ -19,20 +19,25 @@ export class GraphRbacManagementClientContext extends msRestAzure.AzureServiceCl credentials: msRest.ServiceClientCredentials; apiVersion?: string; tenantID: string; + applicationID: string; /** * Initializes a new instance of the GraphRbacManagementClient class. * @param credentials Credentials needed for the client to connect to Azure. * @param tenantID The tenant ID. + * @param applicationID The application ID. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, tenantID: string, options?: Models.GraphRbacManagementClientOptions) { + constructor(credentials: msRest.ServiceClientCredentials, tenantID: string, applicationID: string, options?: Models.GraphRbacManagementClientOptions) { if (credentials == undefined) { throw new Error('\'credentials\' cannot be null.'); } if (tenantID == undefined) { throw new Error('\'tenantID\' cannot be null.'); } + if (applicationID == undefined) { + throw new Error('\'applicationID\' cannot be null.'); + } if (!options) { options = {}; @@ -51,6 +56,7 @@ export class GraphRbacManagementClientContext extends msRestAzure.AzureServiceCl this.requestContentType = "application/json; charset=utf-8"; this.credentials = credentials; this.tenantID = tenantID; + this.applicationID = applicationID; if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; diff --git a/packages/@azure/graph/lib/models/index.ts b/packages/@azure/graph/lib/models/index.ts index 669ee42ab753..2f445dbfefa5 100644 --- a/packages/@azure/graph/lib/models/index.ts +++ b/packages/@azure/graph/lib/models/index.ts @@ -830,6 +830,23 @@ export interface Application { wwwHomepage?: string; } +/** + * @interface + * An interface representing ServicePrincipalObjectResult. + * Service Principal Object Result. + * + */ +export interface ServicePrincipalObjectResult { + /** + * @member {string} [value] Service Principal Application Object Id + */ + value?: string; + /** + * @member {string} [odatametadata] The URL representing edm equivalent. + */ + odatametadata?: string; +} + /** * @interface * An interface representing AddOwnerParameters. @@ -2488,6 +2505,25 @@ export type ServicePrincipalsListOwnersNextResponse = DirectoryObjectListResult }; }; +/** + * Contains response data for the get operation. + */ +export type ServicePrincipalsByAppIdGetResponse = ServicePrincipalObjectResult & { + /** + * 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: ServicePrincipalObjectResult; + }; +}; + /** * Contains response data for the create operation. */ diff --git a/packages/@azure/graph/lib/models/mappers.ts b/packages/@azure/graph/lib/models/mappers.ts index 28ecb4479ade..f2f7143a9b9c 100644 --- a/packages/@azure/graph/lib/models/mappers.ts +++ b/packages/@azure/graph/lib/models/mappers.ts @@ -1156,6 +1156,28 @@ export const Application: msRest.CompositeMapper = { } }; +export const ServicePrincipalObjectResult: msRest.CompositeMapper = { + serializedName: "ServicePrincipalObjectResult", + type: { + name: "Composite", + className: "ServicePrincipalObjectResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "String" + } + }, + odatametadata: { + serializedName: "odata\\.metadata", + type: { + name: "String" + } + } + } + } +}; + export const AddOwnerParameters: msRest.CompositeMapper = { serializedName: "AddOwnerParameters", type: { diff --git a/packages/@azure/graph/lib/models/parameters.ts b/packages/@azure/graph/lib/models/parameters.ts index 57d946162f5d..b770a204656e 100644 --- a/packages/@azure/graph/lib/models/parameters.ts +++ b/packages/@azure/graph/lib/models/parameters.ts @@ -30,6 +30,16 @@ export const apiVersion: msRest.OperationQueryParameter = { } } }; +export const applicationID: msRest.OperationURLParameter = { + parameterPath: "applicationID", + mapper: { + required: true, + serializedName: "applicationID", + type: { + name: "String" + } + } +}; export const applicationObjectId: msRest.OperationURLParameter = { parameterPath: "applicationObjectId", mapper: { diff --git a/packages/@azure/graph/lib/models/servicePrincipalsByAppIdMappers.ts b/packages/@azure/graph/lib/models/servicePrincipalsByAppIdMappers.ts new file mode 100644 index 000000000000..330363997f0b --- /dev/null +++ b/packages/@azure/graph/lib/models/servicePrincipalsByAppIdMappers.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + ServicePrincipalObjectResult, + GraphError +} from "../models/mappers"; + diff --git a/packages/@azure/graph/lib/operations/index.ts b/packages/@azure/graph/lib/operations/index.ts index b53368ac7e91..f33e3222e187 100644 --- a/packages/@azure/graph/lib/operations/index.ts +++ b/packages/@azure/graph/lib/operations/index.ts @@ -13,6 +13,7 @@ export * from "./applications"; export * from "./deletedApplications"; export * from "./groups"; export * from "./servicePrincipals"; +export * from "./servicePrincipalsByAppId"; export * from "./users"; export * from "./objects"; export * from "./domains"; diff --git a/packages/@azure/graph/lib/operations/servicePrincipalsByAppId.ts b/packages/@azure/graph/lib/operations/servicePrincipalsByAppId.ts new file mode 100644 index 000000000000..6038004bc3d1 --- /dev/null +++ b/packages/@azure/graph/lib/operations/servicePrincipalsByAppId.ts @@ -0,0 +1,78 @@ +/* + * 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/servicePrincipalsByAppIdMappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClientContext } from "../graphRbacManagementClientContext"; + +/** Class representing a ServicePrincipalsByAppId. */ +export class ServicePrincipalsByAppId { + private readonly client: GraphRbacManagementClientContext; + + /** + * Create a ServicePrincipalsByAppId. + * @param {GraphRbacManagementClientContext} client Reference to the service client. + */ + constructor(client: GraphRbacManagementClientContext) { + this.client = client; + } + + /** + * Gets an object id for a given application id from the current tenant. + * @param [options] The optional parameters + * @returns Promise + */ + get(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + get(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + get(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{tenantID}/servicePrincipalsByAppId/{applicationID}/objectId", + urlParameters: [ + Parameters.tenantID, + Parameters.applicationID + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ServicePrincipalObjectResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + serializer +};