Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion lib/services/automationManagement/lib/automationClient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure';
import * as models from "./models";
import * as operations from "./operations";

/**
* AutomationClientOptions for AutomationClient.
*/
declare interface AutomationClientOptions extends AzureServiceClientOptions {
/**
* @property {string} [clientRequestId] - Identifies this specific client request.
*/
clientRequestId?: string;
/**
* @property {string} [acceptLanguage] - Gets or sets the preferred language for the response.
*/
acceptLanguage?: string;
/**
* @property {number} [longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
*/
longRunningOperationRetryTimeout?: number;
/**
* @property {boolean} [generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
generateClientRequestId?: boolean;
}

export default class AutomationClient extends AzureServiceClient {
/**
* Initializes a new instance of the AutomationClient class.
Expand All @@ -23,6 +45,10 @@ export default class AutomationClient extends AzureServiceClient {
*
* @param {string} subscriptionId - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
*
* @param {string} resourceGroupName - The resource group name.
*
* @param {string} automationAccountName - The name of the automation account.
*
* @param {string} [baseUri] - The base URI of the service.
*
* @param {object} [options] - The parameter options
Expand All @@ -34,19 +60,27 @@ export default class AutomationClient extends AzureServiceClient {
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
* @param {string} [options.clientRequestId] - Identifies this specific client request.
*
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
*
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
*/
constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions);
constructor(credentials: ServiceClientCredentials, subscriptionId: string, resourceGroupName: string, automationAccountName: string, baseUri?: string, options?: AutomationClientOptions);

credentials: ServiceClientCredentials;

subscriptionId: string;

resourceGroupName: string;

clientRequestId: string;

automationAccountName: string;

acceptLanguage: string;

longRunningOperationRetryTimeout: number;
Expand Down
16 changes: 15 additions & 1 deletion lib/services/automationManagement/lib/automationClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,32 @@ class AutomationClient extends ServiceClient {
* Create a AutomationClient.
* @param {credentials} credentials - Credentials needed for the client to connect to Azure.
* @param {string} subscriptionId - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
* @param {string} resourceGroupName - The resource group name.
* @param {string} automationAccountName - The name of the automation account.
* @param {string} [baseUri] - The base URI of the service.
* @param {object} [options] - The parameter options
* @param {Array} [options.filters] - Filters to be added to the request pipeline
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
* @param {string} [options.clientRequestId] - Identifies this specific client request.
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
constructor(credentials, subscriptionId, baseUri, options) {
constructor(credentials, subscriptionId, resourceGroupName, automationAccountName, baseUri, options) {
if (credentials === null || credentials === undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (subscriptionId === null || subscriptionId === undefined) {
throw new Error('\'subscriptionId\' cannot be null.');
}
if (resourceGroupName === null || resourceGroupName === undefined) {
throw new Error('\'resourceGroupName\' cannot be null.');
}
if (automationAccountName === null || automationAccountName === undefined) {
throw new Error('\'automationAccountName\' cannot be null.');
}

if (!options) options = {};

Expand All @@ -59,9 +68,14 @@ class AutomationClient extends ServiceClient {
}
this.credentials = credentials;
this.subscriptionId = subscriptionId;
this.resourceGroupName = resourceGroupName;
this.automationAccountName = automationAccountName;

let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
if(options.clientRequestId !== null && options.clientRequestId !== undefined) {
this.clientRequestId = options.clientRequestId;
}
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
Expand Down
35 changes: 0 additions & 35 deletions lib/services/automationManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1170,41 +1170,6 @@ export interface DscConfigurationCreateOrUpdateParameters {
tags?: { [propertyName: string]: string };
}

/**
* @class
* Initializes a new instance of the DscConfigurationUpdateParameters class.
* @constructor
* The parameters supplied to the create or update configuration operation.
*
* @member {boolean} [logVerbose] Gets or sets verbose log option.
* @member {boolean} [logProgress] Gets or sets progress log option.
* @member {object} source Gets or sets the source.
* @member {object} [source.hash] Gets or sets the hash.
* @member {string} [source.hash.algorithm] Gets or sets the content hash
* algorithm used to hash the content.
* @member {string} [source.hash.value] Gets or sets expected hash value of the
* content.
* @member {string} [source.type] Gets or sets the content source type.
* Possible values include: 'embeddedContent', 'uri'
* @member {string} [source.value] Gets or sets the value of the content. This
* is based on the content source type.
* @member {string} [source.version] Gets or sets the version of the content.
* @member {object} [parameters] Gets or sets the configuration parameters.
* @member {string} [description] Gets or sets the description of the
* configuration.
* @member {string} [name] Gets or sets name of the resource.
* @member {object} [tags] Gets or sets the tags attached to the resource.
*/
export interface DscConfigurationUpdateParameters {
logVerbose?: boolean;
logProgress?: boolean;
source: ContentSource;
parameters?: { [propertyName: string]: DscConfigurationParameter };
description?: string;
name?: string;
tags?: { [propertyName: string]: string };
}

/**
* @class
* Initializes a new instance of the DscMetaConfiguration class.
Expand Down
1 change: 0 additions & 1 deletion lib/services/automationManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ exports.JobProvisioningStateProperty = require('./jobProvisioningStateProperty')
exports.ProxyResource = require('./proxyResource');
exports.DscCompilationJob = require('./dscCompilationJob');
exports.DscConfigurationCreateOrUpdateParameters = require('./dscConfigurationCreateOrUpdateParameters');
exports.DscConfigurationUpdateParameters = require('./dscConfigurationUpdateParameters');
exports.DscMetaConfiguration = require('./dscMetaConfiguration');
exports.DscNodeConfigurationCreateOrUpdateParameters = require('./dscNodeConfigurationCreateOrUpdateParameters');
exports.DscNodeConfigurationAssociationProperty = require('./dscNodeConfigurationAssociationProperty');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const WebResource = msRest.WebResource;
* Retrieve the activity in the module identified by module name and activity
* name.
*
* @param {string} resourceGroupName The resource group name.
*
* @param {string} automationAccountName The automation account name.
*
* @param {string} moduleName The name of module.
Expand All @@ -44,7 +42,7 @@ const WebResource = msRest.WebResource;
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _get(resourceGroupName, automationAccountName, moduleName, activityName, options, callback) {
function _get(automationAccountName, moduleName, activityName, options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
Expand All @@ -57,13 +55,13 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName
let apiVersion = '2015-10-31';
// Validate
try {
if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
if (this.client.resourceGroupName === null || this.client.resourceGroupName === undefined || typeof this.client.resourceGroupName.valueOf() !== 'string') {
throw new Error('this.client.resourceGroupName cannot be null or undefined and it must be of type string.');
}
if (resourceGroupName !== null && resourceGroupName !== undefined) {
if (resourceGroupName.match(/^[-\w\._]+$/) === null)
if (this.client.resourceGroupName !== null && this.client.resourceGroupName !== undefined) {
if (this.client.resourceGroupName.match(/^[-\w\._]+$/) === null)
{
throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/');
throw new Error('"this.client.resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/');
}
}
if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') {
Expand All @@ -88,7 +86,7 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}';
requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(this.client.resourceGroupName));
requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName));
requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName));
requestUrl = requestUrl.replace('{activityName}', encodeURIComponent(activityName));
Expand Down Expand Up @@ -180,8 +178,6 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName
/**
* Retrieve a list of activities in the module identified by module name.
*
* @param {string} resourceGroupName The resource group name.
*
* @param {string} automationAccountName The automation account name.
*
* @param {string} moduleName The name of module.
Expand All @@ -204,7 +200,7 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _listByModule(resourceGroupName, automationAccountName, moduleName, options, callback) {
function _listByModule(automationAccountName, moduleName, options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
Expand All @@ -217,13 +213,13 @@ function _listByModule(resourceGroupName, automationAccountName, moduleName, opt
let apiVersion = '2015-10-31';
// Validate
try {
if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
if (this.client.resourceGroupName === null || this.client.resourceGroupName === undefined || typeof this.client.resourceGroupName.valueOf() !== 'string') {
throw new Error('this.client.resourceGroupName cannot be null or undefined and it must be of type string.');
}
if (resourceGroupName !== null && resourceGroupName !== undefined) {
if (resourceGroupName.match(/^[-\w\._]+$/) === null)
if (this.client.resourceGroupName !== null && this.client.resourceGroupName !== undefined) {
if (this.client.resourceGroupName.match(/^[-\w\._]+$/) === null)
{
throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/');
throw new Error('"this.client.resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/');
}
}
if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') {
Expand All @@ -245,7 +241,7 @@ function _listByModule(resourceGroupName, automationAccountName, moduleName, opt
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities';
requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(this.client.resourceGroupName));
requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName));
requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName));
requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
Expand Down Expand Up @@ -478,8 +474,6 @@ class ActivityOperations {
* Retrieve the activity in the module identified by module name and activity
* name.
*
* @param {string} resourceGroupName The resource group name.
*
* @param {string} automationAccountName The automation account name.
*
* @param {string} moduleName The name of module.
Expand All @@ -497,11 +491,11 @@ class ActivityOperations {
*
* @reject {Error} - The error object.
*/
getWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, activityName, options) {
getWithHttpOperationResponse(automationAccountName, moduleName, activityName, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._get(resourceGroupName, automationAccountName, moduleName, activityName, options, (err, result, request, response) => {
self._get(automationAccountName, moduleName, activityName, options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
Expand All @@ -515,8 +509,6 @@ class ActivityOperations {
* Retrieve the activity in the module identified by module name and activity
* name.
*
* @param {string} resourceGroupName The resource group name.
*
* @param {string} automationAccountName The automation account name.
*
* @param {string} moduleName The name of module.
Expand Down Expand Up @@ -550,7 +542,7 @@ class ActivityOperations {
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
get(resourceGroupName, automationAccountName, moduleName, activityName, options, optionalCallback) {
get(automationAccountName, moduleName, activityName, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
Expand All @@ -559,22 +551,20 @@ class ActivityOperations {
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._get(resourceGroupName, automationAccountName, moduleName, activityName, options, (err, result, request, response) => {
self._get(automationAccountName, moduleName, activityName, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._get(resourceGroupName, automationAccountName, moduleName, activityName, options, optionalCallback);
return self._get(automationAccountName, moduleName, activityName, options, optionalCallback);
}
}

/**
* Retrieve a list of activities in the module identified by module name.
*
* @param {string} resourceGroupName The resource group name.
*
* @param {string} automationAccountName The automation account name.
*
* @param {string} moduleName The name of module.
Expand All @@ -590,11 +580,11 @@ class ActivityOperations {
*
* @reject {Error} - The error object.
*/
listByModuleWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, options) {
listByModuleWithHttpOperationResponse(automationAccountName, moduleName, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._listByModule(resourceGroupName, automationAccountName, moduleName, options, (err, result, request, response) => {
self._listByModule(automationAccountName, moduleName, options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
Expand All @@ -607,8 +597,6 @@ class ActivityOperations {
/**
* Retrieve a list of activities in the module identified by module name.
*
* @param {string} resourceGroupName The resource group name.
*
* @param {string} automationAccountName The automation account name.
*
* @param {string} moduleName The name of module.
Expand Down Expand Up @@ -640,7 +628,7 @@ class ActivityOperations {
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
listByModule(resourceGroupName, automationAccountName, moduleName, options, optionalCallback) {
listByModule(automationAccountName, moduleName, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
Expand All @@ -649,14 +637,14 @@ class ActivityOperations {
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._listByModule(resourceGroupName, automationAccountName, moduleName, options, (err, result, request, response) => {
self._listByModule(automationAccountName, moduleName, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._listByModule(resourceGroupName, automationAccountName, moduleName, options, optionalCallback);
return self._listByModule(automationAccountName, moduleName, options, optionalCallback);
}
}

Expand Down
Loading