UNPKG

@azure/arm-automation

Version:

AutomationClient Library with typescript type definitions for node.js and browser.

471 lines (453 loc) 18.7 kB
/* * 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/webhookOperationsMappers"; import * as Parameters from "../models/parameters"; import { AutomationClientContext } from "../automationClientContext"; /** Class representing a WebhookOperations. */ export class WebhookOperations { private readonly client: AutomationClientContext; /** * Create a WebhookOperations. * @param {AutomationClientContext} client Reference to the service client. */ constructor(client: AutomationClientContext) { this.client = client; } /** * Generates a Uri for use in creating a webhook. * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param [options] The optional parameters * @returns Promise<Models.WebhookGenerateUriResponse> */ generateUri(resourceGroupName: string, automationAccountName: string, options?: msRest.RequestOptionsBase): Promise<Models.WebhookGenerateUriResponse>; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param callback The callback */ generateUri(resourceGroupName: string, automationAccountName: string, callback: msRest.ServiceCallback<string>): void; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param options The optional parameters * @param callback The callback */ generateUri(resourceGroupName: string, automationAccountName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<string>): void; generateUri(resourceGroupName: string, automationAccountName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<string>, callback?: msRest.ServiceCallback<string>): Promise<Models.WebhookGenerateUriResponse> { return this.client.sendOperationRequest( { resourceGroupName, automationAccountName, options }, generateUriOperationSpec, callback) as Promise<Models.WebhookGenerateUriResponse>; } /** * Delete the webhook by name. * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param [options] The optional parameters * @returns Promise<msRest.RestResponse> */ deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: msRest.RequestOptionsBase): Promise<msRest.RestResponse>; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param callback The callback */ deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: msRest.ServiceCallback<void>): void; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param options The optional parameters * @param callback The callback */ deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<void>): void; deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<msRest.RestResponse> { return this.client.sendOperationRequest( { resourceGroupName, automationAccountName, webhookName, options }, deleteMethodOperationSpec, callback); } /** * Retrieve the webhook identified by webhook name. * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param [options] The optional parameters * @returns Promise<Models.WebhookGetResponse> */ get(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: msRest.RequestOptionsBase): Promise<Models.WebhookGetResponse>; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param callback The callback */ get(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: msRest.ServiceCallback<Models.Webhook>): void; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param options The optional parameters * @param callback The callback */ get(resourceGroupName: string, automationAccountName: string, webhookName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.Webhook>): void; get(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.Webhook>, callback?: msRest.ServiceCallback<Models.Webhook>): Promise<Models.WebhookGetResponse> { return this.client.sendOperationRequest( { resourceGroupName, automationAccountName, webhookName, options }, getOperationSpec, callback) as Promise<Models.WebhookGetResponse>; } /** * Create the webhook identified by webhook name. * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param parameters The create or update parameters for webhook. * @param [options] The optional parameters * @returns Promise<Models.WebhookCreateOrUpdateResponse> */ createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookCreateOrUpdateParameters, options?: msRest.RequestOptionsBase): Promise<Models.WebhookCreateOrUpdateResponse>; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param parameters The create or update parameters for webhook. * @param callback The callback */ createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookCreateOrUpdateParameters, callback: msRest.ServiceCallback<Models.Webhook>): void; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param parameters The create or update parameters for webhook. * @param options The optional parameters * @param callback The callback */ createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookCreateOrUpdateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.Webhook>): void; createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookCreateOrUpdateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.Webhook>, callback?: msRest.ServiceCallback<Models.Webhook>): Promise<Models.WebhookCreateOrUpdateResponse> { return this.client.sendOperationRequest( { resourceGroupName, automationAccountName, webhookName, parameters, options }, createOrUpdateOperationSpec, callback) as Promise<Models.WebhookCreateOrUpdateResponse>; } /** * Update the webhook identified by webhook name. * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param parameters The update parameters for webhook. * @param [options] The optional parameters * @returns Promise<Models.WebhookUpdateResponse> */ update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookUpdateParameters, options?: msRest.RequestOptionsBase): Promise<Models.WebhookUpdateResponse>; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param parameters The update parameters for webhook. * @param callback The callback */ update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookUpdateParameters, callback: msRest.ServiceCallback<Models.Webhook>): void; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param webhookName The webhook name. * @param parameters The update parameters for webhook. * @param options The optional parameters * @param callback The callback */ update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookUpdateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.Webhook>): void; update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: Models.WebhookUpdateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.Webhook>, callback?: msRest.ServiceCallback<Models.Webhook>): Promise<Models.WebhookUpdateResponse> { return this.client.sendOperationRequest( { resourceGroupName, automationAccountName, webhookName, parameters, options }, updateOperationSpec, callback) as Promise<Models.WebhookUpdateResponse>; } /** * Retrieve a list of webhooks. * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param [options] The optional parameters * @returns Promise<Models.WebhookListByAutomationAccountResponse> */ listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: Models.WebhookListByAutomationAccountOptionalParams): Promise<Models.WebhookListByAutomationAccountResponse>; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param callback The callback */ listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: msRest.ServiceCallback<Models.WebhookListResult>): void; /** * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param options The optional parameters * @param callback The callback */ listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: Models.WebhookListByAutomationAccountOptionalParams, callback: msRest.ServiceCallback<Models.WebhookListResult>): void; listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: Models.WebhookListByAutomationAccountOptionalParams | msRest.ServiceCallback<Models.WebhookListResult>, callback?: msRest.ServiceCallback<Models.WebhookListResult>): Promise<Models.WebhookListByAutomationAccountResponse> { return this.client.sendOperationRequest( { resourceGroupName, automationAccountName, options }, listByAutomationAccountOperationSpec, callback) as Promise<Models.WebhookListByAutomationAccountResponse>; } /** * Retrieve a list of webhooks. * @param nextPageLink The NextLink from the previous successful call to List operation. * @param [options] The optional parameters * @returns Promise<Models.WebhookListByAutomationAccountNextResponse> */ listByAutomationAccountNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise<Models.WebhookListByAutomationAccountNextResponse>; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param callback The callback */ listByAutomationAccountNext(nextPageLink: string, callback: msRest.ServiceCallback<Models.WebhookListResult>): void; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param options The optional parameters * @param callback The callback */ listByAutomationAccountNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.WebhookListResult>): void; listByAutomationAccountNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.WebhookListResult>, callback?: msRest.ServiceCallback<Models.WebhookListResult>): Promise<Models.WebhookListByAutomationAccountNextResponse> { return this.client.sendOperationRequest( { nextPageLink, options }, listByAutomationAccountNextOperationSpec, callback) as Promise<Models.WebhookListByAutomationAccountNextResponse>; } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const generateUriOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", urlParameters: [ Parameters.resourceGroupName, Parameters.automationAccountName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: { serializedName: "parsedResponse", type: { name: "String" } } }, default: { bodyMapper: Mappers.ErrorResponse } }, serializer }; const deleteMethodOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", urlParameters: [ Parameters.resourceGroupName, Parameters.automationAccountName, Parameters.webhookName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: {}, default: { bodyMapper: Mappers.ErrorResponse } }, serializer }; const getOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", urlParameters: [ Parameters.resourceGroupName, Parameters.automationAccountName, Parameters.webhookName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.Webhook }, default: { bodyMapper: Mappers.ErrorResponse } }, serializer }; const createOrUpdateOperationSpec: msRest.OperationSpec = { httpMethod: "PUT", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", urlParameters: [ Parameters.resourceGroupName, Parameters.automationAccountName, Parameters.webhookName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.WebhookCreateOrUpdateParameters, required: true } }, responses: { 200: { bodyMapper: Mappers.Webhook }, 201: { bodyMapper: Mappers.Webhook }, default: { bodyMapper: Mappers.ErrorResponse } }, serializer }; const updateOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", urlParameters: [ Parameters.resourceGroupName, Parameters.automationAccountName, Parameters.webhookName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.WebhookUpdateParameters, required: true } }, responses: { 200: { bodyMapper: Mappers.Webhook }, default: { bodyMapper: Mappers.ErrorResponse } }, serializer }; const listByAutomationAccountOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks", urlParameters: [ Parameters.resourceGroupName, Parameters.automationAccountName, Parameters.subscriptionId ], queryParameters: [ Parameters.filter, Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.WebhookListResult }, default: { bodyMapper: Mappers.ErrorResponse } }, serializer }; const listByAutomationAccountNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com", path: "{nextLink}", urlParameters: [ Parameters.nextPageLink ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.WebhookListResult }, default: { bodyMapper: Mappers.ErrorResponse } }, serializer };