/* * 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/applicationsMappers"; import * as Parameters from "../models/parameters"; import { GraphRbacManagementClientContext } from "../graphRbacManagementClientContext"; /** Class representing a Applications. */ export class Applications { private readonly client: GraphRbacManagementClientContext; /** * Create a Applications. * @param {GraphRbacManagementClientContext} client Reference to the service client. */ constructor(client: GraphRbacManagementClientContext) { this.client = client; } /** * Create a new application. * @param parameters The parameters for creating an application. * @param [options] The optional parameters * @returns Promise */ create(parameters: Models.ApplicationCreateParameters, options?: msRest.RequestOptionsBase): Promise; /** * @param parameters The parameters for creating an application. * @param callback The callback */ create(parameters: Models.ApplicationCreateParameters, callback: msRest.ServiceCallback): void; /** * @param parameters The parameters for creating an application. * @param options The optional parameters * @param callback The callback */ create(parameters: Models.ApplicationCreateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; create(parameters: Models.ApplicationCreateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { parameters, options }, createOperationSpec, callback) as Promise; } /** * Lists applications by filter parameters. * @param [options] The optional parameters * @returns Promise */ list(options?: Models.ApplicationsListOptionalParams): Promise; /** * @param callback The callback */ list(callback: msRest.ServiceCallback): void; /** * @param options The optional parameters * @param callback The callback */ list(options: Models.ApplicationsListOptionalParams, callback: msRest.ServiceCallback): void; list(options?: Models.ApplicationsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { options }, listOperationSpec, callback) as Promise; } /** * Delete an application. * @param applicationObjectId Application object ID. * @param [options] The optional parameters * @returns Promise */ deleteMethod(applicationObjectId: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param callback The callback */ deleteMethod(applicationObjectId: string, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param options The optional parameters * @param callback The callback */ deleteMethod(applicationObjectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; deleteMethod(applicationObjectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, options }, deleteMethodOperationSpec, callback); } /** * Get an application by object ID. * @param applicationObjectId Application object ID. * @param [options] The optional parameters * @returns Promise */ get(applicationObjectId: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param callback The callback */ get(applicationObjectId: string, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param options The optional parameters * @param callback The callback */ get(applicationObjectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; get(applicationObjectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, options }, getOperationSpec, callback) as Promise; } /** * Update an existing application. * @param applicationObjectId Application object ID. * @param parameters Parameters to update an existing application. * @param [options] The optional parameters * @returns Promise */ patch(applicationObjectId: string, parameters: Models.ApplicationUpdateParameters, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param parameters Parameters to update an existing application. * @param callback The callback */ patch(applicationObjectId: string, parameters: Models.ApplicationUpdateParameters, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param parameters Parameters to update an existing application. * @param options The optional parameters * @param callback The callback */ patch(applicationObjectId: string, parameters: Models.ApplicationUpdateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; patch(applicationObjectId: string, parameters: Models.ApplicationUpdateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, parameters, options }, patchOperationSpec, callback); } /** * The owners are a set of non-admin users who are allowed to modify this object. * @summary Directory objects that are owners of the application. * @param applicationObjectId The object ID of the application for which to get owners. * @param [options] The optional parameters * @returns Promise */ listOwners(applicationObjectId: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId The object ID of the application for which to get owners. * @param callback The callback */ listOwners(applicationObjectId: string, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId The object ID of the application for which to get owners. * @param options The optional parameters * @param callback The callback */ listOwners(applicationObjectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listOwners(applicationObjectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, options }, listOwnersOperationSpec, callback) as Promise; } /** * Add an owner to an application. * @param applicationObjectId The object ID of the application to which to add the owner. * @param parameters The URL of the owner object, such as * https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. * @param [options] The optional parameters * @returns Promise */ addOwner(applicationObjectId: string, parameters: Models.AddOwnerParameters, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId The object ID of the application to which to add the owner. * @param parameters The URL of the owner object, such as * https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. * @param callback The callback */ addOwner(applicationObjectId: string, parameters: Models.AddOwnerParameters, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId The object ID of the application to which to add the owner. * @param parameters The URL of the owner object, such as * https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. * @param options The optional parameters * @param callback The callback */ addOwner(applicationObjectId: string, parameters: Models.AddOwnerParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; addOwner(applicationObjectId: string, parameters: Models.AddOwnerParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, parameters, options }, addOwnerOperationSpec, callback); } /** * Remove a member from owners. * @param applicationObjectId The object ID of the application from which to remove the owner. * @param ownerObjectId Owner object id * @param [options] The optional parameters * @returns Promise */ removeOwner(applicationObjectId: string, ownerObjectId: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId The object ID of the application from which to remove the owner. * @param ownerObjectId Owner object id * @param callback The callback */ removeOwner(applicationObjectId: string, ownerObjectId: string, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId The object ID of the application from which to remove the owner. * @param ownerObjectId Owner object id * @param options The optional parameters * @param callback The callback */ removeOwner(applicationObjectId: string, ownerObjectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; removeOwner(applicationObjectId: string, ownerObjectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, ownerObjectId, options }, removeOwnerOperationSpec, callback); } /** * Get the keyCredentials associated with an application. * @param applicationObjectId Application object ID. * @param [options] The optional parameters * @returns Promise */ listKeyCredentials(applicationObjectId: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param callback The callback */ listKeyCredentials(applicationObjectId: string, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param options The optional parameters * @param callback The callback */ listKeyCredentials(applicationObjectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listKeyCredentials(applicationObjectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, options }, listKeyCredentialsOperationSpec, callback) as Promise; } /** * Update the keyCredentials associated with an application. * @param applicationObjectId Application object ID. * @param value A collection of KeyCredentials. * @param [options] The optional parameters * @returns Promise */ updateKeyCredentials(applicationObjectId: string, value: Models.KeyCredential[], options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param value A collection of KeyCredentials. * @param callback The callback */ updateKeyCredentials(applicationObjectId: string, value: Models.KeyCredential[], callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param value A collection of KeyCredentials. * @param options The optional parameters * @param callback The callback */ updateKeyCredentials(applicationObjectId: string, value: Models.KeyCredential[], options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; updateKeyCredentials(applicationObjectId: string, value: Models.KeyCredential[], options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, value, options }, updateKeyCredentialsOperationSpec, callback); } /** * Get the passwordCredentials associated with an application. * @param applicationObjectId Application object ID. * @param [options] The optional parameters * @returns Promise */ listPasswordCredentials(applicationObjectId: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param callback The callback */ listPasswordCredentials(applicationObjectId: string, callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param options The optional parameters * @param callback The callback */ listPasswordCredentials(applicationObjectId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listPasswordCredentials(applicationObjectId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, options }, listPasswordCredentialsOperationSpec, callback) as Promise; } /** * Update passwordCredentials associated with an application. * @param applicationObjectId Application object ID. * @param value A collection of PasswordCredentials. * @param [options] The optional parameters * @returns Promise */ updatePasswordCredentials(applicationObjectId: string, value: Models.PasswordCredential[], options?: msRest.RequestOptionsBase): Promise; /** * @param applicationObjectId Application object ID. * @param value A collection of PasswordCredentials. * @param callback The callback */ updatePasswordCredentials(applicationObjectId: string, value: Models.PasswordCredential[], callback: msRest.ServiceCallback): void; /** * @param applicationObjectId Application object ID. * @param value A collection of PasswordCredentials. * @param options The optional parameters * @param callback The callback */ updatePasswordCredentials(applicationObjectId: string, value: Models.PasswordCredential[], options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; updatePasswordCredentials(applicationObjectId: string, value: Models.PasswordCredential[], options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationObjectId, value, options }, updatePasswordCredentialsOperationSpec, callback); } /** * Gets an object id for a given application id from the current tenant. * @param applicationID The application ID. * @param [options] The optional parameters * @returns Promise */ getServicePrincipalsIdByAppId(applicationID: string, options?: msRest.RequestOptionsBase): Promise; /** * @param applicationID The application ID. * @param callback The callback */ getServicePrincipalsIdByAppId(applicationID: string, callback: msRest.ServiceCallback): void; /** * @param applicationID The application ID. * @param options The optional parameters * @param callback The callback */ getServicePrincipalsIdByAppId(applicationID: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; getServicePrincipalsIdByAppId(applicationID: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { applicationID, options }, getServicePrincipalsIdByAppIdOperationSpec, callback) as Promise; } /** * Gets a list of applications from the current tenant. * @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; } /** * The owners are a set of non-admin users who are allowed to modify this object. * @summary Directory objects that are owners of the application. * @param nextPageLink The NextLink from the previous successful call to List operation. * @param [options] The optional parameters * @returns Promise */ listOwnersNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param callback The callback */ listOwnersNext(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 */ listOwnersNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listOwnersNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { nextPageLink, options }, listOwnersNextOperationSpec, callback) as Promise; } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const createOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{tenantID}/applications", urlParameters: [ Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.ApplicationCreateParameters, required: true } }, responses: { 201: { bodyMapper: Mappers.Application }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/applications", urlParameters: [ Parameters.tenantID ], queryParameters: [ Parameters.filter, Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.ApplicationListResult }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const deleteMethodOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "{tenantID}/applications/{applicationObjectId}", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 204: {}, default: { bodyMapper: Mappers.GraphError } }, serializer }; const getOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/applications/{applicationObjectId}", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.Application }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const patchOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "{tenantID}/applications/{applicationObjectId}", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.ApplicationUpdateParameters, required: true } }, responses: { 204: {}, default: { bodyMapper: Mappers.GraphError } }, serializer }; const listOwnersOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/applications/{applicationObjectId}/owners", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.DirectoryObjectListResult }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const addOwnerOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{tenantID}/applications/{applicationObjectId}/$links/owners", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.AddOwnerParameters, required: true } }, responses: { 204: {}, default: { bodyMapper: Mappers.GraphError } }, serializer }; const removeOwnerOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}", urlParameters: [ Parameters.applicationObjectId, Parameters.ownerObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 204: {}, default: { bodyMapper: Mappers.GraphError } }, serializer }; const listKeyCredentialsOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/applications/{applicationObjectId}/keyCredentials", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.KeyCredentialListResult }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const updateKeyCredentialsOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "{tenantID}/applications/{applicationObjectId}/keyCredentials", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: { value: "value" }, mapper: { ...Mappers.KeyCredentialsUpdateParameters, required: true } }, responses: { 204: {}, default: { bodyMapper: Mappers.GraphError } }, serializer }; const listPasswordCredentialsOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/applications/{applicationObjectId}/passwordCredentials", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.PasswordCredentialListResult }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const updatePasswordCredentialsOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "{tenantID}/applications/{applicationObjectId}/passwordCredentials", urlParameters: [ Parameters.applicationObjectId, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: { value: "value" }, mapper: { ...Mappers.PasswordCredentialsUpdateParameters, required: true } }, responses: { 204: {}, default: { bodyMapper: Mappers.GraphError } }, serializer }; const getServicePrincipalsIdByAppIdOperationSpec: 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 }; const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "{tenantID}/{nextLink}", urlParameters: [ Parameters.nextLink, Parameters.tenantID ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.ApplicationListResult }, default: { bodyMapper: Mappers.GraphError } }, serializer }; const listOwnersNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://graph.windows.net", path: "{nextLink}", urlParameters: [ Parameters.nextPageLink ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.DirectoryObjectListResult }, default: { bodyMapper: Mappers.GraphError } }, serializer };