diff --git a/lib/services/containerRegistryManagement/LICENSE.txt b/lib/services/containerRegistryManagement/LICENSE.txt index 0313a903d7..5431ba98b9 100644 --- a/lib/services/containerRegistryManagement/LICENSE.txt +++ b/lib/services/containerRegistryManagement/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2017 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. \ No newline at end of file +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. diff --git a/lib/services/containerRegistryManagement/README.md b/lib/services/containerRegistryManagement/README.md index 248c65492f..b977d48fb7 100644 --- a/lib/services/containerRegistryManagement/README.md +++ b/lib/services/containerRegistryManagement/README.md @@ -1,41 +1,42 @@ -# Microsoft Azure SDK for Node.js - ContainerRegistryManagement - -This project provides a Node.js package for accessing Azure. Right now it supports: -- **Node.js version: 6.x.x or higher** -- **API version: 2017-03-01** - -## Features - - -## How to Install - -```bash -npm install azure-arm-containerregistry -``` - -## How to Use - -### Authentication, client creation and listing registries as an example - - ```javascript - const msRestAzure = require('ms-rest-azure'); - const ContainerRegistryManagement = require("azure-arm-containerregistry"); - - // Interactive Login - // It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful, - // the user will get a DeviceTokenCredentials object. - msRestAzure.interactiveLogin().then((credentials) => { - let client = new ContainerRegistryManagement(credentials, 'your-subscription-id'); - client.registries.list().then((registries) => { - console.log('List of registries:'); - console.dir(registries, {depth: null, colors: true}); - }); - }).catch((err) => { - console.log('An error ocurred'); - console.dir(err, {depth: null, colors: true}); - }); -``` - -## Related projects - -- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) +--- +uid: azure-arm-containerregistry +summary: *content + +--- +# Microsoft Azure SDK for Node.js - ContainerRegistryManagementClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features + + +## How to Install + +```bash +npm install azure-arm-containerregistry +``` + +## How to use + +### Authentication, client creation and get registries as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ContainerRegistryManagementClient = require("azure-arm-containerregistry"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ContainerRegistryManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const registryName = "testregistryName"; + return client.registries.get(resourceGroupName, registryName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/containerRegistryManagement/lib/LICENSE.txt b/lib/services/containerRegistryManagement/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/LICENSE.txt @@ -0,0 +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. diff --git a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts index 60e31793c5..0bc7fd95cf 100644 --- a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts +++ b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class ContainerRegistryManagementClient extends AzureServiceClient { +export default class ContainerRegistryManagementClient extends AzureServiceClient { /** * Initializes a new instance of the ContainerRegistryManagementClient class. * @constructor @@ -46,8 +47,6 @@ declare class ContainerRegistryManagementClient extends AzureServiceClient { subscriptionId: string; - apiVersion: string; - acceptLanguage: string; longRunningOperationRetryTimeout: number; @@ -59,6 +58,9 @@ declare class ContainerRegistryManagementClient extends AzureServiceClient { operations: operations.Operations; replications: operations.Replications; webhooks: operations.Webhooks; + builds: operations.Builds; + buildSteps: operations.BuildSteps; + buildTasks: operations.BuildTasks; } -export = ContainerRegistryManagementClient; +export { ContainerRegistryManagementClient, models as ContainerRegistryManagementModels }; diff --git a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.js b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.js index f5e2844045..e7a2b2b65a 100644 --- a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.js +++ b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.js @@ -50,7 +50,6 @@ class ContainerRegistryManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2017-10-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -76,6 +75,9 @@ class ContainerRegistryManagementClient extends ServiceClient { this.operations = new operations.Operations(this); this.replications = new operations.Replications(this); this.webhooks = new operations.Webhooks(this); + this.builds = new operations.Builds(this); + this.buildSteps = new operations.BuildSteps(this); + this.buildTasks = new operations.BuildTasks(this); this.models = models; msRest.addSerializationMixin(this); } @@ -83,3 +85,6 @@ class ContainerRegistryManagementClient extends ServiceClient { } module.exports = ContainerRegistryManagementClient; +module.exports['default'] = ContainerRegistryManagementClient; +module.exports.ContainerRegistryManagementClient = ContainerRegistryManagementClient; +module.exports.ContainerRegistryManagementModels = models; diff --git a/lib/services/containerRegistryManagement/lib/lib/containerRegistryManagementClient.d.ts b/lib/services/containerRegistryManagement/lib/lib/containerRegistryManagementClient.d.ts new file mode 100644 index 0000000000..eb0fa12553 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/containerRegistryManagementClient.d.ts @@ -0,0 +1,65 @@ +/* + * 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 { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class ContainerRegistryManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the ContainerRegistryManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The Microsoft Azure subscription ID. + * + * @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.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); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + registries: operations.Registries; + operations: operations.Operations; + replications: operations.Replications; + webhooks: operations.Webhooks; +} + +export { ContainerRegistryManagementClient, models as ContainerRegistryManagementModels }; diff --git a/lib/services/containerRegistryManagement/lib/lib/containerRegistryManagementClient.js b/lib/services/containerRegistryManagement/lib/lib/containerRegistryManagementClient.js new file mode 100644 index 0000000000..000a4dd96c --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/containerRegistryManagementClient.js @@ -0,0 +1,88 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a ContainerRegistryManagementClient. */ +class ContainerRegistryManagementClient extends ServiceClient { + /** + * Create a ContainerRegistryManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The Microsoft Azure subscription ID. + * @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.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) { + 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 (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2017-10-01'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.registries = new operations.Registries(this); + this.operations = new operations.Operations(this); + this.replications = new operations.Replications(this); + this.webhooks = new operations.Webhooks(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = ContainerRegistryManagementClient; +module.exports['default'] = ContainerRegistryManagementClient; +module.exports.ContainerRegistryManagementClient = ContainerRegistryManagementClient; +module.exports.ContainerRegistryManagementModels = models; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/actor.js b/lib/services/containerRegistryManagement/lib/lib/models/actor.js new file mode 100644 index 0000000000..974a6fe851 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/actor.js @@ -0,0 +1,54 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The agent that initiated the event. For most situations, this could be from + * the authorization context of the request. + * + */ +class Actor { + /** + * Create a Actor. + * @member {string} [name] The subject or username associated with the + * request context that generated the event. + */ + constructor() { + } + + /** + * Defines the metadata of Actor + * + * @returns {object} metadata of Actor + * + */ + mapper() { + return { + required: false, + serializedName: 'Actor', + type: { + name: 'Composite', + className: 'Actor', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Actor; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/callbackConfig.js b/lib/services/containerRegistryManagement/lib/lib/models/callbackConfig.js new file mode 100644 index 0000000000..a9a193b51e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/callbackConfig.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The configuration of service URI and custom headers for the webhook. + * + */ +class CallbackConfig { + /** + * Create a CallbackConfig. + * @member {string} serviceUri The service URI for the webhook to post + * notifications. + * @member {object} [customHeaders] Custom headers that will be added to the + * webhook notifications. + */ + constructor() { + } + + /** + * Defines the metadata of CallbackConfig + * + * @returns {object} metadata of CallbackConfig + * + */ + mapper() { + return { + required: false, + serializedName: 'CallbackConfig', + type: { + name: 'Composite', + className: 'CallbackConfig', + modelProperties: { + serviceUri: { + required: true, + serializedName: 'serviceUri', + type: { + name: 'String' + } + }, + customHeaders: { + required: false, + serializedName: 'customHeaders', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CallbackConfig; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/event.js b/lib/services/containerRegistryManagement/lib/lib/models/event.js new file mode 100644 index 0000000000..1ebb10b49a --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/event.js @@ -0,0 +1,141 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The event for a webhook. + * + * @extends models['EventInfo'] + */ +class Event extends models['EventInfo'] { + /** + * Create a Event. + * @member {object} [eventRequestMessage] The event request message sent to + * the service URI. + * @member {object} [eventRequestMessage.content] The content of the event + * request message. + * @member {string} [eventRequestMessage.content.id] The event ID. + * @member {date} [eventRequestMessage.content.timestamp] The time at which + * the event occurred. + * @member {string} [eventRequestMessage.content.action] The action that + * encompasses the provided event. + * @member {object} [eventRequestMessage.content.target] The target of the + * event. + * @member {string} [eventRequestMessage.content.target.mediaType] The MIME + * type of the referenced object. + * @member {number} [eventRequestMessage.content.target.size] The number of + * bytes of the content. Same as Length field. + * @member {string} [eventRequestMessage.content.target.digest] The digest of + * the content, as defined by the Registry V2 HTTP API Specification. + * @member {number} [eventRequestMessage.content.target.length] The number of + * bytes of the content. Same as Size field. + * @member {string} [eventRequestMessage.content.target.repository] The + * repository name. + * @member {string} [eventRequestMessage.content.target.url] The direct URL + * to the content. + * @member {string} [eventRequestMessage.content.target.tag] The tag name. + * @member {object} [eventRequestMessage.content.request] The request that + * generated the event. + * @member {string} [eventRequestMessage.content.request.id] The ID of the + * request that initiated the event. + * @member {string} [eventRequestMessage.content.request.addr] The IP or + * hostname and possibly port of the client connection that initiated the + * event. This is the RemoteAddr from the standard http request. + * @member {string} [eventRequestMessage.content.request.host] The externally + * accessible hostname of the registry instance, as specified by the http + * host header on incoming requests. + * @member {string} [eventRequestMessage.content.request.method] The request + * method that generated the event. + * @member {string} [eventRequestMessage.content.request.useragent] The user + * agent header of the request. + * @member {object} [eventRequestMessage.content.actor] The agent that + * initiated the event. For most situations, this could be from the + * authorization context of the request. + * @member {string} [eventRequestMessage.content.actor.name] The subject or + * username associated with the request context that generated the event. + * @member {object} [eventRequestMessage.content.source] The registry node + * that generated the event. Put differently, while the actor initiates the + * event, the source generates it. + * @member {string} [eventRequestMessage.content.source.addr] The IP or + * hostname and the port of the registry node that generated the event. + * Generally, this will be resolved by os.Hostname() along with the running + * port. + * @member {string} [eventRequestMessage.content.source.instanceID] The + * running instance of an application. Changes after each restart. + * @member {object} [eventRequestMessage.headers] The headers of the event + * request message. + * @member {string} [eventRequestMessage.method] The HTTP method used to send + * the event request message. + * @member {string} [eventRequestMessage.requestUri] The URI used to send the + * event request message. + * @member {string} [eventRequestMessage.version] The HTTP message version. + * @member {object} [eventResponseMessage] The event response message + * received from the service URI. + * @member {string} [eventResponseMessage.content] The content of the event + * response message. + * @member {object} [eventResponseMessage.headers] The headers of the event + * response message. + * @member {string} [eventResponseMessage.reasonPhrase] The reason phrase of + * the event response message. + * @member {string} [eventResponseMessage.statusCode] The status code of the + * event response message. + * @member {string} [eventResponseMessage.version] The HTTP message version. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Event + * + * @returns {object} metadata of Event + * + */ + mapper() { + return { + required: false, + serializedName: 'Event', + type: { + name: 'Composite', + className: 'Event', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + eventRequestMessage: { + required: false, + serializedName: 'eventRequestMessage', + type: { + name: 'Composite', + className: 'EventRequestMessage' + } + }, + eventResponseMessage: { + required: false, + serializedName: 'eventResponseMessage', + type: { + name: 'Composite', + className: 'EventResponseMessage' + } + } + } + } + }; + } +} + +module.exports = Event; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/eventContent.js b/lib/services/containerRegistryManagement/lib/lib/models/eventContent.js new file mode 100644 index 0000000000..73cf278bc1 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/eventContent.js @@ -0,0 +1,137 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The content of the event request message. + * + */ +class EventContent { + /** + * Create a EventContent. + * @member {string} [id] The event ID. + * @member {date} [timestamp] The time at which the event occurred. + * @member {string} [action] The action that encompasses the provided event. + * @member {object} [target] The target of the event. + * @member {string} [target.mediaType] The MIME type of the referenced + * object. + * @member {number} [target.size] The number of bytes of the content. Same as + * Length field. + * @member {string} [target.digest] The digest of the content, as defined by + * the Registry V2 HTTP API Specification. + * @member {number} [target.length] The number of bytes of the content. Same + * as Size field. + * @member {string} [target.repository] The repository name. + * @member {string} [target.url] The direct URL to the content. + * @member {string} [target.tag] The tag name. + * @member {object} [request] The request that generated the event. + * @member {string} [request.id] The ID of the request that initiated the + * event. + * @member {string} [request.addr] The IP or hostname and possibly port of + * the client connection that initiated the event. This is the RemoteAddr + * from the standard http request. + * @member {string} [request.host] The externally accessible hostname of the + * registry instance, as specified by the http host header on incoming + * requests. + * @member {string} [request.method] The request method that generated the + * event. + * @member {string} [request.useragent] The user agent header of the request. + * @member {object} [actor] The agent that initiated the event. For most + * situations, this could be from the authorization context of the request. + * @member {string} [actor.name] The subject or username associated with the + * request context that generated the event. + * @member {object} [source] The registry node that generated the event. Put + * differently, while the actor initiates the event, the source generates it. + * @member {string} [source.addr] The IP or hostname and the port of the + * registry node that generated the event. Generally, this will be resolved + * by os.Hostname() along with the running port. + * @member {string} [source.instanceID] The running instance of an + * application. Changes after each restart. + */ + constructor() { + } + + /** + * Defines the metadata of EventContent + * + * @returns {object} metadata of EventContent + * + */ + mapper() { + return { + required: false, + serializedName: 'EventContent', + type: { + name: 'Composite', + className: 'EventContent', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + timestamp: { + required: false, + serializedName: 'timestamp', + type: { + name: 'DateTime' + } + }, + action: { + required: false, + serializedName: 'action', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'Composite', + className: 'Target' + } + }, + request: { + required: false, + serializedName: 'request', + type: { + name: 'Composite', + className: 'Request' + } + }, + actor: { + required: false, + serializedName: 'actor', + type: { + name: 'Composite', + className: 'Actor' + } + }, + source: { + required: false, + serializedName: 'source', + type: { + name: 'Composite', + className: 'Source' + } + } + } + } + }; + } +} + +module.exports = EventContent; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/eventInfo.js b/lib/services/containerRegistryManagement/lib/lib/models/eventInfo.js new file mode 100644 index 0000000000..188e3a4684 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/eventInfo.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The basic information of an event. + * + */ +class EventInfo { + /** + * Create a EventInfo. + * @member {string} [id] The event ID. + */ + constructor() { + } + + /** + * Defines the metadata of EventInfo + * + * @returns {object} metadata of EventInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'EventInfo', + type: { + name: 'Composite', + className: 'EventInfo', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventInfo; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/eventListResult.js b/lib/services/containerRegistryManagement/lib/lib/models/eventListResult.js new file mode 100644 index 0000000000..0db0d01992 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/eventListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of a request to list events for a webhook. + */ +class EventListResult extends Array { + /** + * Create a EventListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * list of events. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EventListResult + * + * @returns {object} metadata of EventListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'EventListResult', + type: { + name: 'Composite', + className: 'EventListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EventElementType', + type: { + name: 'Composite', + className: 'Event' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventListResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/eventRequestMessage.js b/lib/services/containerRegistryManagement/lib/lib/models/eventRequestMessage.js new file mode 100644 index 0000000000..448a66a9eb --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/eventRequestMessage.js @@ -0,0 +1,138 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The event request message sent to the service URI. + * + */ +class EventRequestMessage { + /** + * Create a EventRequestMessage. + * @member {object} [content] The content of the event request message. + * @member {string} [content.id] The event ID. + * @member {date} [content.timestamp] The time at which the event occurred. + * @member {string} [content.action] The action that encompasses the provided + * event. + * @member {object} [content.target] The target of the event. + * @member {string} [content.target.mediaType] The MIME type of the + * referenced object. + * @member {number} [content.target.size] The number of bytes of the content. + * Same as Length field. + * @member {string} [content.target.digest] The digest of the content, as + * defined by the Registry V2 HTTP API Specification. + * @member {number} [content.target.length] The number of bytes of the + * content. Same as Size field. + * @member {string} [content.target.repository] The repository name. + * @member {string} [content.target.url] The direct URL to the content. + * @member {string} [content.target.tag] The tag name. + * @member {object} [content.request] The request that generated the event. + * @member {string} [content.request.id] The ID of the request that initiated + * the event. + * @member {string} [content.request.addr] The IP or hostname and possibly + * port of the client connection that initiated the event. This is the + * RemoteAddr from the standard http request. + * @member {string} [content.request.host] The externally accessible hostname + * of the registry instance, as specified by the http host header on incoming + * requests. + * @member {string} [content.request.method] The request method that + * generated the event. + * @member {string} [content.request.useragent] The user agent header of the + * request. + * @member {object} [content.actor] The agent that initiated the event. For + * most situations, this could be from the authorization context of the + * request. + * @member {string} [content.actor.name] The subject or username associated + * with the request context that generated the event. + * @member {object} [content.source] The registry node that generated the + * event. Put differently, while the actor initiates the event, the source + * generates it. + * @member {string} [content.source.addr] The IP or hostname and the port of + * the registry node that generated the event. Generally, this will be + * resolved by os.Hostname() along with the running port. + * @member {string} [content.source.instanceID] The running instance of an + * application. Changes after each restart. + * @member {object} [headers] The headers of the event request message. + * @member {string} [method] The HTTP method used to send the event request + * message. + * @member {string} [requestUri] The URI used to send the event request + * message. + * @member {string} [version] The HTTP message version. + */ + constructor() { + } + + /** + * Defines the metadata of EventRequestMessage + * + * @returns {object} metadata of EventRequestMessage + * + */ + mapper() { + return { + required: false, + serializedName: 'EventRequestMessage', + type: { + name: 'Composite', + className: 'EventRequestMessage', + modelProperties: { + content: { + required: false, + serializedName: 'content', + type: { + name: 'Composite', + className: 'EventContent' + } + }, + headers: { + required: false, + serializedName: 'headers', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + method: { + required: false, + serializedName: 'method', + type: { + name: 'String' + } + }, + requestUri: { + required: false, + serializedName: 'requestUri', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventRequestMessage; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/eventResponseMessage.js b/lib/services/containerRegistryManagement/lib/lib/models/eventResponseMessage.js new file mode 100644 index 0000000000..a9a47dc980 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/eventResponseMessage.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The event response message received from the service URI. + * + */ +class EventResponseMessage { + /** + * Create a EventResponseMessage. + * @member {string} [content] The content of the event response message. + * @member {object} [headers] The headers of the event response message. + * @member {string} [reasonPhrase] The reason phrase of the event response + * message. + * @member {string} [statusCode] The status code of the event response + * message. + * @member {string} [version] The HTTP message version. + */ + constructor() { + } + + /** + * Defines the metadata of EventResponseMessage + * + * @returns {object} metadata of EventResponseMessage + * + */ + mapper() { + return { + required: false, + serializedName: 'EventResponseMessage', + type: { + name: 'Composite', + className: 'EventResponseMessage', + modelProperties: { + content: { + required: false, + serializedName: 'content', + type: { + name: 'String' + } + }, + headers: { + required: false, + serializedName: 'headers', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + reasonPhrase: { + required: false, + serializedName: 'reasonPhrase', + type: { + name: 'String' + } + }, + statusCode: { + required: false, + serializedName: 'statusCode', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventResponseMessage; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/importImageParameters.js b/lib/services/containerRegistryManagement/lib/lib/models/importImageParameters.js new file mode 100644 index 0000000000..191b46a8a9 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/importImageParameters.js @@ -0,0 +1,107 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a ImportImageParameters. + */ +class ImportImageParameters { + /** + * Create a ImportImageParameters. + * @member {object} source The source of the image. + * @member {string} [source.resourceId] The resource identifier of the target + * Azure Container Registry. + * @member {string} [source.sourceImage] Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * @member {array} [targetTags] List of strings of the form repo[:tag]. When + * tag is omitted the source will be used (or 'latest' if source tag is also + * omitted). + * @member {array} [untaggedTargetRepositories] List of strings of repository + * names to do a manifest only copy. No tag will be created. + * @member {string} [mode] When Force, any existing target tags will be + * overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force'. Default value: 'NoForce' . + */ + constructor() { + } + + /** + * Defines the metadata of ImportImageParameters + * + * @returns {object} metadata of ImportImageParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ImportImageParameters', + type: { + name: 'Composite', + className: 'ImportImageParameters', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ImportSource' + } + }, + targetTags: { + required: false, + serializedName: 'targetTags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + untaggedTargetRepositories: { + required: false, + serializedName: 'untaggedTargetRepositories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + mode: { + required: false, + serializedName: 'mode', + defaultValue: 'NoForce', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImportImageParameters; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/importSource.js b/lib/services/containerRegistryManagement/lib/lib/models/importSource.js new file mode 100644 index 0000000000..43a81fbb5e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/importSource.js @@ -0,0 +1,65 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Class representing a ImportSource. + */ +class ImportSource { + /** + * Create a ImportSource. + * @member {string} resourceId The resource identifier of the target Azure + * Container Registry. + * @member {string} sourceImage Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + */ + constructor() { + } + + /** + * Defines the metadata of ImportSource + * + * @returns {object} metadata of ImportSource + * + */ + mapper() { + return { + required: false, + serializedName: 'ImportSource', + type: { + name: 'Composite', + className: 'ImportSource', + modelProperties: { + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + sourceImage: { + required: true, + serializedName: 'sourceImage', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImportSource; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/index.d.ts b/lib/services/containerRegistryManagement/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..270349182e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/index.d.ts @@ -0,0 +1,867 @@ +/* + * 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 { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the ImportSource class. + * @constructor + * @member {string} resourceId The resource identifier of the target Azure + * Container Registry. + * @member {string} sourceImage Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + */ +export interface ImportSource { + resourceId: string; + sourceImage: string; +} + +/** + * @class + * Initializes a new instance of the ImportImageParameters class. + * @constructor + * @member {object} source The source of the image. + * @member {string} [source.resourceId] The resource identifier of the target + * Azure Container Registry. + * @member {string} [source.sourceImage] Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * @member {array} [targetTags] List of strings of the form repo[:tag]. When + * tag is omitted the source will be used (or 'latest' if source tag is also + * omitted). + * @member {array} [untaggedTargetRepositories] List of strings of repository + * names to do a manifest only copy. No tag will be created. + * @member {string} [mode] When Force, any existing target tags will be + * overwritten. When NoForce, any existing target tags will fail the operation + * before any copying begins. Possible values include: 'NoForce', 'Force'. + * Default value: 'NoForce' . + */ +export interface ImportImageParameters { + source: ImportSource; + targetTags?: string[]; + untaggedTargetRepositories?: string[]; + mode?: string; +} + +/** + * @class + * Initializes a new instance of the RegistryNameCheckRequest class. + * @constructor + * A request to check whether a container registry name is available. + * + * @member {string} name The name of the container registry. + */ +export interface RegistryNameCheckRequest { + name: string; +} + +/** + * @class + * Initializes a new instance of the RegistryNameStatus class. + * @constructor + * The result of a request to check the availability of a container registry + * name. + * + * @member {boolean} [nameAvailable] The value that indicates whether the name + * is available. + * @member {string} [reason] If any, the reason that the name is not available. + * @member {string} [message] If any, the error message that provides more + * detail for the reason that the name is not available. + */ +export interface RegistryNameStatus { + nameAvailable?: boolean; + reason?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplayDefinition class. + * @constructor + * The display information for a container registry operation. + * + * @member {string} [provider] The resource provider name: + * Microsoft.ContainerRegistry. + * @member {string} [resource] The resource on which the operation is + * performed. + * @member {string} [operation] The operation that users can perform. + * @member {string} [description] The description for the operation. + */ +export interface OperationDisplayDefinition { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDefinition class. + * @constructor + * The definition of a container registry operation. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + * @member {object} [display] The display information for the container + * registry operation. + * @member {string} [display.provider] The resource provider name: + * Microsoft.ContainerRegistry. + * @member {string} [display.resource] The resource on which the operation is + * performed. + * @member {string} [display.operation] The operation that users can perform. + * @member {string} [display.description] The description for the operation. + */ +export interface OperationDefinition { + name?: string; + display?: OperationDisplayDefinition; +} + +/** + * @class + * Initializes a new instance of the Sku class. + * @constructor + * The SKU of a container registry. + * + * @member {string} name The SKU name of the container registry. Required for + * registry creation. Possible values include: 'Classic', 'Basic', 'Standard', + * 'Premium' + * @member {string} [tier] The SKU tier based on the SKU name. Possible values + * include: 'Classic', 'Basic', 'Standard', 'Premium' + */ +export interface Sku { + name: string; + readonly tier?: string; +} + +/** + * @class + * Initializes a new instance of the Status class. + * @constructor + * The status of an Azure resource at the time the operation was called. + * + * @member {string} [displayStatus] The short label for the status. + * @member {string} [message] The detailed message for the status, including + * alerts and error messages. + * @member {date} [timestamp] The timestamp when the status was changed to the + * current value. + */ +export interface Status { + readonly displayStatus?: string; + readonly message?: string; + readonly timestamp?: Date; +} + +/** + * @class + * Initializes a new instance of the StorageAccountProperties class. + * @constructor + * The properties of a storage account for a container registry. Only + * applicable to Classic SKU. + * + * @member {string} id The resource ID of the storage account. + */ +export interface StorageAccountProperties { + id: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * An Azure resource. + * + * @member {string} [id] The resource ID. + * @member {string} [name] The name of the resource. + * @member {string} [type] The type of the resource. + * @member {string} location The location of the resource. This cannot be + * changed after the resource is created. + * @member {object} [tags] The tags of the resource. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the Registry class. + * @constructor + * An object that represents a container registry. + * + * @member {object} sku The SKU of the container registry. + * @member {string} [sku.name] The SKU name of the container registry. Required + * for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * @member {string} [sku.tier] The SKU tier based on the SKU name. Possible + * values include: 'Classic', 'Basic', 'Standard', 'Premium' + * @member {string} [loginServer] The URL that can be used to log into the + * container registry. + * @member {date} [creationDate] The creation date of the container registry in + * ISO8601 format. + * @member {string} [provisioningState] The provisioning state of the container + * registry at the time the operation was called. Possible values include: + * 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + * @member {object} [status] The status of the container registry at the time + * the operation was called. + * @member {string} [status.displayStatus] The short label for the status. + * @member {string} [status.message] The detailed message for the status, + * including alerts and error messages. + * @member {date} [status.timestamp] The timestamp when the status was changed + * to the current value. + * @member {boolean} [adminUserEnabled] The value that indicates whether the + * admin user is enabled. Default value: false . + * @member {object} [storageAccount] The properties of the storage account for + * the container registry. Only applicable to Classic SKU. + * @member {string} [storageAccount.id] The resource ID of the storage account. + */ +export interface Registry extends Resource { + sku: Sku; + readonly loginServer?: string; + readonly creationDate?: Date; + readonly provisioningState?: string; + readonly status?: Status; + adminUserEnabled?: boolean; + storageAccount?: StorageAccountProperties; +} + +/** + * @class + * Initializes a new instance of the RegistryUpdateParameters class. + * @constructor + * The parameters for updating a container registry. + * + * @member {object} [tags] The tags for the container registry. + * @member {object} [sku] The SKU of the container registry. + * @member {string} [sku.name] The SKU name of the container registry. Required + * for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * @member {string} [sku.tier] The SKU tier based on the SKU name. Possible + * values include: 'Classic', 'Basic', 'Standard', 'Premium' + * @member {boolean} [adminUserEnabled] The value that indicates whether the + * admin user is enabled. + * @member {object} [storageAccount] The parameters of a storage account for + * the container registry. Only applicable to Classic SKU. If specified, the + * storage account must be in the same physical location as the container + * registry. + * @member {string} [storageAccount.id] The resource ID of the storage account. + */ +export interface RegistryUpdateParameters { + tags?: { [propertyName: string]: string }; + sku?: Sku; + adminUserEnabled?: boolean; + storageAccount?: StorageAccountProperties; +} + +/** + * @class + * Initializes a new instance of the RegistryPassword class. + * @constructor + * The login password for the container registry. + * + * @member {string} [name] The password name. Possible values include: + * 'password', 'password2' + * @member {string} [value] The password value. + */ +export interface RegistryPassword { + name?: string; + value?: string; +} + +/** + * @class + * Initializes a new instance of the RegistryListCredentialsResult class. + * @constructor + * The response from the ListCredentials operation. + * + * @member {string} [username] The username for a container registry. + * @member {array} [passwords] The list of passwords for a container registry. + */ +export interface RegistryListCredentialsResult { + username?: string; + passwords?: RegistryPassword[]; +} + +/** + * @class + * Initializes a new instance of the RegenerateCredentialParameters class. + * @constructor + * The parameters used to regenerate the login credential. + * + * @member {string} name Specifies name of the password which should be + * regenerated -- password or password2. Possible values include: 'password', + * 'password2' + */ +export interface RegenerateCredentialParameters { + name: string; +} + +/** + * @class + * Initializes a new instance of the RegistryUsage class. + * @constructor + * The quota usage for a container registry. + * + * @member {string} [name] The name of the usage. + * @member {number} [limit] The limit of the usage. + * @member {number} [currentValue] The current value of the usage. + * @member {string} [unit] The unit of measurement. Possible values include: + * 'Count', 'Bytes' + */ +export interface RegistryUsage { + name?: string; + limit?: number; + currentValue?: number; + unit?: string; +} + +/** + * @class + * Initializes a new instance of the RegistryUsageListResult class. + * @constructor + * The result of a request to get container registry quota usages. + * + * @member {array} [value] The list of container registry quota usages. + */ +export interface RegistryUsageListResult { + value?: RegistryUsage[]; +} + +/** + * @class + * Initializes a new instance of the Replication class. + * @constructor + * An object that represents a replication for a container registry. + * + * @member {string} [provisioningState] The provisioning state of the + * replication at the time the operation was called. Possible values include: + * 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + * @member {object} [status] The status of the replication at the time the + * operation was called. + * @member {string} [status.displayStatus] The short label for the status. + * @member {string} [status.message] The detailed message for the status, + * including alerts and error messages. + * @member {date} [status.timestamp] The timestamp when the status was changed + * to the current value. + */ +export interface Replication extends Resource { + readonly provisioningState?: string; + readonly status?: Status; +} + +/** + * @class + * Initializes a new instance of the ReplicationUpdateParameters class. + * @constructor + * The parameters for updating a replication. + * + * @member {object} [tags] The tags for the replication. + */ +export interface ReplicationUpdateParameters { + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the Webhook class. + * @constructor + * An object that represents a webhook for a container registry. + * + * @member {string} [status] The status of the webhook at the time the + * operation was called. Possible values include: 'enabled', 'disabled' + * @member {string} [scope] The scope of repositories where the event can be + * triggered. For example, 'foo:*' means events for all tags under repository + * 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + * 'foo:latest'. Empty means all events. + * @member {array} actions The list of actions that trigger the webhook to post + * notifications. + * @member {string} [provisioningState] The provisioning state of the webhook + * at the time the operation was called. Possible values include: 'Creating', + * 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + */ +export interface Webhook extends Resource { + status?: string; + scope?: string; + actions: string[]; + readonly provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookCreateParameters class. + * @constructor + * The parameters for creating a webhook. + * + * @member {object} [tags] The tags for the webhook. + * @member {string} location The location of the webhook. This cannot be + * changed after the resource is created. + * @member {string} serviceUri The service URI for the webhook to post + * notifications. + * @member {object} [customHeaders] Custom headers that will be added to the + * webhook notifications. + * @member {string} [status] The status of the webhook at the time the + * operation was called. Possible values include: 'enabled', 'disabled' + * @member {string} [scope] The scope of repositories where the event can be + * triggered. For example, 'foo:*' means events for all tags under repository + * 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + * 'foo:latest'. Empty means all events. + * @member {array} actions The list of actions that trigger the webhook to post + * notifications. + */ +export interface WebhookCreateParameters { + tags?: { [propertyName: string]: string }; + location: string; + serviceUri: string; + customHeaders?: { [propertyName: string]: string }; + status?: string; + scope?: string; + actions: string[]; +} + +/** + * @class + * Initializes a new instance of the WebhookUpdateParameters class. + * @constructor + * The parameters for updating a webhook. + * + * @member {object} [tags] The tags for the webhook. + * @member {string} [serviceUri] The service URI for the webhook to post + * notifications. + * @member {object} [customHeaders] Custom headers that will be added to the + * webhook notifications. + * @member {string} [status] The status of the webhook at the time the + * operation was called. Possible values include: 'enabled', 'disabled' + * @member {string} [scope] The scope of repositories where the event can be + * triggered. For example, 'foo:*' means events for all tags under repository + * 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + * 'foo:latest'. Empty means all events. + * @member {array} [actions] The list of actions that trigger the webhook to + * post notifications. + */ +export interface WebhookUpdateParameters { + tags?: { [propertyName: string]: string }; + serviceUri?: string; + customHeaders?: { [propertyName: string]: string }; + status?: string; + scope?: string; + actions?: string[]; +} + +/** + * @class + * Initializes a new instance of the EventInfo class. + * @constructor + * The basic information of an event. + * + * @member {string} [id] The event ID. + */ +export interface EventInfo { + id?: string; +} + +/** + * @class + * Initializes a new instance of the CallbackConfig class. + * @constructor + * The configuration of service URI and custom headers for the webhook. + * + * @member {string} serviceUri The service URI for the webhook to post + * notifications. + * @member {object} [customHeaders] Custom headers that will be added to the + * webhook notifications. + */ +export interface CallbackConfig { + serviceUri: string; + customHeaders?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the Target class. + * @constructor + * The target of the event. + * + * @member {string} [mediaType] The MIME type of the referenced object. + * @member {number} [size] The number of bytes of the content. Same as Length + * field. + * @member {string} [digest] The digest of the content, as defined by the + * Registry V2 HTTP API Specification. + * @member {number} [length] The number of bytes of the content. Same as Size + * field. + * @member {string} [repository] The repository name. + * @member {string} [url] The direct URL to the content. + * @member {string} [tag] The tag name. + */ +export interface Target { + mediaType?: string; + size?: number; + digest?: string; + length?: number; + repository?: string; + url?: string; + tag?: string; +} + +/** + * @class + * Initializes a new instance of the Request class. + * @constructor + * The request that generated the event. + * + * @member {string} [id] The ID of the request that initiated the event. + * @member {string} [addr] The IP or hostname and possibly port of the client + * connection that initiated the event. This is the RemoteAddr from the + * standard http request. + * @member {string} [host] The externally accessible hostname of the registry + * instance, as specified by the http host header on incoming requests. + * @member {string} [method] The request method that generated the event. + * @member {string} [useragent] The user agent header of the request. + */ +export interface Request { + id?: string; + addr?: string; + host?: string; + method?: string; + useragent?: string; +} + +/** + * @class + * Initializes a new instance of the Actor class. + * @constructor + * The agent that initiated the event. For most situations, this could be from + * the authorization context of the request. + * + * @member {string} [name] The subject or username associated with the request + * context that generated the event. + */ +export interface Actor { + name?: string; +} + +/** + * @class + * Initializes a new instance of the Source class. + * @constructor + * The registry node that generated the event. Put differently, while the actor + * initiates the event, the source generates it. + * + * @member {string} [addr] The IP or hostname and the port of the registry node + * that generated the event. Generally, this will be resolved by os.Hostname() + * along with the running port. + * @member {string} [instanceID] The running instance of an application. + * Changes after each restart. + */ +export interface Source { + addr?: string; + instanceID?: string; +} + +/** + * @class + * Initializes a new instance of the EventContent class. + * @constructor + * The content of the event request message. + * + * @member {string} [id] The event ID. + * @member {date} [timestamp] The time at which the event occurred. + * @member {string} [action] The action that encompasses the provided event. + * @member {object} [target] The target of the event. + * @member {string} [target.mediaType] The MIME type of the referenced object. + * @member {number} [target.size] The number of bytes of the content. Same as + * Length field. + * @member {string} [target.digest] The digest of the content, as defined by + * the Registry V2 HTTP API Specification. + * @member {number} [target.length] The number of bytes of the content. Same as + * Size field. + * @member {string} [target.repository] The repository name. + * @member {string} [target.url] The direct URL to the content. + * @member {string} [target.tag] The tag name. + * @member {object} [request] The request that generated the event. + * @member {string} [request.id] The ID of the request that initiated the + * event. + * @member {string} [request.addr] The IP or hostname and possibly port of the + * client connection that initiated the event. This is the RemoteAddr from the + * standard http request. + * @member {string} [request.host] The externally accessible hostname of the + * registry instance, as specified by the http host header on incoming + * requests. + * @member {string} [request.method] The request method that generated the + * event. + * @member {string} [request.useragent] The user agent header of the request. + * @member {object} [actor] The agent that initiated the event. For most + * situations, this could be from the authorization context of the request. + * @member {string} [actor.name] The subject or username associated with the + * request context that generated the event. + * @member {object} [source] The registry node that generated the event. Put + * differently, while the actor initiates the event, the source generates it. + * @member {string} [source.addr] The IP or hostname and the port of the + * registry node that generated the event. Generally, this will be resolved by + * os.Hostname() along with the running port. + * @member {string} [source.instanceID] The running instance of an application. + * Changes after each restart. + */ +export interface EventContent { + id?: string; + timestamp?: Date; + action?: string; + target?: Target; + request?: Request; + actor?: Actor; + source?: Source; +} + +/** + * @class + * Initializes a new instance of the EventRequestMessage class. + * @constructor + * The event request message sent to the service URI. + * + * @member {object} [content] The content of the event request message. + * @member {string} [content.id] The event ID. + * @member {date} [content.timestamp] The time at which the event occurred. + * @member {string} [content.action] The action that encompasses the provided + * event. + * @member {object} [content.target] The target of the event. + * @member {string} [content.target.mediaType] The MIME type of the referenced + * object. + * @member {number} [content.target.size] The number of bytes of the content. + * Same as Length field. + * @member {string} [content.target.digest] The digest of the content, as + * defined by the Registry V2 HTTP API Specification. + * @member {number} [content.target.length] The number of bytes of the content. + * Same as Size field. + * @member {string} [content.target.repository] The repository name. + * @member {string} [content.target.url] The direct URL to the content. + * @member {string} [content.target.tag] The tag name. + * @member {object} [content.request] The request that generated the event. + * @member {string} [content.request.id] The ID of the request that initiated + * the event. + * @member {string} [content.request.addr] The IP or hostname and possibly port + * of the client connection that initiated the event. This is the RemoteAddr + * from the standard http request. + * @member {string} [content.request.host] The externally accessible hostname + * of the registry instance, as specified by the http host header on incoming + * requests. + * @member {string} [content.request.method] The request method that generated + * the event. + * @member {string} [content.request.useragent] The user agent header of the + * request. + * @member {object} [content.actor] The agent that initiated the event. For + * most situations, this could be from the authorization context of the + * request. + * @member {string} [content.actor.name] The subject or username associated + * with the request context that generated the event. + * @member {object} [content.source] The registry node that generated the + * event. Put differently, while the actor initiates the event, the source + * generates it. + * @member {string} [content.source.addr] The IP or hostname and the port of + * the registry node that generated the event. Generally, this will be resolved + * by os.Hostname() along with the running port. + * @member {string} [content.source.instanceID] The running instance of an + * application. Changes after each restart. + * @member {object} [headers] The headers of the event request message. + * @member {string} [method] The HTTP method used to send the event request + * message. + * @member {string} [requestUri] The URI used to send the event request + * message. + * @member {string} [version] The HTTP message version. + */ +export interface EventRequestMessage { + content?: EventContent; + headers?: { [propertyName: string]: string }; + method?: string; + requestUri?: string; + version?: string; +} + +/** + * @class + * Initializes a new instance of the EventResponseMessage class. + * @constructor + * The event response message received from the service URI. + * + * @member {string} [content] The content of the event response message. + * @member {object} [headers] The headers of the event response message. + * @member {string} [reasonPhrase] The reason phrase of the event response + * message. + * @member {string} [statusCode] The status code of the event response message. + * @member {string} [version] The HTTP message version. + */ +export interface EventResponseMessage { + content?: string; + headers?: { [propertyName: string]: string }; + reasonPhrase?: string; + statusCode?: string; + version?: string; +} + +/** + * @class + * Initializes a new instance of the Event class. + * @constructor + * The event for a webhook. + * + * @member {object} [eventRequestMessage] The event request message sent to the + * service URI. + * @member {object} [eventRequestMessage.content] The content of the event + * request message. + * @member {string} [eventRequestMessage.content.id] The event ID. + * @member {date} [eventRequestMessage.content.timestamp] The time at which the + * event occurred. + * @member {string} [eventRequestMessage.content.action] The action that + * encompasses the provided event. + * @member {object} [eventRequestMessage.content.target] The target of the + * event. + * @member {string} [eventRequestMessage.content.target.mediaType] The MIME + * type of the referenced object. + * @member {number} [eventRequestMessage.content.target.size] The number of + * bytes of the content. Same as Length field. + * @member {string} [eventRequestMessage.content.target.digest] The digest of + * the content, as defined by the Registry V2 HTTP API Specification. + * @member {number} [eventRequestMessage.content.target.length] The number of + * bytes of the content. Same as Size field. + * @member {string} [eventRequestMessage.content.target.repository] The + * repository name. + * @member {string} [eventRequestMessage.content.target.url] The direct URL to + * the content. + * @member {string} [eventRequestMessage.content.target.tag] The tag name. + * @member {object} [eventRequestMessage.content.request] The request that + * generated the event. + * @member {string} [eventRequestMessage.content.request.id] The ID of the + * request that initiated the event. + * @member {string} [eventRequestMessage.content.request.addr] The IP or + * hostname and possibly port of the client connection that initiated the + * event. This is the RemoteAddr from the standard http request. + * @member {string} [eventRequestMessage.content.request.host] The externally + * accessible hostname of the registry instance, as specified by the http host + * header on incoming requests. + * @member {string} [eventRequestMessage.content.request.method] The request + * method that generated the event. + * @member {string} [eventRequestMessage.content.request.useragent] The user + * agent header of the request. + * @member {object} [eventRequestMessage.content.actor] The agent that + * initiated the event. For most situations, this could be from the + * authorization context of the request. + * @member {string} [eventRequestMessage.content.actor.name] The subject or + * username associated with the request context that generated the event. + * @member {object} [eventRequestMessage.content.source] The registry node that + * generated the event. Put differently, while the actor initiates the event, + * the source generates it. + * @member {string} [eventRequestMessage.content.source.addr] The IP or + * hostname and the port of the registry node that generated the event. + * Generally, this will be resolved by os.Hostname() along with the running + * port. + * @member {string} [eventRequestMessage.content.source.instanceID] The running + * instance of an application. Changes after each restart. + * @member {object} [eventRequestMessage.headers] The headers of the event + * request message. + * @member {string} [eventRequestMessage.method] The HTTP method used to send + * the event request message. + * @member {string} [eventRequestMessage.requestUri] The URI used to send the + * event request message. + * @member {string} [eventRequestMessage.version] The HTTP message version. + * @member {object} [eventResponseMessage] The event response message received + * from the service URI. + * @member {string} [eventResponseMessage.content] The content of the event + * response message. + * @member {object} [eventResponseMessage.headers] The headers of the event + * response message. + * @member {string} [eventResponseMessage.reasonPhrase] The reason phrase of + * the event response message. + * @member {string} [eventResponseMessage.statusCode] The status code of the + * event response message. + * @member {string} [eventResponseMessage.version] The HTTP message version. + */ +export interface Event extends EventInfo { + eventRequestMessage?: EventRequestMessage; + eventResponseMessage?: EventResponseMessage; +} + + +/** + * @class + * Initializes a new instance of the RegistryListResult class. + * @constructor + * The result of a request to list container registries. + * + * @member {string} [nextLink] The URI that can be used to request the next + * list of container registries. + */ +export interface RegistryListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * The result of a request to list container registry operations. + * + * @member {string} [nextLink] The URI that can be used to request the next + * list of container registry operations. + */ +export interface OperationListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ReplicationListResult class. + * @constructor + * The result of a request to list replications for a container registry. + * + * @member {string} [nextLink] The URI that can be used to request the next + * list of replications. + */ +export interface ReplicationListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookListResult class. + * @constructor + * The result of a request to list webhooks for a container registry. + * + * @member {string} [nextLink] The URI that can be used to request the next + * list of webhooks. + */ +export interface WebhookListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EventListResult class. + * @constructor + * The result of a request to list events for a webhook. + * + * @member {string} [nextLink] The URI that can be used to request the next + * list of events. + */ +export interface EventListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/containerRegistryManagement/lib/lib/models/index.js b/lib/services/containerRegistryManagement/lib/lib/models/index.js new file mode 100644 index 0000000000..937ec8aaeb --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/index.js @@ -0,0 +1,57 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.ImportSource = require('./importSource'); +exports.ImportImageParameters = require('./importImageParameters'); +exports.RegistryNameCheckRequest = require('./registryNameCheckRequest'); +exports.RegistryNameStatus = require('./registryNameStatus'); +exports.OperationDisplayDefinition = require('./operationDisplayDefinition'); +exports.OperationDefinition = require('./operationDefinition'); +exports.Sku = require('./sku'); +exports.Status = require('./status'); +exports.StorageAccountProperties = require('./storageAccountProperties'); +exports.Resource = require('./resource'); +exports.Registry = require('./registry'); +exports.RegistryUpdateParameters = require('./registryUpdateParameters'); +exports.RegistryPassword = require('./registryPassword'); +exports.RegistryListCredentialsResult = require('./registryListCredentialsResult'); +exports.RegenerateCredentialParameters = require('./regenerateCredentialParameters'); +exports.RegistryUsage = require('./registryUsage'); +exports.RegistryUsageListResult = require('./registryUsageListResult'); +exports.Replication = require('./replication'); +exports.ReplicationUpdateParameters = require('./replicationUpdateParameters'); +exports.Webhook = require('./webhook'); +exports.WebhookCreateParameters = require('./webhookCreateParameters'); +exports.WebhookUpdateParameters = require('./webhookUpdateParameters'); +exports.EventInfo = require('./eventInfo'); +exports.CallbackConfig = require('./callbackConfig'); +exports.Target = require('./target'); +exports.Request = require('./request'); +exports.Actor = require('./actor'); +exports.Source = require('./source'); +exports.EventContent = require('./eventContent'); +exports.EventRequestMessage = require('./eventRequestMessage'); +exports.EventResponseMessage = require('./eventResponseMessage'); +exports.Event = require('./event'); +exports.RegistryListResult = require('./registryListResult'); +exports.OperationListResult = require('./operationListResult'); +exports.ReplicationListResult = require('./replicationListResult'); +exports.WebhookListResult = require('./webhookListResult'); +exports.EventListResult = require('./eventListResult'); diff --git a/lib/services/containerRegistryManagement/lib/lib/models/operationDefinition.js b/lib/services/containerRegistryManagement/lib/lib/models/operationDefinition.js new file mode 100644 index 0000000000..7b3239ce82 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/operationDefinition.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The definition of a container registry operation. + * + */ +class OperationDefinition { + /** + * Create a OperationDefinition. + * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + * @member {object} [display] The display information for the container + * registry operation. + * @member {string} [display.provider] The resource provider name: + * Microsoft.ContainerRegistry. + * @member {string} [display.resource] The resource on which the operation is + * performed. + * @member {string} [display.operation] The operation that users can perform. + * @member {string} [display.description] The description for the operation. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDefinition + * + * @returns {object} metadata of OperationDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDefinition', + type: { + name: 'Composite', + className: 'OperationDefinition', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplayDefinition' + } + } + } + } + }; + } +} + +module.exports = OperationDefinition; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/operationDisplayDefinition.js b/lib/services/containerRegistryManagement/lib/lib/models/operationDisplayDefinition.js new file mode 100644 index 0000000000..2d31fa5146 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/operationDisplayDefinition.js @@ -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. + */ + +'use strict'; + +/** + * The display information for a container registry operation. + * + */ +class OperationDisplayDefinition { + /** + * Create a OperationDisplayDefinition. + * @member {string} [provider] The resource provider name: + * Microsoft.ContainerRegistry. + * @member {string} [resource] The resource on which the operation is + * performed. + * @member {string} [operation] The operation that users can perform. + * @member {string} [description] The description for the operation. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplayDefinition + * + * @returns {object} metadata of OperationDisplayDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDisplayDefinition', + type: { + name: 'Composite', + className: 'OperationDisplayDefinition', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplayDefinition; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/operationListResult.js b/lib/services/containerRegistryManagement/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..e0abee0a71 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/operationListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of a request to list container registry operations. + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * list of container registry operations. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationDefinitionElementType', + type: { + name: 'Composite', + className: 'OperationDefinition' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/regenerateCredentialParameters.js b/lib/services/containerRegistryManagement/lib/lib/models/regenerateCredentialParameters.js new file mode 100644 index 0000000000..1c774358fb --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/regenerateCredentialParameters.js @@ -0,0 +1,55 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The parameters used to regenerate the login credential. + * + */ +class RegenerateCredentialParameters { + /** + * Create a RegenerateCredentialParameters. + * @member {string} name Specifies name of the password which should be + * regenerated -- password or password2. Possible values include: 'password', + * 'password2' + */ + constructor() { + } + + /** + * Defines the metadata of RegenerateCredentialParameters + * + * @returns {object} metadata of RegenerateCredentialParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RegenerateCredentialParameters', + type: { + name: 'Composite', + className: 'RegenerateCredentialParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'Enum', + allowedValues: [ 'password', 'password2' ] + } + } + } + } + }; + } +} + +module.exports = RegenerateCredentialParameters; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registry.js b/lib/services/containerRegistryManagement/lib/lib/models/registry.js new file mode 100644 index 0000000000..5cc411d10d --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registry.js @@ -0,0 +1,177 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An object that represents a container registry. + * + * @extends models['Resource'] + */ +class Registry extends models['Resource'] { + /** + * Create a Registry. + * @member {object} sku The SKU of the container registry. + * @member {string} [sku.name] The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', + * 'Basic', 'Standard', 'Premium' + * @member {string} [sku.tier] The SKU tier based on the SKU name. Possible + * values include: 'Classic', 'Basic', 'Standard', 'Premium' + * @member {string} [loginServer] The URL that can be used to log into the + * container registry. + * @member {date} [creationDate] The creation date of the container registry + * in ISO8601 format. + * @member {string} [provisioningState] The provisioning state of the + * container registry at the time the operation was called. Possible values + * include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + * 'Canceled' + * @member {object} [status] The status of the container registry at the time + * the operation was called. + * @member {string} [status.displayStatus] The short label for the status. + * @member {string} [status.message] The detailed message for the status, + * including alerts and error messages. + * @member {date} [status.timestamp] The timestamp when the status was + * changed to the current value. + * @member {boolean} [adminUserEnabled] The value that indicates whether the + * admin user is enabled. Default value: false . + * @member {object} [storageAccount] The properties of the storage account + * for the container registry. Only applicable to Classic SKU. + * @member {string} [storageAccount.id] The resource ID of the storage + * account. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Registry + * + * @returns {object} metadata of Registry + * + */ + mapper() { + return { + required: false, + serializedName: 'Registry', + type: { + name: 'Composite', + className: 'Registry', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sku: { + required: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + loginServer: { + required: false, + readOnly: true, + serializedName: 'properties.loginServer', + type: { + name: 'String' + } + }, + creationDate: { + required: false, + readOnly: true, + serializedName: 'properties.creationDate', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'Composite', + className: 'Status' + } + }, + adminUserEnabled: { + required: false, + serializedName: 'properties.adminUserEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + storageAccount: { + required: false, + serializedName: 'properties.storageAccount', + type: { + name: 'Composite', + className: 'StorageAccountProperties' + } + } + } + } + }; + } +} + +module.exports = Registry; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryListCredentialsResult.js b/lib/services/containerRegistryManagement/lib/lib/models/registryListCredentialsResult.js new file mode 100644 index 0000000000..0a5f25943f --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryListCredentialsResult.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The response from the ListCredentials operation. + * + */ +class RegistryListCredentialsResult { + /** + * Create a RegistryListCredentialsResult. + * @member {string} [username] The username for a container registry. + * @member {array} [passwords] The list of passwords for a container + * registry. + */ + constructor() { + } + + /** + * Defines the metadata of RegistryListCredentialsResult + * + * @returns {object} metadata of RegistryListCredentialsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryListCredentialsResult', + type: { + name: 'Composite', + className: 'RegistryListCredentialsResult', + modelProperties: { + username: { + required: false, + serializedName: 'username', + type: { + name: 'String' + } + }, + passwords: { + required: false, + serializedName: 'passwords', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RegistryPasswordElementType', + type: { + name: 'Composite', + className: 'RegistryPassword' + } + } + } + } + } + } + }; + } +} + +module.exports = RegistryListCredentialsResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryListResult.js b/lib/services/containerRegistryManagement/lib/lib/models/registryListResult.js new file mode 100644 index 0000000000..8c8cbb710e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of a request to list container registries. + */ +class RegistryListResult extends Array { + /** + * Create a RegistryListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * list of container registries. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RegistryListResult + * + * @returns {object} metadata of RegistryListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryListResult', + type: { + name: 'Composite', + className: 'RegistryListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RegistryElementType', + type: { + name: 'Composite', + className: 'Registry' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegistryListResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryNameCheckRequest.js b/lib/services/containerRegistryManagement/lib/lib/models/registryNameCheckRequest.js new file mode 100644 index 0000000000..043ebb19e1 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryNameCheckRequest.js @@ -0,0 +1,66 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A request to check whether a container registry name is available. + * + */ +class RegistryNameCheckRequest { + /** + * Create a RegistryNameCheckRequest. + * @member {string} name The name of the container registry. + */ + constructor() { + } + + /** + * Defines the metadata of RegistryNameCheckRequest + * + * @returns {object} metadata of RegistryNameCheckRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryNameCheckRequest', + type: { + name: 'Composite', + className: 'RegistryNameCheckRequest', + modelProperties: { + name: { + required: true, + serializedName: 'name', + constraints: { + MaxLength: 50, + MinLength: 5, + Pattern: '^[a-zA-Z0-9]*$' + }, + type: { + name: 'String' + } + }, + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'Microsoft.ContainerRegistry/registries', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegistryNameCheckRequest; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryNameStatus.js b/lib/services/containerRegistryManagement/lib/lib/models/registryNameStatus.js new file mode 100644 index 0000000000..2b02ca7c49 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryNameStatus.js @@ -0,0 +1,72 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of a request to check the availability of a container registry + * name. + * + */ +class RegistryNameStatus { + /** + * Create a RegistryNameStatus. + * @member {boolean} [nameAvailable] The value that indicates whether the + * name is available. + * @member {string} [reason] If any, the reason that the name is not + * available. + * @member {string} [message] If any, the error message that provides more + * detail for the reason that the name is not available. + */ + constructor() { + } + + /** + * Defines the metadata of RegistryNameStatus + * + * @returns {object} metadata of RegistryNameStatus + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryNameStatus', + type: { + name: 'Composite', + className: 'RegistryNameStatus', + modelProperties: { + nameAvailable: { + required: false, + serializedName: 'nameAvailable', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegistryNameStatus; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryPassword.js b/lib/services/containerRegistryManagement/lib/lib/models/registryPassword.js new file mode 100644 index 0000000000..4b999036f4 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryPassword.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The login password for the container registry. + * + */ +class RegistryPassword { + /** + * Create a RegistryPassword. + * @member {string} [name] The password name. Possible values include: + * 'password', 'password2' + * @member {string} [value] The password value. + */ + constructor() { + } + + /** + * Defines the metadata of RegistryPassword + * + * @returns {object} metadata of RegistryPassword + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryPassword', + type: { + name: 'Composite', + className: 'RegistryPassword', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'Enum', + allowedValues: [ 'password', 'password2' ] + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegistryPassword; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryUpdateParameters.js b/lib/services/containerRegistryManagement/lib/lib/models/registryUpdateParameters.js new file mode 100644 index 0000000000..1dc1c65006 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryUpdateParameters.js @@ -0,0 +1,98 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The parameters for updating a container registry. + * + */ +class RegistryUpdateParameters { + /** + * Create a RegistryUpdateParameters. + * @member {object} [tags] The tags for the container registry. + * @member {object} [sku] The SKU of the container registry. + * @member {string} [sku.name] The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', + * 'Basic', 'Standard', 'Premium' + * @member {string} [sku.tier] The SKU tier based on the SKU name. Possible + * values include: 'Classic', 'Basic', 'Standard', 'Premium' + * @member {boolean} [adminUserEnabled] The value that indicates whether the + * admin user is enabled. + * @member {object} [storageAccount] The parameters of a storage account for + * the container registry. Only applicable to Classic SKU. If specified, the + * storage account must be in the same physical location as the container + * registry. + * @member {string} [storageAccount.id] The resource ID of the storage + * account. + */ + constructor() { + } + + /** + * Defines the metadata of RegistryUpdateParameters + * + * @returns {object} metadata of RegistryUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryUpdateParameters', + type: { + name: 'Composite', + className: 'RegistryUpdateParameters', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + adminUserEnabled: { + required: false, + serializedName: 'properties.adminUserEnabled', + type: { + name: 'Boolean' + } + }, + storageAccount: { + required: false, + serializedName: 'properties.storageAccount', + type: { + name: 'Composite', + className: 'StorageAccountProperties' + } + } + } + } + }; + } +} + +module.exports = RegistryUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryUsage.js b/lib/services/containerRegistryManagement/lib/lib/models/registryUsage.js new file mode 100644 index 0000000000..5b4172726f --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryUsage.js @@ -0,0 +1,77 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The quota usage for a container registry. + * + */ +class RegistryUsage { + /** + * Create a RegistryUsage. + * @member {string} [name] The name of the usage. + * @member {number} [limit] The limit of the usage. + * @member {number} [currentValue] The current value of the usage. + * @member {string} [unit] The unit of measurement. Possible values include: + * 'Count', 'Bytes' + */ + constructor() { + } + + /** + * Defines the metadata of RegistryUsage + * + * @returns {object} metadata of RegistryUsage + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryUsage', + type: { + name: 'Composite', + className: 'RegistryUsage', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + limit: { + required: false, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + currentValue: { + required: false, + serializedName: 'currentValue', + type: { + name: 'Number' + } + }, + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegistryUsage; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/registryUsageListResult.js b/lib/services/containerRegistryManagement/lib/lib/models/registryUsageListResult.js new file mode 100644 index 0000000000..47f1bd5f54 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/registryUsageListResult.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The result of a request to get container registry quota usages. + * + */ +class RegistryUsageListResult { + /** + * Create a RegistryUsageListResult. + * @member {array} [value] The list of container registry quota usages. + */ + constructor() { + } + + /** + * Defines the metadata of RegistryUsageListResult + * + * @returns {object} metadata of RegistryUsageListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RegistryUsageListResult', + type: { + name: 'Composite', + className: 'RegistryUsageListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RegistryUsageElementType', + type: { + name: 'Composite', + className: 'RegistryUsage' + } + } + } + } + } + } + }; + } +} + +module.exports = RegistryUsageListResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/replication.js b/lib/services/containerRegistryManagement/lib/lib/models/replication.js new file mode 100644 index 0000000000..be21b08fa7 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/replication.js @@ -0,0 +1,120 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An object that represents a replication for a container registry. + * + * @extends models['Resource'] + */ +class Replication extends models['Resource'] { + /** + * Create a Replication. + * @member {string} [provisioningState] The provisioning state of the + * replication at the time the operation was called. Possible values include: + * 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + * @member {object} [status] The status of the replication at the time the + * operation was called. + * @member {string} [status.displayStatus] The short label for the status. + * @member {string} [status.message] The detailed message for the status, + * including alerts and error messages. + * @member {date} [status.timestamp] The timestamp when the status was + * changed to the current value. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Replication + * + * @returns {object} metadata of Replication + * + */ + mapper() { + return { + required: false, + serializedName: 'Replication', + type: { + name: 'Composite', + className: 'Replication', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'Composite', + className: 'Status' + } + } + } + } + }; + } +} + +module.exports = Replication; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/replicationListResult.js b/lib/services/containerRegistryManagement/lib/lib/models/replicationListResult.js new file mode 100644 index 0000000000..49209165ec --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/replicationListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of a request to list replications for a container registry. + */ +class ReplicationListResult extends Array { + /** + * Create a ReplicationListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * list of replications. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ReplicationListResult + * + * @returns {object} metadata of ReplicationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ReplicationListResult', + type: { + name: 'Composite', + className: 'ReplicationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ReplicationElementType', + type: { + name: 'Composite', + className: 'Replication' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReplicationListResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/replicationUpdateParameters.js b/lib/services/containerRegistryManagement/lib/lib/models/replicationUpdateParameters.js new file mode 100644 index 0000000000..ebc76e0dab --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/replicationUpdateParameters.js @@ -0,0 +1,59 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The parameters for updating a replication. + * + */ +class ReplicationUpdateParameters { + /** + * Create a ReplicationUpdateParameters. + * @member {object} [tags] The tags for the replication. + */ + constructor() { + } + + /** + * Defines the metadata of ReplicationUpdateParameters + * + * @returns {object} metadata of ReplicationUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ReplicationUpdateParameters', + type: { + name: 'Composite', + className: 'ReplicationUpdateParameters', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ReplicationUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/request.js b/lib/services/containerRegistryManagement/lib/lib/models/request.js new file mode 100644 index 0000000000..0563d31203 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/request.js @@ -0,0 +1,87 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The request that generated the event. + * + */ +class Request { + /** + * Create a Request. + * @member {string} [id] The ID of the request that initiated the event. + * @member {string} [addr] The IP or hostname and possibly port of the client + * connection that initiated the event. This is the RemoteAddr from the + * standard http request. + * @member {string} [host] The externally accessible hostname of the registry + * instance, as specified by the http host header on incoming requests. + * @member {string} [method] The request method that generated the event. + * @member {string} [useragent] The user agent header of the request. + */ + constructor() { + } + + /** + * Defines the metadata of Request + * + * @returns {object} metadata of Request + * + */ + mapper() { + return { + required: false, + serializedName: 'Request', + type: { + name: 'Composite', + className: 'Request', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + addr: { + required: false, + serializedName: 'addr', + type: { + name: 'String' + } + }, + host: { + required: false, + serializedName: 'host', + type: { + name: 'String' + } + }, + method: { + required: false, + serializedName: 'method', + type: { + name: 'String' + } + }, + useragent: { + required: false, + serializedName: 'useragent', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Request; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/resource.js b/lib/services/containerRegistryManagement/lib/lib/models/resource.js new file mode 100644 index 0000000000..a8735b8e52 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/resource.js @@ -0,0 +1,99 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An Azure resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] The resource ID. + * @member {string} [name] The name of the resource. + * @member {string} [type] The type of the resource. + * @member {string} location The location of the resource. This cannot be + * changed after the resource is created. + * @member {object} [tags] The tags of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/sku.js b/lib/services/containerRegistryManagement/lib/lib/models/sku.js new file mode 100644 index 0000000000..f3568e3ee1 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/sku.js @@ -0,0 +1,64 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The SKU of a container registry. + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name The SKU name of the container registry. Required for + * registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * @member {string} [tier] The SKU tier based on the SKU name. Possible + * values include: 'Classic', 'Basic', 'Standard', 'Premium' + */ + constructor() { + } + + /** + * Defines the metadata of Sku + * + * @returns {object} metadata of Sku + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + readOnly: true, + serializedName: 'tier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/source.js b/lib/services/containerRegistryManagement/lib/lib/models/source.js new file mode 100644 index 0000000000..fdb3521d8b --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/source.js @@ -0,0 +1,64 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The registry node that generated the event. Put differently, while the actor + * initiates the event, the source generates it. + * + */ +class Source { + /** + * Create a Source. + * @member {string} [addr] The IP or hostname and the port of the registry + * node that generated the event. Generally, this will be resolved by + * os.Hostname() along with the running port. + * @member {string} [instanceID] The running instance of an application. + * Changes after each restart. + */ + constructor() { + } + + /** + * Defines the metadata of Source + * + * @returns {object} metadata of Source + * + */ + mapper() { + return { + required: false, + serializedName: 'Source', + type: { + name: 'Composite', + className: 'Source', + modelProperties: { + addr: { + required: false, + serializedName: 'addr', + type: { + name: 'String' + } + }, + instanceID: { + required: false, + serializedName: 'instanceID', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Source; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/status.js b/lib/services/containerRegistryManagement/lib/lib/models/status.js new file mode 100644 index 0000000000..1d98fafb26 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/status.js @@ -0,0 +1,73 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The status of an Azure resource at the time the operation was called. + * + */ +class Status { + /** + * Create a Status. + * @member {string} [displayStatus] The short label for the status. + * @member {string} [message] The detailed message for the status, including + * alerts and error messages. + * @member {date} [timestamp] The timestamp when the status was changed to + * the current value. + */ + constructor() { + } + + /** + * Defines the metadata of Status + * + * @returns {object} metadata of Status + * + */ + mapper() { + return { + required: false, + serializedName: 'Status', + type: { + name: 'Composite', + className: 'Status', + modelProperties: { + displayStatus: { + required: false, + readOnly: true, + serializedName: 'displayStatus', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + timestamp: { + required: false, + readOnly: true, + serializedName: 'timestamp', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = Status; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/storageAccountProperties.js b/lib/services/containerRegistryManagement/lib/lib/models/storageAccountProperties.js new file mode 100644 index 0000000000..b1cb9dde69 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/storageAccountProperties.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties of a storage account for a container registry. Only + * applicable to Classic SKU. + * + */ +class StorageAccountProperties { + /** + * Create a StorageAccountProperties. + * @member {string} id The resource ID of the storage account. + */ + constructor() { + } + + /** + * Defines the metadata of StorageAccountProperties + * + * @returns {object} metadata of StorageAccountProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountProperties', + type: { + name: 'Composite', + className: 'StorageAccountProperties', + modelProperties: { + id: { + required: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageAccountProperties; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/target.js b/lib/services/containerRegistryManagement/lib/lib/models/target.js new file mode 100644 index 0000000000..7ffed4f85a --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/target.js @@ -0,0 +1,103 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The target of the event. + * + */ +class Target { + /** + * Create a Target. + * @member {string} [mediaType] The MIME type of the referenced object. + * @member {number} [size] The number of bytes of the content. Same as Length + * field. + * @member {string} [digest] The digest of the content, as defined by the + * Registry V2 HTTP API Specification. + * @member {number} [length] The number of bytes of the content. Same as Size + * field. + * @member {string} [repository] The repository name. + * @member {string} [url] The direct URL to the content. + * @member {string} [tag] The tag name. + */ + constructor() { + } + + /** + * Defines the metadata of Target + * + * @returns {object} metadata of Target + * + */ + mapper() { + return { + required: false, + serializedName: 'Target', + type: { + name: 'Composite', + className: 'Target', + modelProperties: { + mediaType: { + required: false, + serializedName: 'mediaType', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'Number' + } + }, + digest: { + required: false, + serializedName: 'digest', + type: { + name: 'String' + } + }, + length: { + required: false, + serializedName: 'length', + type: { + name: 'Number' + } + }, + repository: { + required: false, + serializedName: 'repository', + type: { + name: 'String' + } + }, + url: { + required: false, + serializedName: 'url', + type: { + name: 'String' + } + }, + tag: { + required: false, + serializedName: 'tag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Target; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/webhook.js b/lib/services/containerRegistryManagement/lib/lib/models/webhook.js new file mode 100644 index 0000000000..a4081efafd --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/webhook.js @@ -0,0 +1,140 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An object that represents a webhook for a container registry. + * + * @extends models['Resource'] + */ +class Webhook extends models['Resource'] { + /** + * Create a Webhook. + * @member {string} [status] The status of the webhook at the time the + * operation was called. Possible values include: 'enabled', 'disabled' + * @member {string} [scope] The scope of repositories where the event can be + * triggered. For example, 'foo:*' means events for all tags under repository + * 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + * 'foo:latest'. Empty means all events. + * @member {array} actions The list of actions that trigger the webhook to + * post notifications. + * @member {string} [provisioningState] The provisioning state of the webhook + * at the time the operation was called. Possible values include: 'Creating', + * 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Webhook + * + * @returns {object} metadata of Webhook + * + */ + mapper() { + return { + required: false, + serializedName: 'Webhook', + type: { + name: 'Composite', + className: 'Webhook', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'properties.scope', + type: { + name: 'String' + } + }, + actions: { + required: true, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Webhook; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/webhookCreateParameters.js b/lib/services/containerRegistryManagement/lib/lib/models/webhookCreateParameters.js new file mode 100644 index 0000000000..4fff23fe37 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/webhookCreateParameters.js @@ -0,0 +1,129 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The parameters for creating a webhook. + * + */ +class WebhookCreateParameters { + /** + * Create a WebhookCreateParameters. + * @member {object} [tags] The tags for the webhook. + * @member {string} location The location of the webhook. This cannot be + * changed after the resource is created. + * @member {string} serviceUri The service URI for the webhook to post + * notifications. + * @member {object} [customHeaders] Custom headers that will be added to the + * webhook notifications. + * @member {string} [status] The status of the webhook at the time the + * operation was called. Possible values include: 'enabled', 'disabled' + * @member {string} [scope] The scope of repositories where the event can be + * triggered. For example, 'foo:*' means events for all tags under repository + * 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + * 'foo:latest'. Empty means all events. + * @member {array} actions The list of actions that trigger the webhook to + * post notifications. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookCreateParameters + * + * @returns {object} metadata of WebhookCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookCreateParameters', + type: { + name: 'Composite', + className: 'WebhookCreateParameters', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + serviceUri: { + required: true, + serializedName: 'properties.serviceUri', + type: { + name: 'String' + } + }, + customHeaders: { + required: false, + serializedName: 'properties.customHeaders', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'properties.scope', + type: { + name: 'String' + } + }, + actions: { + required: true, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = WebhookCreateParameters; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/webhookListResult.js b/lib/services/containerRegistryManagement/lib/lib/models/webhookListResult.js new file mode 100644 index 0000000000..f45a5b9863 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/webhookListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of a request to list webhooks for a container registry. + */ +class WebhookListResult extends Array { + /** + * Create a WebhookListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * list of webhooks. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of WebhookListResult + * + * @returns {object} metadata of WebhookListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookListResult', + type: { + name: 'Composite', + className: 'WebhookListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebhookElementType', + type: { + name: 'Composite', + className: 'Webhook' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebhookListResult; diff --git a/lib/services/containerRegistryManagement/lib/lib/models/webhookUpdateParameters.js b/lib/services/containerRegistryManagement/lib/lib/models/webhookUpdateParameters.js new file mode 100644 index 0000000000..c1fe7547dc --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/models/webhookUpdateParameters.js @@ -0,0 +1,120 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The parameters for updating a webhook. + * + */ +class WebhookUpdateParameters { + /** + * Create a WebhookUpdateParameters. + * @member {object} [tags] The tags for the webhook. + * @member {string} [serviceUri] The service URI for the webhook to post + * notifications. + * @member {object} [customHeaders] Custom headers that will be added to the + * webhook notifications. + * @member {string} [status] The status of the webhook at the time the + * operation was called. Possible values include: 'enabled', 'disabled' + * @member {string} [scope] The scope of repositories where the event can be + * triggered. For example, 'foo:*' means events for all tags under repository + * 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + * 'foo:latest'. Empty means all events. + * @member {array} [actions] The list of actions that trigger the webhook to + * post notifications. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookUpdateParameters + * + * @returns {object} metadata of WebhookUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookUpdateParameters', + type: { + name: 'Composite', + className: 'WebhookUpdateParameters', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + serviceUri: { + required: false, + serializedName: 'properties.serviceUri', + type: { + name: 'String' + } + }, + customHeaders: { + required: false, + serializedName: 'properties.customHeaders', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'properties.scope', + type: { + name: 'String' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = WebhookUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/lib/operations/index.d.ts b/lib/services/containerRegistryManagement/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..95aa82caef --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/operations/index.d.ts @@ -0,0 +1,3143 @@ +/* + * 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 { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * Registries + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface Registries { + + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + importImageWithHttpOperationResponse(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + importImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + importImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, callback: ServiceCallback): void; + importImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Checks whether the container registry name is available for use. The name + * must contain only alphanumeric characters, be globally unique, and between 5 + * and 50 characters in length. + * + * @param {object} registryNameCheckRequest The object containing information + * for the availability request. + * + * @param {string} registryNameCheckRequest.name The name of the container + * registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + checkNameAvailabilityWithHttpOperationResponse(registryNameCheckRequest: models.RegistryNameCheckRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks whether the container registry name is available for use. The name + * must contain only alphanumeric characters, be globally unique, and between 5 + * and 50 characters in length. + * + * @param {object} registryNameCheckRequest The object containing information + * for the availability request. + * + * @param {string} registryNameCheckRequest.name The name of the container + * registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryNameStatus} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryNameStatus} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryNameStatus} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(registryNameCheckRequest: models.RegistryNameCheckRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(registryNameCheckRequest: models.RegistryNameCheckRequest, callback: ServiceCallback): void; + checkNameAvailability(registryNameCheckRequest: models.RegistryNameCheckRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the properties of the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the properties of the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Registry} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName: string, registryName: string, registry: models.Registry, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Registry} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName: string, registryName: string, registry: models.Registry, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, registryName: string, registry: models.Registry, callback: ServiceCallback): void; + create(resourceGroupName: string, registryName: string, registry: models.Registry, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Registry} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listCredentialsWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryListCredentialsResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryListCredentialsResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListCredentialsResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listCredentials(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listCredentials(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + listCredentials(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Regenerates one of the login credentials for the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + regenerateCredentialWithHttpOperationResponse(resourceGroupName: string, registryName: string, regenerateCredentialParameters: models.RegenerateCredentialParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Regenerates one of the login credentials for the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryListCredentialsResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryListCredentialsResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListCredentialsResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + regenerateCredential(resourceGroupName: string, registryName: string, regenerateCredentialParameters: models.RegenerateCredentialParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + regenerateCredential(resourceGroupName: string, registryName: string, regenerateCredentialParameters: models.RegenerateCredentialParameters, callback: ServiceCallback): void; + regenerateCredential(resourceGroupName: string, registryName: string, regenerateCredentialParameters: models.RegenerateCredentialParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listUsagesWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryUsageListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryUsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryUsageListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listUsages(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listUsages(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + listUsages(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginImportImageWithHttpOperationResponse(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginImportImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginImportImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, callback: ServiceCallback): void; + beginImportImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, registryName: string, registry: models.Registry, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Registry} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName: string, registryName: string, registry: models.Registry, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, registryName: string, registry: models.Registry, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, registryName: string, registry: models.Registry, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Registry} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the container registries under the specified subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the container registries under the specified subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RegistryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Replications + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface Replications { + + + /** + * Gets the properties of the specified replication. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the properties of the specified replication. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Replication} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, registryName: string, replicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, registryName: string, replicationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, registryName: string, replicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Replication} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, callback: ServiceCallback): void; + create(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, registryName: string, replicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, registryName: string, replicationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, registryName: string, replicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Replication} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ReplicationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ReplicationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Replication} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, registryName: string, replicationName: string, replication: models.Replication, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, registryName: string, replicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, registryName: string, replicationName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, registryName: string, replicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Replication} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, registryName: string, replicationName: string, replicationUpdateParameters: models.ReplicationUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ReplicationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ReplicationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Webhooks + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface Webhooks { + + + /** + * Gets the properties of the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the properties of the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, registryName: string, webhookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, registryName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, registryName: string, webhookName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, registryName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {WebhookListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WebhookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + pingWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EventInfo} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EventInfo} [result] - The deserialized result object if an error did not occur. + * See {@link EventInfo} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + ping(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + ping(resourceGroupName: string, registryName: string, webhookName: string, callback: ServiceCallback): void; + ping(resourceGroupName: string, registryName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getCallbackConfigWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {CallbackConfig} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {CallbackConfig} [result] - The deserialized result object if an error did not occur. + * See {@link CallbackConfig} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getCallbackConfig(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCallbackConfig(resourceGroupName: string, registryName: string, webhookName: string, callback: ServiceCallback): void; + getCallbackConfig(resourceGroupName: string, registryName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists recent events for the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listEventsWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists recent events for the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EventListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EventListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EventListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listEvents(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listEvents(resourceGroupName: string, registryName: string, webhookName: string, callback: ServiceCallback): void; + listEvents(resourceGroupName: string, registryName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, registryName: string, webhookName: string, webhookCreateParameters: models.WebhookCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, registryName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, registryName: string, webhookName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, registryName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, registryName: string, webhookName: string, webhookUpdateParameters: models.WebhookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {WebhookListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WebhookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists recent events for the specified webhook. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listEventsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists recent events for the specified webhook. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EventListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EventListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EventListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listEventsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listEventsNext(nextPageLink: string, callback: ServiceCallback): void; + listEventsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/containerRegistryManagement/lib/lib/operations/index.js b/lib/services/containerRegistryManagement/lib/lib/operations/index.js new file mode 100644 index 0000000000..edfcba24be --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/operations/index.js @@ -0,0 +1,20 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.Registries = require('./registries'); +exports.Operations = require('./operations'); +exports.Replications = require('./replications'); +exports.Webhooks = require('./webhooks'); diff --git a/lib/services/containerRegistryManagement/lib/lib/operations/operations.js b/lib/services/containerRegistryManagement/lib/lib/operations/operations.js new file mode 100644 index 0000000000..d30dc5e140 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/operations/operations.js @@ -0,0 +1,449 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.ContainerRegistry/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/containerRegistryManagement/lib/lib/operations/registries.js b/lib/services/containerRegistryManagement/lib/lib/operations/registries.js new file mode 100644 index 0000000000..22b63fb9fe --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/operations/registries.js @@ -0,0 +1,4323 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _importImage(resourceGroupName, registryName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginImportImage(resourceGroupName, registryName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Checks whether the container registry name is available for use. The name + * must contain only alphanumeric characters, be globally unique, and between 5 + * and 50 characters in length. + * + * @param {object} registryNameCheckRequest The object containing information + * for the availability request. + * + * @param {string} registryNameCheckRequest.name The name of the container + * registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryNameStatus} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _checkNameAvailability(registryNameCheckRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + if (registryNameCheckRequest === null || registryNameCheckRequest === undefined) + { + registryNameCheckRequest = {}; + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (registryNameCheckRequest === null || registryNameCheckRequest === undefined) { + throw new Error('registryNameCheckRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (registryNameCheckRequest !== null && registryNameCheckRequest !== undefined) { + let requestModelMapper = new client.models['RegistryNameCheckRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, registryNameCheckRequest, 'registryNameCheckRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(registryNameCheckRequest, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryNameStatus']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the properties of the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(resourceGroupName, registryName, registry, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, registryName, registry, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, registryName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, registryName, registryUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, registryName, registryUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListCredentialsResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listCredentials(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryListCredentialsResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Regenerates one of the login credentials for the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListCredentialsResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (regenerateCredentialParameters === null || regenerateCredentialParameters === undefined) { + throw new Error('regenerateCredentialParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (regenerateCredentialParameters !== null && regenerateCredentialParameters !== undefined) { + let requestModelMapper = new client.models['RegenerateCredentialParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, regenerateCredentialParameters, 'regenerateCredentialParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(regenerateCredentialParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryListCredentialsResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryUsageListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listUsages(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryUsageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginImportImage(resourceGroupName, registryName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ImportImageParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, registryName, registry, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (registry === null || registry === undefined) { + throw new Error('registry cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (registry !== null && registry !== undefined) { + let requestModelMapper = new client.models['Registry']().mapper(); + requestModel = client.serialize(requestModelMapper, registry, 'registry'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(registry, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, registryName, registryUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (registryUpdateParameters === null || registryUpdateParameters === undefined) { + throw new Error('registryUpdateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (registryUpdateParameters !== null && registryUpdateParameters !== undefined) { + let requestModelMapper = new client.models['RegistryUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, registryUpdateParameters, 'registryUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(registryUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the container registries under the specified resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the container registries under the specified subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RegistryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Registries. */ +class Registries { + /** + * Create a Registries. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._importImage = _importImage; + this._checkNameAvailability = _checkNameAvailability; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._listCredentials = _listCredentials; + this._regenerateCredential = _regenerateCredential; + this._listUsages = _listUsages; + this._beginImportImage = _beginImportImage; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + importImageWithHttpOperationResponse(resourceGroupName, registryName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._importImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + importImage(resourceGroupName, registryName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._importImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._importImage(resourceGroupName, registryName, parameters, options, optionalCallback); + } + } + + /** + * Checks whether the container registry name is available for use. The name + * must contain only alphanumeric characters, be globally unique, and between 5 + * and 50 characters in length. + * + * @param {object} registryNameCheckRequest The object containing information + * for the availability request. + * + * @param {string} registryNameCheckRequest.name The name of the container + * registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + checkNameAvailabilityWithHttpOperationResponse(registryNameCheckRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(registryNameCheckRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Checks whether the container registry name is available for use. The name + * must contain only alphanumeric characters, be globally unique, and between 5 + * and 50 characters in length. + * + * @param {object} registryNameCheckRequest The object containing information + * for the availability request. + * + * @param {string} registryNameCheckRequest.name The name of the container + * registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryNameStatus} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryNameStatus} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(registryNameCheckRequest, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkNameAvailability(registryNameCheckRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(registryNameCheckRequest, options, optionalCallback); + } + } + + /** + * Gets the properties of the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the properties of the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName, registryName, registry, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, registry, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, registryName, registry, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, registry, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, registryName, registry, options, optionalCallback); + } + } + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, registryName, registryUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, registryUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, registryUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listCredentialsWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listCredentials(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListCredentialsResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListCredentialsResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listCredentials(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listCredentials(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listCredentials(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Regenerates one of the login credentials for the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + regenerateCredentialWithHttpOperationResponse(resourceGroupName, registryName, regenerateCredentialParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Regenerates one of the login credentials for the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListCredentialsResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListCredentialsResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, optionalCallback); + } + } + + /** + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listUsagesWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listUsages(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryUsageListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryUsageListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listUsages(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listUsages(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listUsages(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginImportImageWithHttpOperationResponse(resourceGroupName, registryName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginImportImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginImportImage(resourceGroupName, registryName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginImportImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginImportImage(resourceGroupName, registryName, parameters, options, optionalCallback); + } + } + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, registryName, registry, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, registry, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registry The parameters for creating a container registry. + * + * @param {object} registry.sku The SKU of the container registry. + * + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' + * + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. + * + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. + * + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName, registryName, registry, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, registry, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, registryName, registry, options, optionalCallback); + } + } + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, registryName, registryUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, registryUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, registryUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Registries; diff --git a/lib/services/containerRegistryManagement/lib/lib/operations/replications.js b/lib/services/containerRegistryManagement/lib/lib/operations/replications.js new file mode 100644 index 0000000000..9d31caad2e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/operations/replications.js @@ -0,0 +1,2227 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the properties of the specified replication. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, registryName, replicationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (replicationName === null || replicationName === undefined || typeof replicationName.valueOf() !== 'string') { + throw new Error('replicationName cannot be null or undefined and it must be of type string.'); + } + if (replicationName !== null && replicationName !== undefined) { + if (replicationName.length > 50) + { + throw new Error('"replicationName" should satisfy the constraint - "MaxLength": 50'); + } + if (replicationName.length < 5) + { + throw new Error('"replicationName" should satisfy the constraint - "MinLength": 5'); + } + if (replicationName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"replicationName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(resourceGroupName, registryName, replicationName, replication, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, registryName, replicationName, replication, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, registryName, replicationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, registryName, replicationName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all the replications for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ReplicationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, registryName, replicationName, replication, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (replicationName === null || replicationName === undefined || typeof replicationName.valueOf() !== 'string') { + throw new Error('replicationName cannot be null or undefined and it must be of type string.'); + } + if (replicationName !== null && replicationName !== undefined) { + if (replicationName.length > 50) + { + throw new Error('"replicationName" should satisfy the constraint - "MaxLength": 50'); + } + if (replicationName.length < 5) + { + throw new Error('"replicationName" should satisfy the constraint - "MinLength": 5'); + } + if (replicationName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"replicationName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (replication === null || replication === undefined) { + throw new Error('replication cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (replication !== null && replication !== undefined) { + let requestModelMapper = new client.models['Replication']().mapper(); + requestModel = client.serialize(requestModelMapper, replication, 'replication'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(replication, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, registryName, replicationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (replicationName === null || replicationName === undefined || typeof replicationName.valueOf() !== 'string') { + throw new Error('replicationName cannot be null or undefined and it must be of type string.'); + } + if (replicationName !== null && replicationName !== undefined) { + if (replicationName.length > 50) + { + throw new Error('"replicationName" should satisfy the constraint - "MaxLength": 50'); + } + if (replicationName.length < 5) + { + throw new Error('"replicationName" should satisfy the constraint - "MinLength": 5'); + } + if (replicationName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"replicationName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (replicationName === null || replicationName === undefined || typeof replicationName.valueOf() !== 'string') { + throw new Error('replicationName cannot be null or undefined and it must be of type string.'); + } + if (replicationName !== null && replicationName !== undefined) { + if (replicationName.length > 50) + { + throw new Error('"replicationName" should satisfy the constraint - "MaxLength": 50'); + } + if (replicationName.length < 5) + { + throw new Error('"replicationName" should satisfy the constraint - "MinLength": 5'); + } + if (replicationName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"replicationName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (replicationUpdateParameters === null || replicationUpdateParameters === undefined) { + throw new Error('replicationUpdateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (replicationUpdateParameters !== null && replicationUpdateParameters !== undefined) { + let requestModelMapper = new client.models['ReplicationUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, replicationUpdateParameters, 'replicationUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(replicationUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Replication']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the replications for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ReplicationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Replications. */ +class Replications { + /** + * Create a Replications. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._list = _list; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + } + + /** + * Gets the properties of the specified replication. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, registryName, replicationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, replicationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the properties of the specified replication. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, registryName, replicationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, replicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, registryName, replicationName, options, optionalCallback); + } + } + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName, registryName, replicationName, replication, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, replicationName, replication, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, registryName, replicationName, replication, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, replicationName, replication, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, registryName, replicationName, replication, options, optionalCallback); + } + } + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, registryName, replicationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, replicationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, registryName, replicationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, replicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, registryName, replicationName, options, optionalCallback); + } + } + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ReplicationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, registryName, replicationName, replication, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, replicationName, replication, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replication The parameters for creating a replication. + * + * @param {string} replication.location The location of the resource. This + * cannot be changed after the resource is created. + * + * @param {object} [replication.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName, registryName, replicationName, replication, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, replicationName, replication, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, registryName, replicationName, replication, options, optionalCallback); + } + } + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, registryName, replicationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, replicationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a replication from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, registryName, replicationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, replicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, registryName, replicationName, options, optionalCallback); + } + } + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a replication for a container registry with the specified + * parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} replicationName The name of the replication. + * + * @param {object} replicationUpdateParameters The parameters for updating a + * replication. + * + * @param {object} [replicationUpdateParameters.tags] The tags for the + * replication. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Replication} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Replication} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, registryName, replicationName, replicationUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the replications for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ReplicationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Replications; diff --git a/lib/services/containerRegistryManagement/lib/lib/operations/webhooks.js b/lib/services/containerRegistryManagement/lib/lib/operations/webhooks.js new file mode 100644 index 0000000000..6c9816e657 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/lib/operations/webhooks.js @@ -0,0 +1,3462 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the properties of the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, registryName, webhookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, registryName, webhookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, registryName, webhookName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all the webhooks for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['WebhookListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Triggers a ping event to be sent to the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EventInfo} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _ping(resourceGroupName, registryName, webhookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EventInfo']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link CallbackConfig} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getCallbackConfig(resourceGroupName, registryName, webhookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CallbackConfig']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists recent events for the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EventListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listEvents(resourceGroupName, registryName, webhookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EventListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookCreateParameters === null || webhookCreateParameters === undefined) { + throw new Error('webhookCreateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (webhookCreateParameters !== null && webhookCreateParameters !== undefined) { + let requestModelMapper = new client.models['WebhookCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, webhookCreateParameters, 'webhookCreateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(webhookCreateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, registryName, webhookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (webhookName !== null && webhookName !== undefined) { + if (webhookName.length > 50) + { + throw new Error('"webhookName" should satisfy the constraint - "MaxLength": 50'); + } + if (webhookName.length < 5) + { + throw new Error('"webhookName" should satisfy the constraint - "MinLength": 5'); + } + if (webhookName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"webhookName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (webhookUpdateParameters === null || webhookUpdateParameters === undefined) { + throw new Error('webhookUpdateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (webhookUpdateParameters !== null && webhookUpdateParameters !== undefined) { + let requestModelMapper = new client.models['WebhookUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, webhookUpdateParameters, 'webhookUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(webhookUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the webhooks for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['WebhookListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists recent events for the specified webhook. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EventListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listEventsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EventListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Webhooks. */ +class Webhooks { + /** + * Create a Webhooks. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._list = _list; + this._ping = _ping; + this._getCallbackConfig = _getCallbackConfig; + this._listEvents = _listEvents; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + this._listEventsNext = _listEventsNext; + } + + /** + * Gets the properties of the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, registryName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the properties of the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, registryName, webhookName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, registryName, webhookName, options, optionalCallback); + } + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName, registryName, webhookName, webhookCreateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, optionalCallback); + } + } + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, registryName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, registryName, webhookName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, registryName, webhookName, options, optionalCallback); + } + } + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {WebhookListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + pingWithHttpOperationResponse(resourceGroupName, registryName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._ping(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EventInfo} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EventInfo} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + ping(resourceGroupName, registryName, webhookName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._ping(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._ping(resourceGroupName, registryName, webhookName, options, optionalCallback); + } + } + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getCallbackConfigWithHttpOperationResponse(resourceGroupName, registryName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getCallbackConfig(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {CallbackConfig} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link CallbackConfig} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getCallbackConfig(resourceGroupName, registryName, webhookName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCallbackConfig(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCallbackConfig(resourceGroupName, registryName, webhookName, options, optionalCallback); + } + } + + /** + * Lists recent events for the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listEventsWithHttpOperationResponse(resourceGroupName, registryName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listEvents(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists recent events for the specified webhook. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EventListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EventListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listEvents(resourceGroupName, registryName, webhookName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listEvents(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listEvents(resourceGroupName, registryName, webhookName, options, optionalCallback); + } + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, registryName, webhookName, webhookCreateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookCreateParameters The parameters for creating a + * webhook. + * + * @param {object} [webhookCreateParameters.tags] The tags for the webhook. + * + * @param {string} webhookCreateParameters.location The location of the + * webhook. This cannot be changed after the resource is created. + * + * @param {string} webhookCreateParameters.serviceUri The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookCreateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookCreateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} webhookCreateParameters.actions The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookCreateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, registryName, webhookName, webhookCreateParameters, options, optionalCallback); + } + } + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, registryName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a webhook from a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, registryName, webhookName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, registryName, webhookName, options, optionalCallback); + } + } + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} webhookName The name of the webhook. + * + * @param {object} webhookUpdateParameters The parameters for updating a + * webhook. + * + * @param {object} [webhookUpdateParameters.tags] The tags for the webhook. + * + * @param {string} [webhookUpdateParameters.serviceUri] The service URI for the + * webhook to post notifications. + * + * @param {string} [webhookUpdateParameters.status] The status of the webhook + * at the time the operation was called. Possible values include: 'enabled', + * 'disabled' + * + * @param {string} [webhookUpdateParameters.scope] The scope of repositories + * where the event can be triggered. For example, 'foo:*' means events for all + * tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + * 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param {array} [webhookUpdateParameters.actions] The list of actions that + * trigger the webhook to post notifications. + * + * @param {object} [webhookUpdateParameters.customHeaders] Custom headers that + * will be added to the webhook notifications. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Webhook} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {WebhookListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists recent events for the specified webhook. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listEventsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listEventsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists recent events for the specified webhook. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EventListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EventListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listEventsNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listEventsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listEventsNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Webhooks; diff --git a/lib/services/containerRegistryManagement/lib/models/baseImageDependency.js b/lib/services/containerRegistryManagement/lib/models/baseImageDependency.js new file mode 100644 index 0000000000..19d89b38b5 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/baseImageDependency.js @@ -0,0 +1,85 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties that describe a base image dependency. + * + */ +class BaseImageDependency { + /** + * Create a BaseImageDependency. + * @member {string} [type] The type of the base image dependency. Possible + * values include: 'BuildTime', 'RunTime' + * @member {string} [registry] The registry login server. + * @member {string} [repository] The repository name. + * @member {string} [tag] The tag name. + * @member {string} [digest] The sha256-based digest of the image manifest. + */ + constructor() { + } + + /** + * Defines the metadata of BaseImageDependency + * + * @returns {object} metadata of BaseImageDependency + * + */ + mapper() { + return { + required: false, + serializedName: 'BaseImageDependency', + type: { + name: 'Composite', + className: 'BaseImageDependency', + modelProperties: { + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + registry: { + required: false, + serializedName: 'registry', + type: { + name: 'String' + } + }, + repository: { + required: false, + serializedName: 'repository', + type: { + name: 'String' + } + }, + tag: { + required: false, + serializedName: 'tag', + type: { + name: 'String' + } + }, + digest: { + required: false, + serializedName: 'digest', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BaseImageDependency; diff --git a/lib/services/containerRegistryManagement/lib/models/build.js b/lib/services/containerRegistryManagement/lib/models/build.js new file mode 100644 index 0000000000..79b585fd18 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/build.js @@ -0,0 +1,224 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Build resource properties + * + * @extends models['ProxyResource'] + */ +class Build extends models['ProxyResource'] { + /** + * Create a Build. + * @member {string} [buildId] The unique identifier for the build. + * @member {string} [status] The current status of the build. Possible values + * include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', + * 'Canceled', 'Error', 'Timeout' + * @member {date} [lastUpdatedTime] The last updated time for the build. + * @member {string} [buildType] The type of build. Possible values include: + * 'AutoBuild', 'QuickBuild' + * @member {date} [createTime] The time the build was created. + * @member {date} [startTime] The time the build started. + * @member {date} [finishTime] The time the build finished. + * @member {array} [outputImages] The list of all images that were generated + * from the build. + * @member {string} [buildTask] The build task with which the build was + * started. + * @member {object} [imageUpdateTrigger] The image update trigger that caused + * the build. + * @member {string} [imageUpdateTrigger.id] The unique ID of the trigger. + * @member {date} [imageUpdateTrigger.timestamp] The timestamp when the image + * update happened. + * @member {array} [imageUpdateTrigger.images] The list of image updates that + * caused the build. + * @member {object} [gitCommitTrigger] The git commit trigger that caused the + * build. + * @member {string} [gitCommitTrigger.id] The unique ID of the trigger. + * @member {string} [gitCommitTrigger.commitId] The unique ID that identifies + * a commit. + * @member {string} [gitCommitTrigger.repositoryUrl] The repository URL. + * @member {string} [gitCommitTrigger.branchName] The branch name in the + * repository. + * @member {string} [gitCommitTrigger.providerType] The source control + * provider type. + * @member {boolean} [isArchiveEnabled] The value that indicates whether + * archiving is enabled or not. Default value: false . + * @member {object} [platform] The platform properties against which the + * build will happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number + * of cores required for the build. + * @member {string} [provisioningState] The provisioning state of a build. + * Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + * 'Failed', 'Canceled' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Build + * + * @returns {object} metadata of Build + * + */ + mapper() { + return { + required: false, + serializedName: 'Build', + type: { + name: 'Composite', + className: 'Build', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + buildId: { + required: false, + serializedName: 'properties.buildId', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + lastUpdatedTime: { + required: false, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + }, + buildType: { + required: false, + serializedName: 'properties.buildType', + type: { + name: 'String' + } + }, + createTime: { + required: false, + serializedName: 'properties.createTime', + type: { + name: 'DateTime' + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + finishTime: { + required: false, + serializedName: 'properties.finishTime', + type: { + name: 'DateTime' + } + }, + outputImages: { + required: false, + serializedName: 'properties.outputImages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ImageDescriptorElementType', + type: { + name: 'Composite', + className: 'ImageDescriptor' + } + } + } + }, + buildTask: { + required: false, + serializedName: 'properties.buildTask', + type: { + name: 'String' + } + }, + imageUpdateTrigger: { + required: false, + serializedName: 'properties.imageUpdateTrigger', + type: { + name: 'Composite', + className: 'ImageUpdateTrigger' + } + }, + gitCommitTrigger: { + required: false, + serializedName: 'properties.gitCommitTrigger', + type: { + name: 'Composite', + className: 'GitCommitTrigger' + } + }, + isArchiveEnabled: { + required: false, + serializedName: 'properties.isArchiveEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + platform: { + required: false, + serializedName: 'properties.platform', + type: { + name: 'Composite', + className: 'PlatformProperties' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Build; diff --git a/lib/services/containerRegistryManagement/lib/models/buildArgument.js b/lib/services/containerRegistryManagement/lib/models/buildArgument.js new file mode 100644 index 0000000000..a2f20e742a --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildArgument.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties of a build argument. + * + */ +class BuildArgument { + /** + * Create a BuildArgument. + * @member {string} name The name of the argument. + * @member {string} value The value of the argument. + * @member {boolean} [isSecret] Flag to indicate whether the argument + * represents a secret and want to be removed from build logs. Default value: + * false . + */ + constructor() { + } + + /** + * Defines the metadata of BuildArgument + * + * @returns {object} metadata of BuildArgument + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildArgument', + type: { + name: 'Composite', + className: 'BuildArgument', + modelProperties: { + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'DockerBuildArgument', + type: { + name: 'String' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + isSecret: { + required: false, + serializedName: 'isSecret', + defaultValue: false, + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = BuildArgument; diff --git a/lib/services/containerRegistryManagement/lib/models/buildArgumentList.js b/lib/services/containerRegistryManagement/lib/models/buildArgumentList.js new file mode 100644 index 0000000000..d97878d2d5 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildArgumentList.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The list of build arguments for a build step. + */ +class BuildArgumentList extends Array { + /** + * Create a BuildArgumentList. + * @member {string} [nextLink] The URI that can be used to request the next + * set of paged results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildArgumentList + * + * @returns {object} metadata of BuildArgumentList + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildArgumentList', + type: { + name: 'Composite', + className: 'BuildArgumentList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildArgumentElementType', + type: { + name: 'Composite', + className: 'BuildArgument' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildArgumentList; diff --git a/lib/services/containerRegistryManagement/lib/models/buildFilter.js b/lib/services/containerRegistryManagement/lib/models/buildFilter.js new file mode 100644 index 0000000000..e925f18307 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildFilter.js @@ -0,0 +1,114 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties that are enabled for Odata querying. + * + */ +class BuildFilter { + /** + * Create a BuildFilter. + * @member {string} [buildId] The unique identifier for the build. + * @member {string} [buildType] The type of build. Possible values include: + * 'AutoBuild', 'QuickBuild' + * @member {string} [status] The current status of the build. Possible values + * include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', + * 'Canceled', 'Error', 'Timeout' + * @member {date} [createTime] The create time for a build. + * @member {date} [finishTime] The time the build finished. + * @member {string} [outputImageManifests] The list of comma-separated image + * manifests that were generated from the build. + * @member {boolean} [isArchiveEnabled] The value that indicates whether + * archiving is enabled or not. + * @member {string} [buildTaskName] The name of the build task that the build + * corresponds to. + */ + constructor() { + } + + /** + * Defines the metadata of BuildFilter + * + * @returns {object} metadata of BuildFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildFilter', + type: { + name: 'Composite', + className: 'BuildFilter', + modelProperties: { + buildId: { + required: false, + serializedName: 'buildId', + type: { + name: 'String' + } + }, + buildType: { + required: false, + serializedName: 'buildType', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + createTime: { + required: false, + serializedName: 'createTime', + type: { + name: 'DateTime' + } + }, + finishTime: { + required: false, + serializedName: 'finishTime', + type: { + name: 'DateTime' + } + }, + outputImageManifests: { + required: false, + serializedName: 'outputImageManifests', + type: { + name: 'String' + } + }, + isArchiveEnabled: { + required: false, + serializedName: 'isArchiveEnabled', + type: { + name: 'Boolean' + } + }, + buildTaskName: { + required: false, + serializedName: 'buildTaskName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildFilter; diff --git a/lib/services/containerRegistryManagement/lib/models/buildGetLogResult.js b/lib/services/containerRegistryManagement/lib/models/buildGetLogResult.js new file mode 100644 index 0000000000..15367588c9 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildGetLogResult.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The result of get log link operation. + * + */ +class BuildGetLogResult { + /** + * Create a BuildGetLogResult. + * @member {string} [logLink] The link to logs for a azure container registry + * build. + */ + constructor() { + } + + /** + * Defines the metadata of BuildGetLogResult + * + * @returns {object} metadata of BuildGetLogResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildGetLogResult', + type: { + name: 'Composite', + className: 'BuildGetLogResult', + modelProperties: { + logLink: { + required: false, + serializedName: 'logLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildGetLogResult; diff --git a/lib/services/containerRegistryManagement/lib/models/buildListResult.js b/lib/services/containerRegistryManagement/lib/models/buildListResult.js new file mode 100644 index 0000000000..3449a8668a --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Collection of builds. + */ +class BuildListResult extends Array { + /** + * Create a BuildListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * set of paged results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildListResult + * + * @returns {object} metadata of BuildListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildListResult', + type: { + name: 'Composite', + className: 'BuildListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildElementType', + type: { + name: 'Composite', + className: 'Build' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildListResult; diff --git a/lib/services/containerRegistryManagement/lib/models/buildStep.js b/lib/services/containerRegistryManagement/lib/models/buildStep.js new file mode 100644 index 0000000000..5c3c24e66e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildStep.js @@ -0,0 +1,90 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Build step resource properties + * + * @extends models['ProxyResource'] + */ +class BuildStep extends models['ProxyResource'] { + /** + * Create a BuildStep. + * @member {object} [properties] The properties of a build step. + * @member {string} [properties.provisioningState] The provisioning state of + * the build step. Possible values include: 'Creating', 'Updating', + * 'Deleting', 'Succeeded', 'Failed', 'Canceled' + * @member {string} [properties.type] Polymorphic Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildStep + * + * @returns {object} metadata of BuildStep + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildStep', + type: { + name: 'Composite', + className: 'BuildStep', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'BuildStepProperties', + className: 'BuildStepProperties' + } + } + } + } + }; + } +} + +module.exports = BuildStep; diff --git a/lib/services/containerRegistryManagement/lib/models/buildStepList.js b/lib/services/containerRegistryManagement/lib/models/buildStepList.js new file mode 100644 index 0000000000..ec45ec4d8a --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildStepList.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The collection of build items. + */ +class BuildStepList extends Array { + /** + * Create a BuildStepList. + * @member {string} [nextLink] The URI that can be used to request the next + * set of paged results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildStepList + * + * @returns {object} metadata of BuildStepList + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildStepList', + type: { + name: 'Composite', + className: 'BuildStepList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildStepElementType', + type: { + name: 'Composite', + className: 'BuildStep' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildStepList; diff --git a/lib/services/containerRegistryManagement/lib/models/buildStepProperties.js b/lib/services/containerRegistryManagement/lib/models/buildStepProperties.js new file mode 100644 index 0000000000..732d94385b --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildStepProperties.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Base properties for any build step. + * + */ +class BuildStepProperties { + /** + * Create a BuildStepProperties. + * @member {string} [provisioningState] The provisioning state of the build + * step. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled' + * @member {string} type Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of BuildStepProperties + * + * @returns {object} metadata of BuildStepProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildStepProperties', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'BuildStepProperties', + className: 'BuildStepProperties', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildStepProperties; diff --git a/lib/services/containerRegistryManagement/lib/models/buildStepPropertiesUpdateParameters.js b/lib/services/containerRegistryManagement/lib/models/buildStepPropertiesUpdateParameters.js new file mode 100644 index 0000000000..43bb50dfa8 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildStepPropertiesUpdateParameters.js @@ -0,0 +1,58 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties for updating a build step. + * + */ +class BuildStepPropertiesUpdateParameters { + /** + * Create a BuildStepPropertiesUpdateParameters. + * @member {string} type Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of BuildStepPropertiesUpdateParameters + * + * @returns {object} metadata of BuildStepPropertiesUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildStepPropertiesUpdateParameters', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'BuildStepPropertiesUpdateParameters', + className: 'BuildStepPropertiesUpdateParameters', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildStepPropertiesUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/buildStepUpdateParameters.js b/lib/services/containerRegistryManagement/lib/models/buildStepUpdateParameters.js new file mode 100644 index 0000000000..0687f01c72 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildStepUpdateParameters.js @@ -0,0 +1,76 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The parameters for updating a build step. + * + */ +class BuildStepUpdateParameters { + /** + * Create a BuildStepUpdateParameters. + * @member {object} [properties] The properties for updating a build step. + * @member {string} [properties.type] Polymorphic Discriminator + * @member {object} [tags] The ARM resource tags. + */ + constructor() { + } + + /** + * Defines the metadata of BuildStepUpdateParameters + * + * @returns {object} metadata of BuildStepUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildStepUpdateParameters', + type: { + name: 'Composite', + className: 'BuildStepUpdateParameters', + modelProperties: { + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'BuildStepPropertiesUpdateParameters', + className: 'BuildStepPropertiesUpdateParameters' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = BuildStepUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/buildTask.js b/lib/services/containerRegistryManagement/lib/models/buildTask.js new file mode 100644 index 0000000000..48f28b13e6 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildTask.js @@ -0,0 +1,189 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The build task that has the resource properties and all build items. The + * build task will have all information to schedule a build against it. + * + * @extends models['Resource'] + */ +class BuildTask extends models['Resource'] { + /** + * Create a BuildTask. + * @member {string} [provisioningState] The provisioning state of the build + * task. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled' + * @member {date} [creationDate] The creation date of build task. + * @member {string} alias The alternative updatable name for a build task. + * @member {string} [status] The current status of build task. Possible + * values include: 'Disabled', 'Enabled' + * @member {object} sourceRepository The properties that describes the + * source(code) for the build task. + * @member {string} [sourceRepository.sourceControlType] The type of source + * control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * @member {string} [sourceRepository.repositoryUrl] The full URL to the + * source code respository + * @member {boolean} [sourceRepository.isCommitTriggerEnabled] The value of + * this property indicates whether the source control commit trigger is + * enabled or not. + * @member {object} [sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * @member {string} [sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceRepository.sourceControlAuthProperties.token] The + * access token used to access the source control provider. + * @member {string} + * [sourceRepository.sourceControlAuthProperties.refreshToken] The refresh + * token used to refresh the access token. + * @member {string} [sourceRepository.sourceControlAuthProperties.scope] The + * scope of the access token. + * @member {number} [sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * @member {object} platform The platform properties against which the build + * has to happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number + * of cores required for the build. + * @member {number} [timeout] Build timeout in seconds. Default value: 3600 . + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildTask + * + * @returns {object} metadata of BuildTask + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildTask', + type: { + name: 'Composite', + className: 'BuildTask', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + creationDate: { + required: false, + readOnly: true, + serializedName: 'properties.creationDate', + type: { + name: 'DateTime' + } + }, + alias: { + required: true, + serializedName: 'properties.alias', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + sourceRepository: { + required: true, + serializedName: 'properties.sourceRepository', + type: { + name: 'Composite', + className: 'SourceRepositoryProperties' + } + }, + platform: { + required: true, + serializedName: 'properties.platform', + type: { + name: 'Composite', + className: 'PlatformProperties' + } + }, + timeout: { + required: false, + serializedName: 'properties.timeout', + defaultValue: 3600, + constraints: { + InclusiveMaximum: 28800, + InclusiveMinimum: 300 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = BuildTask; diff --git a/lib/services/containerRegistryManagement/lib/models/buildTaskBuildRequest.js b/lib/services/containerRegistryManagement/lib/models/buildTaskBuildRequest.js new file mode 100644 index 0000000000..71ce04d02a --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildTaskBuildRequest.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The queue build parameters based on a build task. + * + * @extends models['QueueBuildRequest'] + */ +class BuildTaskBuildRequest extends models['QueueBuildRequest'] { + /** + * Create a BuildTaskBuildRequest. + * @member {string} buildTaskName The name of build task against which build + * has to be queued. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildTaskBuildRequest + * + * @returns {object} metadata of BuildTaskBuildRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildTask', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'QueueBuildRequest', + className: 'BuildTaskBuildRequest', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + buildTaskName: { + required: true, + serializedName: 'buildTaskName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildTaskBuildRequest; diff --git a/lib/services/containerRegistryManagement/lib/models/buildTaskFilter.js b/lib/services/containerRegistryManagement/lib/models/buildTaskFilter.js new file mode 100644 index 0000000000..209e5dc9b0 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildTaskFilter.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The filter that can be used for listing build tasks. + * + */ +class BuildTaskFilter { + /** + * Create a BuildTaskFilter. + * @member {string} [alias] The alternative name for build task. + */ + constructor() { + } + + /** + * Defines the metadata of BuildTaskFilter + * + * @returns {object} metadata of BuildTaskFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildTaskFilter', + type: { + name: 'Composite', + className: 'BuildTaskFilter', + modelProperties: { + alias: { + required: false, + serializedName: 'alias', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildTaskFilter; diff --git a/lib/services/containerRegistryManagement/lib/models/buildTaskListResult.js b/lib/services/containerRegistryManagement/lib/models/buildTaskListResult.js new file mode 100644 index 0000000000..317f9975c6 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildTaskListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The collection of build tasks. + */ +class BuildTaskListResult extends Array { + /** + * Create a BuildTaskListResult. + * @member {string} [nextLink] The URI that can be used to request the next + * set of paged results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BuildTaskListResult + * + * @returns {object} metadata of BuildTaskListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildTaskListResult', + type: { + name: 'Composite', + className: 'BuildTaskListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildTaskElementType', + type: { + name: 'Composite', + className: 'BuildTask' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BuildTaskListResult; diff --git a/lib/services/containerRegistryManagement/lib/models/buildTaskUpdateParameters.js b/lib/services/containerRegistryManagement/lib/models/buildTaskUpdateParameters.js new file mode 100644 index 0000000000..a2020ff1d1 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildTaskUpdateParameters.js @@ -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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The parameters for updating a build task. + * + */ +class BuildTaskUpdateParameters { + /** + * Create a BuildTaskUpdateParameters. + * @member {string} [alias] The alternative updatable name for a build task. + * @member {string} [status] The current status of build task. Possible + * values include: 'Disabled', 'Enabled' + * @member {object} [platform] The platform properties against which the + * build has to happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number + * of cores required for the build. + * @member {number} [timeout] Build timeout in seconds. + * @member {object} [sourceRepository] The properties that describes the + * source(code) for the build task. + * @member {object} [sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * @member {string} [sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceRepository.sourceControlAuthProperties.token] The + * access token used to access the source control provider. + * @member {string} + * [sourceRepository.sourceControlAuthProperties.refreshToken] The refresh + * token used to refresh the access token. + * @member {string} [sourceRepository.sourceControlAuthProperties.scope] The + * scope of the access token. + * @member {number} [sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * @member {boolean} [sourceRepository.isCommitTriggerEnabled] The value of + * this property indicates whether the source control commit trigger is + * enabled or not. + * @member {object} [tags] The ARM resource tags. + */ + constructor() { + } + + /** + * Defines the metadata of BuildTaskUpdateParameters + * + * @returns {object} metadata of BuildTaskUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildTaskUpdateParameters', + type: { + name: 'Composite', + className: 'BuildTaskUpdateParameters', + modelProperties: { + alias: { + required: false, + serializedName: 'properties.alias', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + platform: { + required: false, + serializedName: 'properties.platform', + type: { + name: 'Composite', + className: 'PlatformProperties' + } + }, + timeout: { + required: false, + serializedName: 'properties.timeout', + constraints: { + InclusiveMaximum: 28800, + InclusiveMinimum: 300 + }, + type: { + name: 'Number' + } + }, + sourceRepository: { + required: false, + serializedName: 'properties.sourceRepository', + type: { + name: 'Composite', + className: 'SourceRepositoryUpdateParameters' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = BuildTaskUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/buildUpdateParameters.js b/lib/services/containerRegistryManagement/lib/models/buildUpdateParameters.js new file mode 100644 index 0000000000..94e185d081 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildUpdateParameters.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The set of build properties that can be updated. + * + */ +class BuildUpdateParameters { + /** + * Create a BuildUpdateParameters. + * @member {boolean} [isArchiveEnabled] The value that indicates whether + * archiving is enabled or not. + */ + constructor() { + } + + /** + * Defines the metadata of BuildUpdateParameters + * + * @returns {object} metadata of BuildUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'BuildUpdateParameters', + type: { + name: 'Composite', + className: 'BuildUpdateParameters', + modelProperties: { + isArchiveEnabled: { + required: false, + serializedName: 'isArchiveEnabled', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = BuildUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/dockerBuildStep.js b/lib/services/containerRegistryManagement/lib/models/dockerBuildStep.js new file mode 100644 index 0000000000..84bef7d173 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/dockerBuildStep.js @@ -0,0 +1,177 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The Docker build step. + * + * @extends models['BuildStepProperties'] + */ +class DockerBuildStep extends models['BuildStepProperties'] { + /** + * Create a DockerBuildStep. + * @member {string} [branch] The repository branch name. + * @member {array} [imageNames] The fully qualified image names including the + * repository and tag. + * @member {boolean} [isPushEnabled] The value of this property indicates + * whether the image built should be pushed to the registry or not. Default + * value: true . + * @member {boolean} [noCache] The value of this property indicates whether + * the image cache is enabled or not. Default value: false . + * @member {string} [dockerFilePath] The Docker file path relative to the + * source control root. + * @member {string} [contextPath] The relative context path for a docker + * build in the source. + * @member {array} [buildArguments] The custom arguments for building this + * build step. + * @member {array} [baseImageDependencies] List of base image dependencies + * for a step. + * @member {string} [baseImageTrigger] The type of the auto trigger for base + * image dependency updates. Possible values include: 'All', 'Runtime', + * 'None' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DockerBuildStep + * + * @returns {object} metadata of DockerBuildStep + * + */ + mapper() { + return { + required: false, + serializedName: 'Docker', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'BuildStepProperties', + className: 'DockerBuildStep', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + branch: { + required: false, + serializedName: 'branch', + type: { + name: 'String' + } + }, + imageNames: { + required: false, + serializedName: 'imageNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isPushEnabled: { + required: false, + serializedName: 'isPushEnabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + noCache: { + required: false, + serializedName: 'noCache', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + dockerFilePath: { + required: false, + serializedName: 'dockerFilePath', + type: { + name: 'String' + } + }, + contextPath: { + required: false, + serializedName: 'contextPath', + type: { + name: 'String' + } + }, + buildArguments: { + required: false, + serializedName: 'buildArguments', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildArgumentElementType', + type: { + name: 'Composite', + className: 'BuildArgument' + } + } + } + }, + baseImageDependencies: { + required: false, + readOnly: true, + serializedName: 'baseImageDependencies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaseImageDependencyElementType', + type: { + name: 'Composite', + className: 'BaseImageDependency' + } + } + } + }, + baseImageTrigger: { + required: false, + serializedName: 'baseImageTrigger', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DockerBuildStep; diff --git a/lib/services/containerRegistryManagement/lib/models/dockerBuildStepUpdateParameters.js b/lib/services/containerRegistryManagement/lib/models/dockerBuildStepUpdateParameters.js new file mode 100644 index 0000000000..20db8e9d98 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/dockerBuildStepUpdateParameters.js @@ -0,0 +1,148 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The properties for updating a docker build step. + * + * @extends models['BuildStepPropertiesUpdateParameters'] + */ +class DockerBuildStepUpdateParameters extends models['BuildStepPropertiesUpdateParameters'] { + /** + * Create a DockerBuildStepUpdateParameters. + * @member {string} [branch] The repository branch name. + * @member {array} [imageNames] The fully qualified image names including the + * repository and tag. + * @member {boolean} [isPushEnabled] The value of this property indicates + * whether the image built should be pushed to the registry or not. + * @member {boolean} [noCache] The value of this property indicates whether + * the image cache is enabled or not. + * @member {string} [dockerFilePath] The Docker file path relative to the + * source control root. + * @member {string} [contextPath] The relative context path for a docker + * build in the source. + * @member {array} [buildArguments] The custom arguments for building this + * build step. + * @member {string} [baseImageTrigger] The type of the auto trigger for base + * image dependency updates. Possible values include: 'All', 'Runtime', + * 'None' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DockerBuildStepUpdateParameters + * + * @returns {object} metadata of DockerBuildStepUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'Docker', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'BuildStepPropertiesUpdateParameters', + className: 'DockerBuildStepUpdateParameters', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + branch: { + required: false, + serializedName: 'branch', + type: { + name: 'String' + } + }, + imageNames: { + required: false, + serializedName: 'imageNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isPushEnabled: { + required: false, + serializedName: 'isPushEnabled', + type: { + name: 'Boolean' + } + }, + noCache: { + required: false, + serializedName: 'noCache', + type: { + name: 'Boolean' + } + }, + dockerFilePath: { + required: false, + serializedName: 'dockerFilePath', + type: { + name: 'String' + } + }, + contextPath: { + required: false, + serializedName: 'contextPath', + type: { + name: 'String' + } + }, + buildArguments: { + required: false, + serializedName: 'buildArguments', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildArgumentElementType', + type: { + name: 'Composite', + className: 'BuildArgument' + } + } + } + }, + baseImageTrigger: { + required: false, + serializedName: 'baseImageTrigger', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DockerBuildStepUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/gitCommitTrigger.js b/lib/services/containerRegistryManagement/lib/models/gitCommitTrigger.js new file mode 100644 index 0000000000..303931c72e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/gitCommitTrigger.js @@ -0,0 +1,84 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The git commit trigger that caused a build. + * + */ +class GitCommitTrigger { + /** + * Create a GitCommitTrigger. + * @member {string} [id] The unique ID of the trigger. + * @member {string} [commitId] The unique ID that identifies a commit. + * @member {string} [repositoryUrl] The repository URL. + * @member {string} [branchName] The branch name in the repository. + * @member {string} [providerType] The source control provider type. + */ + constructor() { + } + + /** + * Defines the metadata of GitCommitTrigger + * + * @returns {object} metadata of GitCommitTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'GitCommitTrigger', + type: { + name: 'Composite', + className: 'GitCommitTrigger', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + commitId: { + required: false, + serializedName: 'commitId', + type: { + name: 'String' + } + }, + repositoryUrl: { + required: false, + serializedName: 'repositoryUrl', + type: { + name: 'String' + } + }, + branchName: { + required: false, + serializedName: 'branchName', + type: { + name: 'String' + } + }, + providerType: { + required: false, + serializedName: 'providerType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GitCommitTrigger; diff --git a/lib/services/containerRegistryManagement/lib/models/imageCopyFromModel.js b/lib/services/containerRegistryManagement/lib/models/imageCopyFromModel.js new file mode 100644 index 0000000000..38e4213723 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/imageCopyFromModel.js @@ -0,0 +1,122 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Class representing a ImageCopyFromModel. + */ +class ImageCopyFromModel { + /** + * Create a ImageCopyFromModel. + * @member {string} sourceRepository Repository name of the source image. + * @member {string} [sourceTag] The tag name of the source image. When both + * source tag and source manifest are omitted the 'latest' tag will be used. + * Exclusive with SourceManifestDigest. + * @member {string} [sourceManifestDigest] The manifest sha of the source + * image. Exclusive with SourceTag. + * @member {string} sourceRegistryResourceId The resource id of the source + * registry. + * @member {array} [targetTags] List of strings of the form repo[:tag]. When + * tag is omitted the source will be used (or 'latest' if source tag is also + * omitted.) + * @member {array} [untaggedTargetRepositories] List of strings of repository + * names to do a manifest only copy. No tag will be created. + * @member {boolean} [force] When true, any existing target tags will be + * overwritten. When false, any existing target tags will fail the operation + * before any copying begins. + */ + constructor() { + } + + /** + * Defines the metadata of ImageCopyFromModel + * + * @returns {object} metadata of ImageCopyFromModel + * + */ + mapper() { + return { + required: false, + serializedName: 'ImageCopyFromModel', + type: { + name: 'Composite', + className: 'ImageCopyFromModel', + modelProperties: { + sourceRepository: { + required: true, + serializedName: 'sourceRepository', + type: { + name: 'String' + } + }, + sourceTag: { + required: false, + serializedName: 'sourceTag', + type: { + name: 'String' + } + }, + sourceManifestDigest: { + required: false, + serializedName: 'sourceManifestDigest', + type: { + name: 'String' + } + }, + sourceRegistryResourceId: { + required: true, + serializedName: 'sourceRegistryResourceId', + type: { + name: 'String' + } + }, + targetTags: { + required: false, + serializedName: 'targetTags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + untaggedTargetRepositories: { + required: false, + serializedName: 'untaggedTargetRepositories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + force: { + required: false, + serializedName: 'force', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ImageCopyFromModel; diff --git a/lib/services/containerRegistryManagement/lib/models/imageDescriptor.js b/lib/services/containerRegistryManagement/lib/models/imageDescriptor.js new file mode 100644 index 0000000000..2b1c7f723b --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/imageDescriptor.js @@ -0,0 +1,76 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties for a registry image. + * + */ +class ImageDescriptor { + /** + * Create a ImageDescriptor. + * @member {string} [registry] The registry login server. + * @member {string} [repository] The repository name. + * @member {string} [tag] The tag name. + * @member {string} [digest] The sha256-based digest of the image manifest. + */ + constructor() { + } + + /** + * Defines the metadata of ImageDescriptor + * + * @returns {object} metadata of ImageDescriptor + * + */ + mapper() { + return { + required: false, + serializedName: 'ImageDescriptor', + type: { + name: 'Composite', + className: 'ImageDescriptor', + modelProperties: { + registry: { + required: false, + serializedName: 'registry', + type: { + name: 'String' + } + }, + repository: { + required: false, + serializedName: 'repository', + type: { + name: 'String' + } + }, + tag: { + required: false, + serializedName: 'tag', + type: { + name: 'String' + } + }, + digest: { + required: false, + serializedName: 'digest', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImageDescriptor; diff --git a/lib/services/containerRegistryManagement/lib/models/imageUpdateTrigger.js b/lib/services/containerRegistryManagement/lib/models/imageUpdateTrigger.js new file mode 100644 index 0000000000..e66b3b727b --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/imageUpdateTrigger.js @@ -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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The image update trigger that caused a build. + * + */ +class ImageUpdateTrigger { + /** + * Create a ImageUpdateTrigger. + * @member {string} [id] The unique ID of the trigger. + * @member {date} [timestamp] The timestamp when the image update happened. + * @member {array} [images] The list of image updates that caused the build. + */ + constructor() { + } + + /** + * Defines the metadata of ImageUpdateTrigger + * + * @returns {object} metadata of ImageUpdateTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'ImageUpdateTrigger', + type: { + name: 'Composite', + className: 'ImageUpdateTrigger', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + timestamp: { + required: false, + serializedName: 'timestamp', + type: { + name: 'DateTime' + } + }, + images: { + required: false, + serializedName: 'images', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ImageDescriptorElementType', + type: { + name: 'Composite', + className: 'ImageDescriptor' + } + } + } + } + } + } + }; + } +} + +module.exports = ImageUpdateTrigger; diff --git a/lib/services/containerRegistryManagement/lib/models/importImageParameters.js b/lib/services/containerRegistryManagement/lib/models/importImageParameters.js new file mode 100644 index 0000000000..191b46a8a9 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/importImageParameters.js @@ -0,0 +1,107 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a ImportImageParameters. + */ +class ImportImageParameters { + /** + * Create a ImportImageParameters. + * @member {object} source The source of the image. + * @member {string} [source.resourceId] The resource identifier of the target + * Azure Container Registry. + * @member {string} [source.sourceImage] Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * @member {array} [targetTags] List of strings of the form repo[:tag]. When + * tag is omitted the source will be used (or 'latest' if source tag is also + * omitted). + * @member {array} [untaggedTargetRepositories] List of strings of repository + * names to do a manifest only copy. No tag will be created. + * @member {string} [mode] When Force, any existing target tags will be + * overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force'. Default value: 'NoForce' . + */ + constructor() { + } + + /** + * Defines the metadata of ImportImageParameters + * + * @returns {object} metadata of ImportImageParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ImportImageParameters', + type: { + name: 'Composite', + className: 'ImportImageParameters', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ImportSource' + } + }, + targetTags: { + required: false, + serializedName: 'targetTags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + untaggedTargetRepositories: { + required: false, + serializedName: 'untaggedTargetRepositories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + mode: { + required: false, + serializedName: 'mode', + defaultValue: 'NoForce', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImportImageParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/importSource.js b/lib/services/containerRegistryManagement/lib/models/importSource.js new file mode 100644 index 0000000000..43a81fbb5e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/importSource.js @@ -0,0 +1,65 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Class representing a ImportSource. + */ +class ImportSource { + /** + * Create a ImportSource. + * @member {string} resourceId The resource identifier of the target Azure + * Container Registry. + * @member {string} sourceImage Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + */ + constructor() { + } + + /** + * Defines the metadata of ImportSource + * + * @returns {object} metadata of ImportSource + * + */ + mapper() { + return { + required: false, + serializedName: 'ImportSource', + type: { + name: 'Composite', + className: 'ImportSource', + modelProperties: { + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + sourceImage: { + required: true, + serializedName: 'sourceImage', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImportSource; diff --git a/lib/services/containerRegistryManagement/lib/models/index.d.ts b/lib/services/containerRegistryManagement/lib/models/index.d.ts index 9433863798..fecb9c6c9f 100644 --- a/lib/services/containerRegistryManagement/lib/models/index.d.ts +++ b/lib/services/containerRegistryManagement/lib/models/index.d.ts @@ -16,6 +16,54 @@ export { BaseResource } from 'ms-rest-azure'; export { CloudError } from 'ms-rest-azure'; +/** + * @class + * Initializes a new instance of the ImportSource class. + * @constructor + * @member {string} resourceId The resource identifier of the target Azure + * Container Registry. + * @member {string} sourceImage Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + */ +export interface ImportSource { + resourceId: string; + sourceImage: string; +} + +/** + * @class + * Initializes a new instance of the ImportImageParameters class. + * @constructor + * @member {object} source The source of the image. + * @member {string} [source.resourceId] The resource identifier of the target + * Azure Container Registry. + * @member {string} [source.sourceImage] Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * @member {array} [targetTags] List of strings of the form repo[:tag]. When + * tag is omitted the source will be used (or 'latest' if source tag is also + * omitted). + * @member {array} [untaggedTargetRepositories] List of strings of repository + * names to do a manifest only copy. No tag will be created. + * @member {string} [mode] When Force, any existing target tags will be + * overwritten. When NoForce, any existing target tags will fail the operation + * before any copying begins. Possible values include: 'NoForce', 'Force'. + * Default value: 'NoForce' . + */ +export interface ImportImageParameters { + source: ImportSource; + targetTags?: string[]; + untaggedTargetRepositories?: string[]; + mode?: string; +} + /** * @class * Initializes a new instance of the RegistryNameCheckRequest class. @@ -752,6 +800,657 @@ export interface Event extends EventInfo { eventResponseMessage?: EventResponseMessage; } +/** + * @class + * Initializes a new instance of the ImageDescriptor class. + * @constructor + * Properties for a registry image. + * + * @member {string} [registry] The registry login server. + * @member {string} [repository] The repository name. + * @member {string} [tag] The tag name. + * @member {string} [digest] The sha256-based digest of the image manifest. + */ +export interface ImageDescriptor { + registry?: string; + repository?: string; + tag?: string; + digest?: string; +} + +/** + * @class + * Initializes a new instance of the ImageUpdateTrigger class. + * @constructor + * The image update trigger that caused a build. + * + * @member {string} [id] The unique ID of the trigger. + * @member {date} [timestamp] The timestamp when the image update happened. + * @member {array} [images] The list of image updates that caused the build. + */ +export interface ImageUpdateTrigger { + id?: string; + timestamp?: Date; + images?: ImageDescriptor[]; +} + +/** + * @class + * Initializes a new instance of the GitCommitTrigger class. + * @constructor + * The git commit trigger that caused a build. + * + * @member {string} [id] The unique ID of the trigger. + * @member {string} [commitId] The unique ID that identifies a commit. + * @member {string} [repositoryUrl] The repository URL. + * @member {string} [branchName] The branch name in the repository. + * @member {string} [providerType] The source control provider type. + */ +export interface GitCommitTrigger { + id?: string; + commitId?: string; + repositoryUrl?: string; + branchName?: string; + providerType?: string; +} + +/** + * @class + * Initializes a new instance of the PlatformProperties class. + * @constructor + * The platform properties against which the build has to happen. + * + * @member {string} osType The operating system type required for the build. + * Possible values include: 'Windows', 'Linux' + * @member {number} [cpu] The CPU configuration in terms of number of cores + * required for the build. + */ +export interface PlatformProperties { + osType: string; + cpu?: number; +} + +/** + * @class + * Initializes a new instance of the ProxyResource class. + * @constructor + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * + * @member {string} [id] The resource ID. + * @member {string} [name] The name of the resource. + * @member {string} [type] The type of the resource. + */ +export interface ProxyResource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the Build class. + * @constructor + * Build resource properties + * + * @member {string} [buildId] The unique identifier for the build. + * @member {string} [status] The current status of the build. Possible values + * include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', + * 'Error', 'Timeout' + * @member {date} [lastUpdatedTime] The last updated time for the build. + * @member {string} [buildType] The type of build. Possible values include: + * 'AutoBuild', 'QuickBuild' + * @member {date} [createTime] The time the build was created. + * @member {date} [startTime] The time the build started. + * @member {date} [finishTime] The time the build finished. + * @member {array} [outputImages] The list of all images that were generated + * from the build. + * @member {string} [buildTask] The build task with which the build was + * started. + * @member {object} [imageUpdateTrigger] The image update trigger that caused + * the build. + * @member {string} [imageUpdateTrigger.id] The unique ID of the trigger. + * @member {date} [imageUpdateTrigger.timestamp] The timestamp when the image + * update happened. + * @member {array} [imageUpdateTrigger.images] The list of image updates that + * caused the build. + * @member {object} [gitCommitTrigger] The git commit trigger that caused the + * build. + * @member {string} [gitCommitTrigger.id] The unique ID of the trigger. + * @member {string} [gitCommitTrigger.commitId] The unique ID that identifies a + * commit. + * @member {string} [gitCommitTrigger.repositoryUrl] The repository URL. + * @member {string} [gitCommitTrigger.branchName] The branch name in the + * repository. + * @member {string} [gitCommitTrigger.providerType] The source control provider + * type. + * @member {boolean} [isArchiveEnabled] The value that indicates whether + * archiving is enabled or not. Default value: false . + * @member {object} [platform] The platform properties against which the build + * will happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number of + * cores required for the build. + * @member {string} [provisioningState] The provisioning state of a build. + * Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + * 'Failed', 'Canceled' + */ +export interface Build extends ProxyResource { + buildId?: string; + status?: string; + lastUpdatedTime?: Date; + buildType?: string; + createTime?: Date; + startTime?: Date; + finishTime?: Date; + outputImages?: ImageDescriptor[]; + buildTask?: string; + imageUpdateTrigger?: ImageUpdateTrigger; + gitCommitTrigger?: GitCommitTrigger; + isArchiveEnabled?: boolean; + platform?: PlatformProperties; + provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the BuildFilter class. + * @constructor + * Properties that are enabled for Odata querying. + * + * @member {string} [buildId] The unique identifier for the build. + * @member {string} [buildType] The type of build. Possible values include: + * 'AutoBuild', 'QuickBuild' + * @member {string} [status] The current status of the build. Possible values + * include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', + * 'Error', 'Timeout' + * @member {date} [createTime] The create time for a build. + * @member {date} [finishTime] The time the build finished. + * @member {string} [outputImageManifests] The list of comma-separated image + * manifests that were generated from the build. + * @member {boolean} [isArchiveEnabled] The value that indicates whether + * archiving is enabled or not. + * @member {string} [buildTaskName] The name of the build task that the build + * corresponds to. + */ +export interface BuildFilter { + buildId?: string; + buildType?: string; + status?: string; + createTime?: Date; + finishTime?: Date; + outputImageManifests?: string; + isArchiveEnabled?: boolean; + buildTaskName?: string; +} + +/** + * @class + * Initializes a new instance of the BuildUpdateParameters class. + * @constructor + * The set of build properties that can be updated. + * + * @member {boolean} [isArchiveEnabled] The value that indicates whether + * archiving is enabled or not. + */ +export interface BuildUpdateParameters { + isArchiveEnabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the BuildGetLogResult class. + * @constructor + * The result of get log link operation. + * + * @member {string} [logLink] The link to logs for a azure container registry + * build. + */ +export interface BuildGetLogResult { + logLink?: string; +} + +/** + * @class + * Initializes a new instance of the BuildStepProperties class. + * @constructor + * Base properties for any build step. + * + * @member {string} [provisioningState] The provisioning state of the build + * step. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled' + * @member {string} type Polymorphic Discriminator + */ +export interface BuildStepProperties { + readonly provisioningState?: string; + type: string; +} + +/** + * @class + * Initializes a new instance of the BuildStep class. + * @constructor + * Build step resource properties + * + * @member {object} [properties] The properties of a build step. + * @member {string} [properties.provisioningState] The provisioning state of + * the build step. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled' + * @member {string} [properties.type] Polymorphic Discriminator + */ +export interface BuildStep extends ProxyResource { + properties?: BuildStepProperties; +} + +/** + * @class + * Initializes a new instance of the BuildStepPropertiesUpdateParameters class. + * @constructor + * The properties for updating a build step. + * + * @member {string} type Polymorphic Discriminator + */ +export interface BuildStepPropertiesUpdateParameters { + type: string; +} + +/** + * @class + * Initializes a new instance of the BuildStepUpdateParameters class. + * @constructor + * The parameters for updating a build step. + * + * @member {object} [properties] The properties for updating a build step. + * @member {string} [properties.type] Polymorphic Discriminator + * @member {object} [tags] The ARM resource tags. + */ +export interface BuildStepUpdateParameters { + properties?: BuildStepPropertiesUpdateParameters; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the BuildArgument class. + * @constructor + * Properties of a build argument. + * + * @member {string} name The name of the argument. + * @member {string} value The value of the argument. + * @member {boolean} [isSecret] Flag to indicate whether the argument + * represents a secret and want to be removed from build logs. Default value: + * false . + */ +export interface BuildArgument { + name: string; + value: string; + isSecret?: boolean; +} + +/** + * @class + * Initializes a new instance of the SourceControlAuthInfo class. + * @constructor + * The authorization properties for accessing the source code repository. + * + * @member {string} [tokenType] The type of Auth token. Possible values + * include: 'PAT', 'OAuth' + * @member {string} token The access token used to access the source control + * provider. + * @member {string} [refreshToken] The refresh token used to refresh the access + * token. + * @member {string} [scope] The scope of the access token. + * @member {number} [expiresIn] Time in seconds that the token remains valid + */ +export interface SourceControlAuthInfo { + tokenType?: string; + token: string; + refreshToken?: string; + scope?: string; + expiresIn?: number; +} + +/** + * @class + * Initializes a new instance of the SourceRepositoryProperties class. + * @constructor + * The properties of the source code repository. + * + * @member {string} sourceControlType The type of source control service. + * Possible values include: 'Github', 'VisualStudioTeamService' + * @member {string} repositoryUrl The full URL to the source code respository + * @member {boolean} [isCommitTriggerEnabled] The value of this property + * indicates whether the source control commit trigger is enabled or not. + * Default value: false . + * @member {object} [sourceControlAuthProperties] The authorization properties + * for accessing the source code repository. + * @member {string} [sourceControlAuthProperties.tokenType] The type of Auth + * token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceControlAuthProperties.token] The access token used + * to access the source control provider. + * @member {string} [sourceControlAuthProperties.refreshToken] The refresh + * token used to refresh the access token. + * @member {string} [sourceControlAuthProperties.scope] The scope of the access + * token. + * @member {number} [sourceControlAuthProperties.expiresIn] Time in seconds + * that the token remains valid + */ +export interface SourceRepositoryProperties { + sourceControlType: string; + repositoryUrl: string; + isCommitTriggerEnabled?: boolean; + sourceControlAuthProperties?: SourceControlAuthInfo; +} + +/** + * @class + * Initializes a new instance of the BuildTask class. + * @constructor + * The build task that has the resource properties and all build items. The + * build task will have all information to schedule a build against it. + * + * @member {string} [provisioningState] The provisioning state of the build + * task. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled' + * @member {date} [creationDate] The creation date of build task. + * @member {string} alias The alternative updatable name for a build task. + * @member {string} [status] The current status of build task. Possible values + * include: 'Disabled', 'Enabled' + * @member {object} sourceRepository The properties that describes the + * source(code) for the build task. + * @member {string} [sourceRepository.sourceControlType] The type of source + * control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * @member {string} [sourceRepository.repositoryUrl] The full URL to the source + * code respository + * @member {boolean} [sourceRepository.isCommitTriggerEnabled] The value of + * this property indicates whether the source control commit trigger is enabled + * or not. + * @member {object} [sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * @member {string} [sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceRepository.sourceControlAuthProperties.token] The + * access token used to access the source control provider. + * @member {string} [sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * @member {string} [sourceRepository.sourceControlAuthProperties.scope] The + * scope of the access token. + * @member {number} [sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * @member {object} platform The platform properties against which the build + * has to happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number of + * cores required for the build. + * @member {number} [timeout] Build timeout in seconds. Default value: 3600 . + */ +export interface BuildTask extends Resource { + readonly provisioningState?: string; + readonly creationDate?: Date; + alias: string; + status?: string; + sourceRepository: SourceRepositoryProperties; + platform: PlatformProperties; + timeout?: number; +} + +/** + * @class + * Initializes a new instance of the BuildTaskFilter class. + * @constructor + * The filter that can be used for listing build tasks. + * + * @member {string} [alias] The alternative name for build task. + */ +export interface BuildTaskFilter { + alias?: string; +} + +/** + * @class + * Initializes a new instance of the SourceRepositoryUpdateParameters class. + * @constructor + * The properties for updating the source code repository configuration. + * + * @member {object} [sourceControlAuthProperties] The authorization properties + * for accessing the source code repository. + * @member {string} [sourceControlAuthProperties.tokenType] The type of Auth + * token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceControlAuthProperties.token] The access token used + * to access the source control provider. + * @member {string} [sourceControlAuthProperties.refreshToken] The refresh + * token used to refresh the access token. + * @member {string} [sourceControlAuthProperties.scope] The scope of the access + * token. + * @member {number} [sourceControlAuthProperties.expiresIn] Time in seconds + * that the token remains valid + * @member {boolean} [isCommitTriggerEnabled] The value of this property + * indicates whether the source control commit trigger is enabled or not. + */ +export interface SourceRepositoryUpdateParameters { + sourceControlAuthProperties?: SourceControlAuthInfo; + isCommitTriggerEnabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the BuildTaskUpdateParameters class. + * @constructor + * The parameters for updating a build task. + * + * @member {string} [alias] The alternative updatable name for a build task. + * @member {string} [status] The current status of build task. Possible values + * include: 'Disabled', 'Enabled' + * @member {object} [platform] The platform properties against which the build + * has to happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number of + * cores required for the build. + * @member {number} [timeout] Build timeout in seconds. + * @member {object} [sourceRepository] The properties that describes the + * source(code) for the build task. + * @member {object} [sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * @member {string} [sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceRepository.sourceControlAuthProperties.token] The + * access token used to access the source control provider. + * @member {string} [sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * @member {string} [sourceRepository.sourceControlAuthProperties.scope] The + * scope of the access token. + * @member {number} [sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * @member {boolean} [sourceRepository.isCommitTriggerEnabled] The value of + * this property indicates whether the source control commit trigger is enabled + * or not. + * @member {object} [tags] The ARM resource tags. + */ +export interface BuildTaskUpdateParameters { + alias?: string; + status?: string; + platform?: PlatformProperties; + timeout?: number; + sourceRepository?: SourceRepositoryUpdateParameters; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the QueueBuildRequest class. + * @constructor + * The queue build request parameters. + * + * @member {string} type Polymorphic Discriminator + */ +export interface QueueBuildRequest { + type: string; +} + +/** + * @class + * Initializes a new instance of the SourceUploadDefinition class. + * @constructor + * The properties of a response to source upload request. + * + * @member {string} [uploadUrl] The URL where the client can upload the source. + * @member {string} [relativePath] The relative path to the source. This is + * used to submit the subsequent queue build request. + */ +export interface SourceUploadDefinition { + uploadUrl?: string; + relativePath?: string; +} + +/** + * @class + * Initializes a new instance of the BaseImageDependency class. + * @constructor + * Properties that describe a base image dependency. + * + * @member {string} [type] The type of the base image dependency. Possible + * values include: 'BuildTime', 'RunTime' + * @member {string} [registry] The registry login server. + * @member {string} [repository] The repository name. + * @member {string} [tag] The tag name. + * @member {string} [digest] The sha256-based digest of the image manifest. + */ +export interface BaseImageDependency { + type?: string; + registry?: string; + repository?: string; + tag?: string; + digest?: string; +} + +/** + * @class + * Initializes a new instance of the DockerBuildStep class. + * @constructor + * The Docker build step. + * + * @member {string} [branch] The repository branch name. + * @member {array} [imageNames] The fully qualified image names including the + * repository and tag. + * @member {boolean} [isPushEnabled] The value of this property indicates + * whether the image built should be pushed to the registry or not. Default + * value: true . + * @member {boolean} [noCache] The value of this property indicates whether the + * image cache is enabled or not. Default value: false . + * @member {string} [dockerFilePath] The Docker file path relative to the + * source control root. + * @member {string} [contextPath] The relative context path for a docker build + * in the source. + * @member {array} [buildArguments] The custom arguments for building this + * build step. + * @member {array} [baseImageDependencies] List of base image dependencies for + * a step. + * @member {string} [baseImageTrigger] The type of the auto trigger for base + * image dependency updates. Possible values include: 'All', 'Runtime', 'None' + */ +export interface DockerBuildStep extends BuildStepProperties { + branch?: string; + imageNames?: string[]; + isPushEnabled?: boolean; + noCache?: boolean; + dockerFilePath?: string; + contextPath?: string; + buildArguments?: BuildArgument[]; + readonly baseImageDependencies?: BaseImageDependency[]; + baseImageTrigger?: string; +} + +/** + * @class + * Initializes a new instance of the DockerBuildStepUpdateParameters class. + * @constructor + * The properties for updating a docker build step. + * + * @member {string} [branch] The repository branch name. + * @member {array} [imageNames] The fully qualified image names including the + * repository and tag. + * @member {boolean} [isPushEnabled] The value of this property indicates + * whether the image built should be pushed to the registry or not. + * @member {boolean} [noCache] The value of this property indicates whether the + * image cache is enabled or not. + * @member {string} [dockerFilePath] The Docker file path relative to the + * source control root. + * @member {string} [contextPath] The relative context path for a docker build + * in the source. + * @member {array} [buildArguments] The custom arguments for building this + * build step. + * @member {string} [baseImageTrigger] The type of the auto trigger for base + * image dependency updates. Possible values include: 'All', 'Runtime', 'None' + */ +export interface DockerBuildStepUpdateParameters extends BuildStepPropertiesUpdateParameters { + branch?: string; + imageNames?: string[]; + isPushEnabled?: boolean; + noCache?: boolean; + dockerFilePath?: string; + contextPath?: string; + buildArguments?: BuildArgument[]; + baseImageTrigger?: string; +} + +/** + * @class + * Initializes a new instance of the BuildTaskBuildRequest class. + * @constructor + * The queue build parameters based on a build task. + * + * @member {string} buildTaskName The name of build task against which build + * has to be queued. + */ +export interface BuildTaskBuildRequest extends QueueBuildRequest { + buildTaskName: string; +} + +/** + * @class + * Initializes a new instance of the QuickBuildRequest class. + * @constructor + * The queue build request parameters for a quick build. + * + * @member {array} [imageNames] The fully qualified image names including the + * repository and tag. + * @member {string} sourceLocation The URL(absolute or relative) of the source + * that needs to be built. For Docker build, it can be an URL to a tar or + * github repoistory as supported by Docker. + * If it is relative URL, the relative path should be obtained from calling + * getSourceUploadUrl API. + * @member {array} [buildArguments] The collection of build arguments to be + * used. + * @member {boolean} [isPushEnabled] The value of this property indicates + * whether the image built should be pushed to the registry or not. Default + * value: true . + * @member {boolean} [noCache] The value of this property indicates whether the + * image cache is enabled or not. Default value: false . + * @member {number} [timeout] Build timeout in seconds. Default value: 3600 . + * @member {object} platform The platform properties against which the build + * will happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number of + * cores required for the build. + * @member {string} dockerFilePath The Docker file path relative to the source + * location. + */ +export interface QuickBuildRequest extends QueueBuildRequest { + imageNames?: string[]; + sourceLocation: string; + buildArguments?: BuildArgument[]; + isPushEnabled?: boolean; + noCache?: boolean; + timeout?: number; + platform: PlatformProperties; + dockerFilePath: string; +} + /** * @class @@ -817,3 +1516,55 @@ export interface WebhookListResult extends Array { export interface EventListResult extends Array { nextLink?: string; } + +/** + * @class + * Initializes a new instance of the BuildListResult class. + * @constructor + * Collection of builds. + * + * @member {string} [nextLink] The URI that can be used to request the next set + * of paged results. + */ +export interface BuildListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the BuildStepList class. + * @constructor + * The collection of build items. + * + * @member {string} [nextLink] The URI that can be used to request the next set + * of paged results. + */ +export interface BuildStepList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the BuildArgumentList class. + * @constructor + * The list of build arguments for a build step. + * + * @member {string} [nextLink] The URI that can be used to request the next set + * of paged results. + */ +export interface BuildArgumentList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the BuildTaskListResult class. + * @constructor + * The collection of build tasks. + * + * @member {string} [nextLink] The URI that can be used to request the next set + * of paged results. + */ +export interface BuildTaskListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/containerRegistryManagement/lib/models/index.js b/lib/services/containerRegistryManagement/lib/models/index.js index 349addacf7..cb2d81152f 100644 --- a/lib/services/containerRegistryManagement/lib/models/index.js +++ b/lib/services/containerRegistryManagement/lib/models/index.js @@ -18,6 +18,8 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; +exports.ImportSource = require('./importSource'); +exports.ImportImageParameters = require('./importImageParameters'); exports.RegistryNameCheckRequest = require('./registryNameCheckRequest'); exports.RegistryNameStatus = require('./registryNameStatus'); exports.OperationDisplayDefinition = require('./operationDisplayDefinition'); @@ -48,8 +50,48 @@ exports.EventContent = require('./eventContent'); exports.EventRequestMessage = require('./eventRequestMessage'); exports.EventResponseMessage = require('./eventResponseMessage'); exports.Event = require('./event'); +exports.ImageDescriptor = require('./imageDescriptor'); +exports.ImageUpdateTrigger = require('./imageUpdateTrigger'); +exports.GitCommitTrigger = require('./gitCommitTrigger'); +exports.PlatformProperties = require('./platformProperties'); +exports.ProxyResource = require('./proxyResource'); +exports.Build = require('./build'); +exports.BuildFilter = require('./buildFilter'); +exports.BuildUpdateParameters = require('./buildUpdateParameters'); +exports.BuildGetLogResult = require('./buildGetLogResult'); +exports.BuildStepProperties = require('./buildStepProperties'); +exports.BuildStep = require('./buildStep'); +exports.BuildStepPropertiesUpdateParameters = require('./buildStepPropertiesUpdateParameters'); +exports.BuildStepUpdateParameters = require('./buildStepUpdateParameters'); +exports.BuildArgument = require('./buildArgument'); +exports.SourceControlAuthInfo = require('./sourceControlAuthInfo'); +exports.SourceRepositoryProperties = require('./sourceRepositoryProperties'); +exports.BuildTask = require('./buildTask'); +exports.BuildTaskFilter = require('./buildTaskFilter'); +exports.SourceRepositoryUpdateParameters = require('./sourceRepositoryUpdateParameters'); +exports.BuildTaskUpdateParameters = require('./buildTaskUpdateParameters'); +exports.QueueBuildRequest = require('./queueBuildRequest'); +exports.SourceUploadDefinition = require('./sourceUploadDefinition'); +exports.BaseImageDependency = require('./baseImageDependency'); +exports.DockerBuildStep = require('./dockerBuildStep'); +exports.DockerBuildStepUpdateParameters = require('./dockerBuildStepUpdateParameters'); +exports.BuildTaskBuildRequest = require('./buildTaskBuildRequest'); +exports.QuickBuildRequest = require('./quickBuildRequest'); exports.RegistryListResult = require('./registryListResult'); exports.OperationListResult = require('./operationListResult'); exports.ReplicationListResult = require('./replicationListResult'); exports.WebhookListResult = require('./webhookListResult'); exports.EventListResult = require('./eventListResult'); +exports.BuildListResult = require('./buildListResult'); +exports.BuildStepList = require('./buildStepList'); +exports.BuildArgumentList = require('./buildArgumentList'); +exports.BuildTaskListResult = require('./buildTaskListResult'); +exports.discriminators = { + 'BuildStepProperties' : exports.BuildStepProperties, + 'BuildStepPropertiesUpdateParameters' : exports.BuildStepPropertiesUpdateParameters, + 'QueueBuildRequest' : exports.QueueBuildRequest, + 'BuildStepProperties.Docker' : exports.DockerBuildStep, + 'BuildStepPropertiesUpdateParameters.Docker' : exports.DockerBuildStepUpdateParameters, + 'QueueBuildRequest.BuildTask' : exports.BuildTaskBuildRequest, + 'QueueBuildRequest.QuickBuild' : exports.QuickBuildRequest +}; diff --git a/lib/services/containerRegistryManagement/lib/models/platformProperties.js b/lib/services/containerRegistryManagement/lib/models/platformProperties.js new file mode 100644 index 0000000000..1199942297 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/platformProperties.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The platform properties against which the build has to happen. + * + */ +class PlatformProperties { + /** + * Create a PlatformProperties. + * @member {string} osType The operating system type required for the build. + * Possible values include: 'Windows', 'Linux' + * @member {number} [cpu] The CPU configuration in terms of number of cores + * required for the build. + */ + constructor() { + } + + /** + * Defines the metadata of PlatformProperties + * + * @returns {object} metadata of PlatformProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'PlatformProperties', + type: { + name: 'Composite', + className: 'PlatformProperties', + modelProperties: { + osType: { + required: true, + serializedName: 'osType', + type: { + name: 'String' + } + }, + cpu: { + required: false, + serializedName: 'cpu', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = PlatformProperties; diff --git a/lib/services/containerRegistryManagement/lib/models/proxyResource.js b/lib/services/containerRegistryManagement/lib/models/proxyResource.js new file mode 100644 index 0000000000..6bc01330b6 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/proxyResource.js @@ -0,0 +1,76 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + * + * @extends models['BaseResource'] + */ +class ProxyResource extends models['BaseResource'] { + /** + * Create a ProxyResource. + * @member {string} [id] The resource ID. + * @member {string} [name] The name of the resource. + * @member {string} [type] The type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProxyResource + * + * @returns {object} metadata of ProxyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ProxyResource', + type: { + name: 'Composite', + className: 'ProxyResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ProxyResource; diff --git a/lib/services/containerRegistryManagement/lib/models/queueBuildRequest.js b/lib/services/containerRegistryManagement/lib/models/queueBuildRequest.js new file mode 100644 index 0000000000..c13727eb79 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/queueBuildRequest.js @@ -0,0 +1,58 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The queue build request parameters. + * + */ +class QueueBuildRequest { + /** + * Create a QueueBuildRequest. + * @member {string} type Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of QueueBuildRequest + * + * @returns {object} metadata of QueueBuildRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'QueueBuildRequest', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'QueueBuildRequest', + className: 'QueueBuildRequest', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = QueueBuildRequest; diff --git a/lib/services/containerRegistryManagement/lib/models/quickBuildRequest.js b/lib/services/containerRegistryManagement/lib/models/quickBuildRequest.js new file mode 100644 index 0000000000..ca23551da6 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/quickBuildRequest.js @@ -0,0 +1,163 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The queue build request parameters for a quick build. + * + * @extends models['QueueBuildRequest'] + */ +class QuickBuildRequest extends models['QueueBuildRequest'] { + /** + * Create a QuickBuildRequest. + * @member {array} [imageNames] The fully qualified image names including the + * repository and tag. + * @member {string} sourceLocation The URL(absolute or relative) of the + * source that needs to be built. For Docker build, it can be an URL to a tar + * or github repoistory as supported by Docker. + * If it is relative URL, the relative path should be obtained from calling + * getSourceUploadUrl API. + * @member {array} [buildArguments] The collection of build arguments to be + * used. + * @member {boolean} [isPushEnabled] The value of this property indicates + * whether the image built should be pushed to the registry or not. Default + * value: true . + * @member {boolean} [noCache] The value of this property indicates whether + * the image cache is enabled or not. Default value: false . + * @member {number} [timeout] Build timeout in seconds. Default value: 3600 . + * @member {object} platform The platform properties against which the build + * will happen. + * @member {string} [platform.osType] The operating system type required for + * the build. Possible values include: 'Windows', 'Linux' + * @member {number} [platform.cpu] The CPU configuration in terms of number + * of cores required for the build. + * @member {string} dockerFilePath The Docker file path relative to the + * source location. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of QuickBuildRequest + * + * @returns {object} metadata of QuickBuildRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'QuickBuild', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'QueueBuildRequest', + className: 'QuickBuildRequest', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + imageNames: { + required: false, + serializedName: 'imageNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sourceLocation: { + required: true, + serializedName: 'sourceLocation', + type: { + name: 'String' + } + }, + buildArguments: { + required: false, + serializedName: 'buildArguments', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BuildArgumentElementType', + type: { + name: 'Composite', + className: 'BuildArgument' + } + } + } + }, + isPushEnabled: { + required: false, + serializedName: 'isPushEnabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + noCache: { + required: false, + serializedName: 'noCache', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + timeout: { + required: false, + serializedName: 'timeout', + defaultValue: 3600, + constraints: { + InclusiveMaximum: 28800, + InclusiveMinimum: 300 + }, + type: { + name: 'Number' + } + }, + platform: { + required: true, + serializedName: 'platform', + type: { + name: 'Composite', + className: 'PlatformProperties' + } + }, + dockerFilePath: { + required: true, + serializedName: 'dockerFilePath', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = QuickBuildRequest; diff --git a/lib/services/containerRegistryManagement/lib/models/sourceControlAuthInfo.js b/lib/services/containerRegistryManagement/lib/models/sourceControlAuthInfo.js new file mode 100644 index 0000000000..01720aba0e --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/sourceControlAuthInfo.js @@ -0,0 +1,87 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The authorization properties for accessing the source code repository. + * + */ +class SourceControlAuthInfo { + /** + * Create a SourceControlAuthInfo. + * @member {string} [tokenType] The type of Auth token. Possible values + * include: 'PAT', 'OAuth' + * @member {string} token The access token used to access the source control + * provider. + * @member {string} [refreshToken] The refresh token used to refresh the + * access token. + * @member {string} [scope] The scope of the access token. + * @member {number} [expiresIn] Time in seconds that the token remains valid + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlAuthInfo + * + * @returns {object} metadata of SourceControlAuthInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlAuthInfo', + type: { + name: 'Composite', + className: 'SourceControlAuthInfo', + modelProperties: { + tokenType: { + required: false, + serializedName: 'tokenType', + type: { + name: 'String' + } + }, + token: { + required: true, + serializedName: 'token', + type: { + name: 'String' + } + }, + refreshToken: { + required: false, + serializedName: 'refreshToken', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'scope', + type: { + name: 'String' + } + }, + expiresIn: { + required: false, + serializedName: 'expiresIn', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SourceControlAuthInfo; diff --git a/lib/services/containerRegistryManagement/lib/models/sourceRepositoryProperties.js b/lib/services/containerRegistryManagement/lib/models/sourceRepositoryProperties.js new file mode 100644 index 0000000000..d1165ef2f3 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/sourceRepositoryProperties.js @@ -0,0 +1,94 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The properties of the source code repository. + * + */ +class SourceRepositoryProperties { + /** + * Create a SourceRepositoryProperties. + * @member {string} sourceControlType The type of source control service. + * Possible values include: 'Github', 'VisualStudioTeamService' + * @member {string} repositoryUrl The full URL to the source code respository + * @member {boolean} [isCommitTriggerEnabled] The value of this property + * indicates whether the source control commit trigger is enabled or not. + * Default value: false . + * @member {object} [sourceControlAuthProperties] The authorization + * properties for accessing the source code repository. + * @member {string} [sourceControlAuthProperties.tokenType] The type of Auth + * token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceControlAuthProperties.token] The access token used + * to access the source control provider. + * @member {string} [sourceControlAuthProperties.refreshToken] The refresh + * token used to refresh the access token. + * @member {string} [sourceControlAuthProperties.scope] The scope of the + * access token. + * @member {number} [sourceControlAuthProperties.expiresIn] Time in seconds + * that the token remains valid + */ + constructor() { + } + + /** + * Defines the metadata of SourceRepositoryProperties + * + * @returns {object} metadata of SourceRepositoryProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceRepositoryProperties', + type: { + name: 'Composite', + className: 'SourceRepositoryProperties', + modelProperties: { + sourceControlType: { + required: true, + serializedName: 'sourceControlType', + type: { + name: 'String' + } + }, + repositoryUrl: { + required: true, + serializedName: 'repositoryUrl', + type: { + name: 'String' + } + }, + isCommitTriggerEnabled: { + required: false, + serializedName: 'isCommitTriggerEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + sourceControlAuthProperties: { + required: false, + serializedName: 'sourceControlAuthProperties', + type: { + name: 'Composite', + className: 'SourceControlAuthInfo' + } + } + } + } + }; + } +} + +module.exports = SourceRepositoryProperties; diff --git a/lib/services/containerRegistryManagement/lib/models/sourceRepositoryUpdateParameters.js b/lib/services/containerRegistryManagement/lib/models/sourceRepositoryUpdateParameters.js new file mode 100644 index 0000000000..c17ed745cb --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/sourceRepositoryUpdateParameters.js @@ -0,0 +1,75 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The properties for updating the source code repository configuration. + * + */ +class SourceRepositoryUpdateParameters { + /** + * Create a SourceRepositoryUpdateParameters. + * @member {object} [sourceControlAuthProperties] The authorization + * properties for accessing the source code repository. + * @member {string} [sourceControlAuthProperties.tokenType] The type of Auth + * token. Possible values include: 'PAT', 'OAuth' + * @member {string} [sourceControlAuthProperties.token] The access token used + * to access the source control provider. + * @member {string} [sourceControlAuthProperties.refreshToken] The refresh + * token used to refresh the access token. + * @member {string} [sourceControlAuthProperties.scope] The scope of the + * access token. + * @member {number} [sourceControlAuthProperties.expiresIn] Time in seconds + * that the token remains valid + * @member {boolean} [isCommitTriggerEnabled] The value of this property + * indicates whether the source control commit trigger is enabled or not. + */ + constructor() { + } + + /** + * Defines the metadata of SourceRepositoryUpdateParameters + * + * @returns {object} metadata of SourceRepositoryUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceRepositoryUpdateParameters', + type: { + name: 'Composite', + className: 'SourceRepositoryUpdateParameters', + modelProperties: { + sourceControlAuthProperties: { + required: false, + serializedName: 'sourceControlAuthProperties', + type: { + name: 'Composite', + className: 'SourceControlAuthInfo' + } + }, + isCommitTriggerEnabled: { + required: false, + serializedName: 'isCommitTriggerEnabled', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = SourceRepositoryUpdateParameters; diff --git a/lib/services/containerRegistryManagement/lib/models/sourceUploadDefinition.js b/lib/services/containerRegistryManagement/lib/models/sourceUploadDefinition.js new file mode 100644 index 0000000000..8d802bc172 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/sourceUploadDefinition.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties of a response to source upload request. + * + */ +class SourceUploadDefinition { + /** + * Create a SourceUploadDefinition. + * @member {string} [uploadUrl] The URL where the client can upload the + * source. + * @member {string} [relativePath] The relative path to the source. This is + * used to submit the subsequent queue build request. + */ + constructor() { + } + + /** + * Defines the metadata of SourceUploadDefinition + * + * @returns {object} metadata of SourceUploadDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceUploadDefinition', + type: { + name: 'Composite', + className: 'SourceUploadDefinition', + modelProperties: { + uploadUrl: { + required: false, + serializedName: 'uploadUrl', + type: { + name: 'String' + } + }, + relativePath: { + required: false, + serializedName: 'relativePath', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceUploadDefinition; diff --git a/lib/services/containerRegistryManagement/lib/operations/buildSteps.js b/lib/services/containerRegistryManagement/lib/operations/buildSteps.js new file mode 100644 index 0000000000..e96f28212d --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/operations/buildSteps.js @@ -0,0 +1,2916 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List all the build steps for a given build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStepList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, registryName, buildTaskName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStepList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, registryName, buildTaskName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (stepName !== null && stepName !== undefined) { + if (stepName.length > 50) + { + throw new Error('"stepName" should satisfy the constraint - "MaxLength": 50'); + } + if (stepName.length < 5) + { + throw new Error('"stepName" should satisfy the constraint - "MinLength": 5'); + } + if (stepName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"stepName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * List the build arguments for a step including the secret arguments. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildArgumentList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBuildArguments(resourceGroupName, registryName, buildTaskName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (stepName !== null && stepName !== undefined) { + if (stepName.length > 50) + { + throw new Error('"stepName" should satisfy the constraint - "MaxLength": 50'); + } + if (stepName.length < 5) + { + throw new Error('"stepName" should satisfy the constraint - "MinLength": 5'); + } + if (stepName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"stepName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}/listBuildArguments'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildArgumentList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (stepName !== null && stepName !== undefined) { + if (stepName.length > 50) + { + throw new Error('"stepName" should satisfy the constraint - "MaxLength": 50'); + } + if (stepName.length < 5) + { + throw new Error('"stepName" should satisfy the constraint - "MinLength": 5'); + } + if (stepName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"stepName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildStepCreateParameters === null || buildStepCreateParameters === undefined) { + throw new Error('buildStepCreateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (buildStepCreateParameters !== null && buildStepCreateParameters !== undefined) { + let requestModelMapper = new client.models['BuildStep']().mapper(); + requestModel = client.serialize(requestModelMapper, buildStepCreateParameters, 'buildStepCreateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(buildStepCreateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (stepName !== null && stepName !== undefined) { + if (stepName.length > 50) + { + throw new Error('"stepName" should satisfy the constraint - "MaxLength": 50'); + } + if (stepName.length < 5) + { + throw new Error('"stepName" should satisfy the constraint - "MinLength": 5'); + } + if (stepName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"stepName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (stepName !== null && stepName !== undefined) { + if (stepName.length > 50) + { + throw new Error('"stepName" should satisfy the constraint - "MaxLength": 50'); + } + if (stepName.length < 5) + { + throw new Error('"stepName" should satisfy the constraint - "MinLength": 5'); + } + if (stepName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"stepName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildStepUpdateParameters === null || buildStepUpdateParameters === undefined) { + throw new Error('buildStepUpdateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (buildStepUpdateParameters !== null && buildStepUpdateParameters !== undefined) { + let requestModelMapper = new client.models['BuildStepUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, buildStepUpdateParameters, 'buildStepUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(buildStepUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStep']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List all the build steps for a given build task. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStepList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildStepList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List the build arguments for a step including the secret arguments. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildArgumentList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBuildArgumentsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildArgumentList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a BuildSteps. */ +class BuildSteps { + /** + * Create a BuildSteps. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listBuildArguments = _listBuildArguments; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + this._listBuildArgumentsNext = _listBuildArgumentsNext; + } + + /** + * List all the build steps for a given build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all the build steps for a given build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStepList} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStepList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, registryName, buildTaskName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, registryName, buildTaskName, options, optionalCallback); + } + } + + /** + * Gets the build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback); + } + } + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, optionalCallback); + } + } + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback); + } + } + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, optionalCallback); + } + } + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBuildArgumentsWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBuildArguments(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildArgumentList} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildArgumentList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBuildArguments(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBuildArguments(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBuildArguments(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback); + } + } + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters, options, optionalCallback); + } + } + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, registryName, buildTaskName, stepName, options, optionalCallback); + } + } + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters, options, optionalCallback); + } + } + + /** + * List all the build steps for a given build task. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all the build steps for a given build task. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildStepList} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStepList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBuildArgumentsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBuildArgumentsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildArgumentList} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildArgumentList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBuildArgumentsNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBuildArgumentsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBuildArgumentsNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = BuildSteps; diff --git a/lib/services/containerRegistryManagement/lib/operations/buildTasks.js b/lib/services/containerRegistryManagement/lib/operations/buildTasks.js new file mode 100644 index 0000000000..d2f6e1201b --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/operations/buildTasks.js @@ -0,0 +1,3164 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all the build tasks for a specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The build task filter to apply on the + * operation. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * build tasks, which provides the next page in the list of tasks. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTaskListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skipToken = (options && options.skipToken !== undefined) ? options.skipToken : undefined; + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skipToken !== null && skipToken !== undefined && typeof skipToken.valueOf() !== 'string') { + throw new Error('skipToken must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skipToken !== null && skipToken !== undefined) { + queryParameters.push('$skipToken=' + encodeURIComponent(skipToken)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTaskListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get the properties of a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, registryName, buildTaskName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, registryName, buildTaskName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, registryName, buildTaskName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Get the source control properties for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SourceRepositoryProperties} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listSourceRepositoryProperties(resourceGroupName, registryName, buildTaskName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceRepositoryProperties']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskCreateParameters === null || buildTaskCreateParameters === undefined) { + throw new Error('buildTaskCreateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (buildTaskCreateParameters !== null && buildTaskCreateParameters !== undefined) { + let requestModelMapper = new client.models['BuildTask']().mapper(); + requestModel = client.serialize(requestModelMapper, buildTaskCreateParameters, 'buildTaskCreateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(buildTaskCreateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, registryName, buildTaskName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskName === null || buildTaskName === undefined || typeof buildTaskName.valueOf() !== 'string') { + throw new Error('buildTaskName cannot be null or undefined and it must be of type string.'); + } + if (buildTaskName !== null && buildTaskName !== undefined) { + if (buildTaskName.length > 50) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MaxLength": 50'); + } + if (buildTaskName.length < 5) + { + throw new Error('"buildTaskName" should satisfy the constraint - "MinLength": 5'); + } + if (buildTaskName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"buildTaskName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildTaskUpdateParameters === null || buildTaskUpdateParameters === undefined) { + throw new Error('buildTaskUpdateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildTaskName}', encodeURIComponent(buildTaskName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (buildTaskUpdateParameters !== null && buildTaskUpdateParameters !== undefined) { + let requestModelMapper = new client.models['BuildTaskUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, buildTaskUpdateParameters, 'buildTaskUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(buildTaskUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTask']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the build tasks for a specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTaskListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildTaskListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a BuildTasks. */ +class BuildTasks { + /** + * Create a BuildTasks. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listSourceRepositoryProperties = _listSourceRepositoryProperties; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + } + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The build task filter to apply on the + * operation. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * build tasks, which provides the next page in the list of tasks. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The build task filter to apply on the + * operation. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * build tasks, which provides the next page in the list of tasks. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTaskListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTaskListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Get the properties of a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the properties of a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, registryName, buildTaskName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, registryName, buildTaskName, options, optionalCallback); + } + } + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, optionalCallback); + } + } + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, registryName, buildTaskName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, registryName, buildTaskName, options, optionalCallback); + } + } + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, optionalCallback); + } + } + + /** + * Get the source control properties for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listSourceRepositoryPropertiesWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listSourceRepositoryProperties(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the source control properties for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SourceRepositoryProperties} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SourceRepositoryProperties} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listSourceRepositoryProperties(resourceGroupName, registryName, buildTaskName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listSourceRepositoryProperties(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listSourceRepositoryProperties(resourceGroupName, registryName, buildTaskName, options, optionalCallback); + } + } + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters, options, optionalCallback); + } + } + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, registryName, buildTaskName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, registryName, buildTaskName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, registryName, buildTaskName, options, optionalCallback); + } + } + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildTaskListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTaskListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = BuildTasks; diff --git a/lib/services/containerRegistryManagement/lib/operations/builds.js b/lib/services/containerRegistryManagement/lib/operations/builds.js new file mode 100644 index 0000000000..8ece9768e6 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/operations/builds.js @@ -0,0 +1,1941 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the builds for a registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The builds filter to apply on the + * operation. + * + * @param {number} [options.top] $top is supported for get list of builds, + * which limits the maximum number of builds to return. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * builds, which provides the next page in the list of builds. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skipToken = (options && options.skipToken !== undefined) ? options.skipToken : undefined; + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (skipToken !== null && skipToken !== undefined && typeof skipToken.valueOf() !== 'string') { + throw new Error('skipToken must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skipToken !== null && skipToken !== undefined) { + queryParameters.push('$skipToken=' + encodeURIComponent(skipToken)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the detailed information for a given build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, registryName, buildId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildId === null || buildId === undefined || typeof buildId.valueOf() !== 'string') { + throw new Error('buildId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildId}', encodeURIComponent(buildId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Build']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, registryName, buildId, buildUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, registryName, buildId, buildUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Build']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a link to download the build logs. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildGetLogResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getLogLink(resourceGroupName, registryName, buildId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildId === null || buildId === undefined || typeof buildId.valueOf() !== 'string') { + throw new Error('buildId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildId}', encodeURIComponent(buildId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildGetLogResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _cancel(resourceGroupName, registryName, buildId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCancel(resourceGroupName, registryName, buildId, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, registryName, buildId, buildUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildId === null || buildId === undefined || typeof buildId.valueOf() !== 'string') { + throw new Error('buildId cannot be null or undefined and it must be of type string.'); + } + if (buildUpdateParameters === null || buildUpdateParameters === undefined) { + throw new Error('buildUpdateParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildId}', encodeURIComponent(buildId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (buildUpdateParameters !== null && buildUpdateParameters !== undefined) { + let requestModelMapper = new client.models['BuildUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, buildUpdateParameters, 'buildUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(buildUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Build']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Build']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCancel(resourceGroupName, registryName, buildId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildId === null || buildId === undefined || typeof buildId.valueOf() !== 'string') { + throw new Error('buildId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + requestUrl = requestUrl.replace('{buildId}', encodeURIComponent(buildId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the builds for a registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BuildListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Builds. */ +class Builds { + /** + * Create a Builds. + * @param {ContainerRegistryManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._update = _update; + this._getLogLink = _getLogLink; + this._cancel = _cancel; + this._beginUpdate = _beginUpdate; + this._beginCancel = _beginCancel; + this._listNext = _listNext; + } + + /** + * Gets all the builds for a registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The builds filter to apply on the + * operation. + * + * @param {number} [options.top] $top is supported for get list of builds, + * which limits the maximum number of builds to return. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * builds, which provides the next page in the list of builds. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the builds for a registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The builds filter to apply on the + * operation. + * + * @param {number} [options.top] $top is supported for get list of builds, + * which limits the maximum number of builds to return. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * builds, which provides the next page in the list of builds. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, registryName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, registryName, options, optionalCallback); + } + } + + /** + * Gets the detailed information for a given build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, registryName, buildId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the detailed information for a given build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, registryName, buildId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, registryName, buildId, options, optionalCallback); + } + } + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, registryName, buildId, buildUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, buildId, buildUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, buildId, buildUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, buildId, buildUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, buildId, buildUpdateParameters, options, optionalCallback); + } + } + + /** + * Gets a link to download the build logs. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getLogLinkWithHttpOperationResponse(resourceGroupName, registryName, buildId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getLogLink(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a link to download the build logs. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildGetLogResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildGetLogResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getLogLink(resourceGroupName, registryName, buildId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getLogLink(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getLogLink(resourceGroupName, registryName, buildId, options, optionalCallback); + } + } + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + cancelWithHttpOperationResponse(resourceGroupName, registryName, buildId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + cancel(resourceGroupName, registryName, buildId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._cancel(resourceGroupName, registryName, buildId, options, optionalCallback); + } + } + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, registryName, buildId, buildUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, buildId, buildUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, registryName, buildId, buildUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, registryName, buildId, buildUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, registryName, buildId, buildUpdateParameters, options, optionalCallback); + } + } + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCancelWithHttpOperationResponse(resourceGroupName, registryName, buildId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCancel(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCancel(resourceGroupName, registryName, buildId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCancel(resourceGroupName, registryName, buildId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCancel(resourceGroupName, registryName, buildId, options, optionalCallback); + } + } + + /** + * Gets all the builds for a registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the builds for a registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BuildListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BuildListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Builds; diff --git a/lib/services/containerRegistryManagement/lib/operations/index.d.ts b/lib/services/containerRegistryManagement/lib/operations/index.d.ts index d03086d86c..e1d57a4040 100644 --- a/lib/services/containerRegistryManagement/lib/operations/index.d.ts +++ b/lib/services/containerRegistryManagement/lib/operations/index.d.ts @@ -21,6 +21,124 @@ import * as models from '../models'; export interface Registries { + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + importImageWithHttpOperationResponse(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + importImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + importImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, callback: ServiceCallback): void; + importImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Checks whether the container registry name is available for use. The name * must contain only alphanumeric characters, be globally unique, and between 5 @@ -733,6 +851,257 @@ export interface Registries { listUsages(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Creates a new build based on the request parameters and add it to the build + * queue. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + queueBuildWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new build based on the request parameters and add it to the build + * queue. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Build} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + queueBuild(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + queueBuild(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, callback: ServiceCallback): void; + queueBuild(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getBuildSourceUploadUrlWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SourceUploadDefinition} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SourceUploadDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link SourceUploadDefinition} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getBuildSourceUploadUrl(resourceGroupName: string, registryName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getBuildSourceUploadUrl(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + getBuildSourceUploadUrl(resourceGroupName: string, registryName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginImportImageWithHttpOperationResponse(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginImportImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginImportImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, callback: ServiceCallback): void; + beginImportImage(resourceGroupName: string, registryName: string, parameters: models.ImportImageParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Creates a container registry with the specified parameters. * @@ -1008,10 +1377,81 @@ export interface Registries { /** - * Lists all the container registries under the specified resource group. + * Creates a new build based on the request parameters and add it to the build + * queue. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginQueueBuildWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new build based on the request parameters and add it to the build + * queue. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Build} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginQueueBuild(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginQueueBuild(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, callback: ServiceCallback): void; + beginQueueBuild(resourceGroupName: string, registryName: string, buildRequest: models.QueueBuildRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2905,3 +3345,2536 @@ export interface Webhooks { listEventsNext(nextPageLink: string, callback: ServiceCallback): void; listEventsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } + +/** + * @class + * Builds + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface Builds { + + + /** + * Gets all the builds for a registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The builds filter to apply on the + * operation. + * + * @param {number} [options.top] $top is supported for get list of builds, + * which limits the maximum number of builds to return. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * builds, which provides the next page in the list of builds. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { filter? : string, top? : number, skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the builds for a registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The builds filter to apply on the + * operation. + * + * @param {number} [options.top] $top is supported for get list of builds, + * which limits the maximum number of builds to return. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * builds, which provides the next page in the list of builds. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BuildListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, registryName: string, options?: { filter? : string, top? : number, skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, registryName: string, options: { filter? : string, top? : number, skipToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the detailed information for a given build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the detailed information for a given build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Build} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, registryName: string, buildId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, registryName: string, buildId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Build} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a link to download the build logs. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getLogLinkWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a link to download the build logs. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildGetLogResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildGetLogResult} [result] - The deserialized result object if an error did not occur. + * See {@link BuildGetLogResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getLogLink(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getLogLink(resourceGroupName: string, registryName: string, buildId: string, callback: ServiceCallback): void; + getLogLink(resourceGroupName: string, registryName: string, buildId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + cancelWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + cancel(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, registryName: string, buildId: string, callback: ServiceCallback): void; + cancel(resourceGroupName: string, registryName: string, buildId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Patch the build properties. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} buildUpdateParameters The build update properties. + * + * @param {boolean} [buildUpdateParameters.isArchiveEnabled] The value that + * indicates whether archiving is enabled or not. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Build} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, registryName: string, buildId: string, buildUpdateParameters: models.BuildUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCancelWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Cancel an existing build. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildId The build ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCancel(resourceGroupName: string, registryName: string, buildId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCancel(resourceGroupName: string, registryName: string, buildId: string, callback: ServiceCallback): void; + beginCancel(resourceGroupName: string, registryName: string, buildId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the builds for a registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the builds for a registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BuildListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * BuildSteps + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface BuildSteps { + + + /** + * List all the build steps for a given build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all the build steps for a given build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStepList} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStepList} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStepList} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, registryName: string, buildTaskName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, registryName: string, buildTaskName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStep} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStep} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, callback: ServiceCallback): void; + create(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStep} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBuildArgumentsWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildArgumentList} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildArgumentList} [result] - The deserialized result object if an error did not occur. + * See {@link BuildArgumentList} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBuildArguments(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuildArguments(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, callback: ServiceCallback): void; + listBuildArguments(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a build step for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepCreateParameters The parameters for creating a + * build step. + * + * @param {object} [buildStepCreateParameters.properties] The properties of a + * build step. + * + * @param {string} buildStepCreateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStep} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepCreateParameters: models.BuildStep, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a build step from the build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a build step in a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {string} stepName The name of a build step for a container registry + * build task. + * + * @param {object} buildStepUpdateParameters The parameters for updating a + * build step. + * + * @param {object} [buildStepUpdateParameters.properties] The properties for + * updating a build step. + * + * @param {string} buildStepUpdateParameters.properties.type Polymorphic + * Discriminator + * + * @param {object} [buildStepUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStep} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStep} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStep} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, registryName: string, buildTaskName: string, stepName: string, buildStepUpdateParameters: models.BuildStepUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List all the build steps for a given build task. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all the build steps for a given build task. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildStepList} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildStepList} [result] - The deserialized result object if an error did not occur. + * See {@link BuildStepList} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBuildArgumentsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the build arguments for a step including the secret arguments. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildArgumentList} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildArgumentList} [result] - The deserialized result object if an error did not occur. + * See {@link BuildArgumentList} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBuildArgumentsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuildArgumentsNext(nextPageLink: string, callback: ServiceCallback): void; + listBuildArgumentsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * BuildTasks + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerRegistryManagementClient. + */ +export interface BuildTasks { + + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The build task filter to apply on the + * operation. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * build tasks, which provides the next page in the list of tasks. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, registryName: string, options?: { filter? : string, skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The build task filter to apply on the + * operation. + * + * @param {string} [options.skipToken] $skipToken is supported on get list of + * build tasks, which provides the next page in the list of tasks. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTaskListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTaskListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTaskListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, registryName: string, options?: { filter? : string, skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, registryName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, registryName: string, options: { filter? : string, skipToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the properties of a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the properties of a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTask} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, registryName: string, buildTaskName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, registryName: string, buildTaskName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTask} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, callback: ServiceCallback): void; + create(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTask} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the source control properties for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listSourceRepositoryPropertiesWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the source control properties for a build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SourceRepositoryProperties} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SourceRepositoryProperties} [result] - The deserialized result object if an error did not occur. + * See {@link SourceRepositoryProperties} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listSourceRepositoryProperties(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listSourceRepositoryProperties(resourceGroupName: string, registryName: string, buildTaskName: string, callback: ServiceCallback): void; + listSourceRepositoryProperties(resourceGroupName: string, registryName: string, buildTaskName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a build task for a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskCreateParameters The parameters for creating a + * build task. + * + * @param {string} buildTaskCreateParameters.alias The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskCreateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} buildTaskCreateParameters.sourceRepository The properties + * that describes the source(code) for the build task. + * + * @param {string} buildTaskCreateParameters.sourceRepository.sourceControlType + * The type of source control service. Possible values include: 'Github', + * 'VisualStudioTeamService' + * + * @param {string} buildTaskCreateParameters.sourceRepository.repositoryUrl The + * full URL to the source code respository + * + * @param {boolean} + * [buildTaskCreateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskCreateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {object} buildTaskCreateParameters.platform The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskCreateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskCreateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskCreateParameters.timeout] Build timeout in + * seconds. + * + * @param {string} buildTaskCreateParameters.location The location of the + * resource. This cannot be changed after the resource is created. + * + * @param {object} [buildTaskCreateParameters.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTask} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskCreateParameters: models.BuildTask, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a specified build task. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, registryName: string, buildTaskName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a build task with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {string} buildTaskName The name of the container registry build task. + * + * @param {object} buildTaskUpdateParameters The parameters for updating a + * build task. + * + * @param {string} [buildTaskUpdateParameters.alias] The alternative updatable + * name for a build task. + * + * @param {string} [buildTaskUpdateParameters.status] The current status of + * build task. Possible values include: 'Disabled', 'Enabled' + * + * @param {object} [buildTaskUpdateParameters.platform] The platform properties + * against which the build has to happen. + * + * @param {string} buildTaskUpdateParameters.platform.osType The operating + * system type required for the build. Possible values include: 'Windows', + * 'Linux' + * + * @param {number} [buildTaskUpdateParameters.platform.cpu] The CPU + * configuration in terms of number of cores required for the build. + * + * @param {number} [buildTaskUpdateParameters.timeout] Build timeout in + * seconds. + * + * @param {object} [buildTaskUpdateParameters.sourceRepository] The properties + * that describes the source(code) for the build task. + * + * @param {object} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties] The + * authorization properties for accessing the source code repository. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.tokenType] + * The type of Auth token. Possible values include: 'PAT', 'OAuth' + * + * @param {string} + * buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.token + * The access token used to access the source control provider. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.refreshToken] + * The refresh token used to refresh the access token. + * + * @param {string} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.scope] + * The scope of the access token. + * + * @param {number} + * [buildTaskUpdateParameters.sourceRepository.sourceControlAuthProperties.expiresIn] + * Time in seconds that the token remains valid + * + * @param {boolean} + * [buildTaskUpdateParameters.sourceRepository.isCommitTriggerEnabled] The + * value of this property indicates whether the source control commit trigger + * is enabled or not. + * + * @param {object} [buildTaskUpdateParameters.tags] The ARM resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTask} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTask} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTask} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, registryName: string, buildTaskName: string, buildTaskUpdateParameters: models.BuildTaskUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the build tasks for a specified container registry. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {BuildTaskListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BuildTaskListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BuildTaskListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/containerRegistryManagement/lib/operations/index.js b/lib/services/containerRegistryManagement/lib/operations/index.js index edfcba24be..05a68dfdad 100644 --- a/lib/services/containerRegistryManagement/lib/operations/index.js +++ b/lib/services/containerRegistryManagement/lib/operations/index.js @@ -18,3 +18,6 @@ exports.Registries = require('./registries'); exports.Operations = require('./operations'); exports.Replications = require('./replications'); exports.Webhooks = require('./webhooks'); +exports.Builds = require('./builds'); +exports.BuildSteps = require('./buildSteps'); +exports.BuildTasks = require('./buildTasks'); diff --git a/lib/services/containerRegistryManagement/lib/operations/operations.js b/lib/services/containerRegistryManagement/lib/operations/operations.js index d30dc5e140..d7ad3350a3 100644 --- a/lib/services/containerRegistryManagement/lib/operations/operations.js +++ b/lib/services/containerRegistryManagement/lib/operations/operations.js @@ -45,11 +45,9 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -61,7 +59,7 @@ function _list(options, callback) { let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.ContainerRegistry/operations'; let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/containerRegistryManagement/lib/operations/registries.js b/lib/services/containerRegistryManagement/lib/operations/registries.js index 221d6a2d4b..8ba49758c9 100644 --- a/lib/services/containerRegistryManagement/lib/operations/registries.js +++ b/lib/services/containerRegistryManagement/lib/operations/registries.js @@ -14,6 +14,99 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; + +/** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _importImage(resourceGroupName, registryName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginImportImage(resourceGroupName, registryName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + /** * Checks whether the container registry name is available for use. The name * must contain only alphanumeric characters, be globally unique, and between 5 @@ -53,15 +146,13 @@ function _checkNameAvailability(registryNameCheckRequest, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; if (registryNameCheckRequest === null || registryNameCheckRequest === undefined) { registryNameCheckRequest = {}; } // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -80,7 +171,7 @@ function _checkNameAvailability(registryNameCheckRequest, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -212,11 +303,9 @@ function _get(resourceGroupName, registryName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -254,7 +343,7 @@ function _get(resourceGroupName, registryName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -638,11 +727,9 @@ function _listByResourceGroup(resourceGroupName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -662,7 +749,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -775,11 +862,9 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -795,7 +880,7 @@ function _list(options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -914,11 +999,9 @@ function _listCredentials(resourceGroupName, registryName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -956,7 +1039,7 @@ function _listCredentials(resourceGroupName, registryName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1083,11 +1166,9 @@ function _regenerateCredential(resourceGroupName, registryName, regenerateCreden if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1128,7 +1209,7 @@ function _regenerateCredential(resourceGroupName, registryName, regenerateCreden requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1261,11 +1342,9 @@ function _listUsages(resourceGroupName, registryName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1303,7 +1382,7 @@ function _listUsages(resourceGroupName, registryName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1385,35 +1464,97 @@ function _listUsages(resourceGroupName, registryName, options, callback) { }); } + /** - * Creates a container registry with the specified parameters. + * Creates a new build based on the request parameters and add it to the build + * queue. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * - * @param {object} registry The parameters for creating a container registry. + * @param {object} buildRequest The parameters of a build that needs to queued. * - * @param {object} registry.sku The SKU of the container registry. + * @param {string} buildRequest.type Polymorphic Discriminator * - * @param {string} registry.sku.name The SKU name of the container registry. - * Required for registry creation. Possible values include: 'Classic', 'Basic', - * 'Standard', 'Premium' + * @param {object} [options] Optional Parameters. * - * @param {boolean} [registry.adminUserEnabled] The value that indicates - * whether the admin user is enabled. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [registry.storageAccount] The properties of the storage - * account for the container registry. Only applicable to Classic SKU. + * @param {function} callback - The callback. * - * @param {string} registry.storageAccount.id The resource ID of the storage - * account. + * @returns {function} callback(err, result, request, response) * - * @param {string} registry.location The location of the resource. This cannot - * be changed after the resource is created. + * {Error} err - The Error object if an error occurred, null otherwise. * - * @param {object} [registry.tags] The tags of the resource. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _queueBuild(resourceGroupName, registryName, buildRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginQueueBuild(resourceGroupName, registryName, buildRequest, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Build']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Get the upload location for the user to be able to upload the source. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. * * @param {object} [options] Optional Parameters. * @@ -1427,13 +1568,14 @@ function _listUsages(resourceGroupName, registryName, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Registry} for more information. + * See {@link SourceUploadDefinition} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreate(resourceGroupName, registryName, registry, options, callback) { +function _getBuildSourceUploadUrl(resourceGroupName, registryName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1443,11 +1585,9 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-02-01-preview'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1471,9 +1611,6 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); } } - if (registry === null || registry === undefined) { - throw new Error('registry cannot be null or undefined.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -1483,19 +1620,19 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1513,28 +1650,14 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (registry !== null && registry !== undefined) { - let requestModelMapper = new client.models['Registry']().mapper(); - requestModel = client.serialize(requestModelMapper, registry, 'registry'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(registry, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1569,7 +1692,7 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Registry']().mapper(); + let resultMapper = new client.models['SourceUploadDefinition']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1579,36 +1702,48 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba return callback(deserializationError); } } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Registry']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); } /** - * Deletes a container registry. + * Copies an image to this container registry from the specified container + * registry. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1626,7 +1761,7 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginDeleteMethod(resourceGroupName, registryName, options, callback) { +function _beginImportImage(resourceGroupName, registryName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1636,11 +1771,9 @@ function _beginDeleteMethod(resourceGroupName, registryName, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1664,6 +1797,9 @@ function _beginDeleteMethod(resourceGroupName, registryName, options, callback) throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); } } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -1673,19 +1809,19 @@ function _beginDeleteMethod(resourceGroupName, registryName, options, callback) // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1703,14 +1839,28 @@ function _beginDeleteMethod(resourceGroupName, registryName, options, callback) } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ImportImageParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1744,30 +1894,384 @@ function _beginDeleteMethod(resourceGroupName, registryName, options, callback) } /** - * Updates a container registry with the specified parameters. + * Creates a container registry with the specified parameters. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * - * @param {object} registryUpdateParameters The parameters for updating a - * container registry. + * @param {object} registry The parameters for creating a container registry. * - * @param {object} [registryUpdateParameters.tags] The tags for the container - * registry. + * @param {object} registry.sku The SKU of the container registry. * - * @param {object} [registryUpdateParameters.sku] The SKU of the container - * registry. + * @param {string} registry.sku.name The SKU name of the container registry. + * Required for registry creation. Possible values include: 'Classic', 'Basic', + * 'Standard', 'Premium' * - * @param {string} registryUpdateParameters.sku.name The SKU name of the - * container registry. Required for registry creation. Possible values include: - * 'Classic', 'Basic', 'Standard', 'Premium' + * @param {boolean} [registry.adminUserEnabled] The value that indicates + * whether the admin user is enabled. * - * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that - * indicates whether the admin user is enabled. + * @param {object} [registry.storageAccount] The properties of the storage + * account for the container registry. Only applicable to Classic SKU. * - * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * @param {string} registry.storageAccount.id The resource ID of the storage + * account. + * + * @param {string} registry.location The location of the resource. This cannot + * be changed after the resource is created. + * + * @param {object} [registry.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, registryName, registry, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (registry === null || registry === undefined) { + throw new Error('registry cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (registry !== null && registry !== undefined) { + let requestModelMapper = new client.models['Registry']().mapper(); + requestModel = client.serialize(requestModelMapper, registry, 'registry'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(registry, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Registry']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, registryName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a container registry with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} registryUpdateParameters The parameters for updating a + * container registry. + * + * @param {object} [registryUpdateParameters.tags] The tags for the container + * registry. + * + * @param {object} [registryUpdateParameters.sku] The SKU of the container + * registry. + * + * @param {string} registryUpdateParameters.sku.name The SKU name of the + * container registry. Required for registry creation. Possible values include: + * 'Classic', 'Basic', 'Standard', 'Premium' + * + * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that + * indicates whether the admin user is enabled. + * + * @param {object} [registryUpdateParameters.storageAccount] The parameters of * a storage account for the container registry. Only applicable to Classic * SKU. If specified, the storage account must be in the same physical location * as the container registry. @@ -1803,11 +2307,9 @@ function _beginUpdate(resourceGroupName, registryName, registryUpdateParameters, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1848,7 +2350,7 @@ function _beginUpdate(resourceGroupName, registryName, registryUpdateParameters, requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1961,6 +2463,186 @@ function _beginUpdate(resourceGroupName, registryName, registryUpdateParameters, }); } +/** + * Creates a new build based on the request parameters and add it to the build + * queue. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginQueueBuild(resourceGroupName, registryName, buildRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-02-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (registryName === null || registryName === undefined || typeof registryName.valueOf() !== 'string') { + throw new Error('registryName cannot be null or undefined and it must be of type string.'); + } + if (registryName !== null && registryName !== undefined) { + if (registryName.length > 50) + { + throw new Error('"registryName" should satisfy the constraint - "MaxLength": 50'); + } + if (registryName.length < 5) + { + throw new Error('"registryName" should satisfy the constraint - "MinLength": 5'); + } + if (registryName.match(/^[a-zA-Z0-9]*$/) === null) + { + throw new Error('"registryName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]*$/'); + } + } + if (buildRequest === null || buildRequest === undefined) { + throw new Error('buildRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (buildRequest !== null && buildRequest !== undefined) { + let requestModelMapper = new client.models['QueueBuildRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, buildRequest, 'buildRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(buildRequest, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Build']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Lists all the container registries under the specified resource group. * @@ -2223,6 +2905,7 @@ class Registries { */ constructor(client) { this.client = client; + this._importImage = _importImage; this._checkNameAvailability = _checkNameAvailability; this._get = _get; this._create = _create; @@ -2233,13 +2916,162 @@ class Registries { this._listCredentials = _listCredentials; this._regenerateCredential = _regenerateCredential; this._listUsages = _listUsages; + this._queueBuild = _queueBuild; + this._getBuildSourceUploadUrl = _getBuildSourceUploadUrl; + this._beginImportImage = _beginImportImage; this._beginCreate = _beginCreate; this._beginDeleteMethod = _beginDeleteMethod; this._beginUpdate = _beginUpdate; + this._beginQueueBuild = _beginQueueBuild; this._listByResourceGroupNext = _listByResourceGroupNext; this._listNext = _listNext; } + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + importImageWithHttpOperationResponse(resourceGroupName, registryName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._importImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Copies an image to this container registry from the specified container + * registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + importImage(resourceGroupName, registryName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._importImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._importImage(resourceGroupName, registryName, parameters, options, optionalCallback); + } + } + /** * Checks whether the container registry name is available for use. The name * must contain only alphanumeric characters, be globally unique, and between 5 @@ -2722,13 +3554,263 @@ class Registries { * @param {boolean} [registryUpdateParameters.adminUserEnabled] The value that * indicates whether the admin user is enabled. * - * @param {object} [registryUpdateParameters.storageAccount] The parameters of - * a storage account for the container registry. Only applicable to Classic - * SKU. If specified, the storage account must be in the same physical location - * as the container registry. + * @param {object} [registryUpdateParameters.storageAccount] The parameters of + * a storage account for the container registry. Only applicable to Classic + * SKU. If specified, the storage account must be in the same physical location + * as the container registry. + * + * @param {string} registryUpdateParameters.storageAccount.id The resource ID + * of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Registry} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Registry} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, registryName, registryUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback); + } + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegistryListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegistryListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listCredentialsWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listCredentials(resourceGroupName, registryName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. * - * @param {string} registryUpdateParameters.storageAccount.id The resource ID - * of the storage account. + * @param {string} registryName The name of the container registry. * * @param {object} [options] Optional Parameters. * @@ -2742,7 +3824,7 @@ class Registries { * * {Promise} A promise is returned * - * @resolve {Registry} - The deserialized result object. + * @resolve {RegistryListCredentialsResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2751,13 +3833,14 @@ class Registries { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Registry} for more information. + * See {@link RegistryListCredentialsResult} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback) { + listCredentials(resourceGroupName, registryName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2766,23 +3849,33 @@ class Registries { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._update(resourceGroupName, registryName, registryUpdateParameters, options, (err, result, request, response) => { + self._listCredentials(resourceGroupName, registryName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._update(resourceGroupName, registryName, registryUpdateParameters, options, optionalCallback); + return self._listCredentials(resourceGroupName, registryName, options, optionalCallback); } } /** - * Lists all the container registries under the specified resource group. + * Regenerates one of the login credentials for the specified container + * registry. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2790,15 +3883,15 @@ class Registries { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + regenerateCredentialWithHttpOperationResponse(resourceGroupName, registryName, regenerateCredentialParameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2809,11 +3902,21 @@ class Registries { } /** - * Lists all the container registries under the specified resource group. + * Regenerates one of the login credentials for the specified container + * registry. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * + * @param {string} registryName The name of the container registry. + * + * @param {object} regenerateCredentialParameters Specifies name of the + * password which should be regenerated -- password or password2. + * + * @param {string} regenerateCredentialParameters.name Specifies name of the + * password which should be regenerated -- password or password2. Possible + * values include: 'password', 'password2' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2826,7 +3929,7 @@ class Registries { * * {Promise} A promise is returned * - * @resolve {RegistryListResult} - The deserialized result object. + * @resolve {RegistryListCredentialsResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2835,13 +3938,14 @@ class Registries { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link RegistryListResult} for more information. + * See {@link RegistryListCredentialsResult} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName, options, optionalCallback) { + regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2850,19 +3954,24 @@ class Registries { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + return self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, optionalCallback); } } /** - * Lists all the container registries under the specified subscription. + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. * * @param {object} [options] Optional Parameters. * @@ -2871,15 +3980,15 @@ class Registries { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listWithHttpOperationResponse(options) { + listUsagesWithHttpOperationResponse(resourceGroupName, registryName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._listUsages(resourceGroupName, registryName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2890,7 +3999,12 @@ class Registries { } /** - * Lists all the container registries under the specified subscription. + * Gets the quota usages for the specified container registry. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. * * @param {object} [options] Optional Parameters. * @@ -2904,7 +4018,7 @@ class Registries { * * {Promise} A promise is returned * - * @resolve {RegistryListResult} - The deserialized result object. + * @resolve {RegistryUsageListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2913,13 +4027,14 @@ class Registries { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link RegistryListResult} for more information. + * See {@link RegistryUsageListResult} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - list(options, optionalCallback) { + listUsages(resourceGroupName, registryName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2928,25 +4043,30 @@ class Registries { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._listUsages(resourceGroupName, registryName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(options, optionalCallback); + return self._listUsages(resourceGroupName, registryName, options, optionalCallback); } } /** - * Lists the login credentials for the specified container registry. + * Creates a new build based on the request parameters and add it to the build + * queue. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2954,15 +4074,15 @@ class Registries { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listCredentialsWithHttpOperationResponse(resourceGroupName, registryName, options) { + queueBuildWithHttpOperationResponse(resourceGroupName, registryName, buildRequest, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listCredentials(resourceGroupName, registryName, options, (err, result, request, response) => { + self._queueBuild(resourceGroupName, registryName, buildRequest, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2973,13 +4093,18 @@ class Registries { } /** - * Lists the login credentials for the specified container registry. + * Creates a new build based on the request parameters and add it to the build + * queue. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2992,7 +4117,7 @@ class Registries { * * {Promise} A promise is returned * - * @resolve {RegistryListCredentialsResult} - The deserialized result object. + * @resolve {Build} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3001,14 +4126,13 @@ class Registries { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link RegistryListCredentialsResult} for more - * information. + * See {@link Build} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listCredentials(resourceGroupName, registryName, options, optionalCallback) { + queueBuild(resourceGroupName, registryName, buildRequest, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3017,33 +4141,25 @@ class Registries { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listCredentials(resourceGroupName, registryName, options, (err, result, request, response) => { + self._queueBuild(resourceGroupName, registryName, buildRequest, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listCredentials(resourceGroupName, registryName, options, optionalCallback); + return self._queueBuild(resourceGroupName, registryName, buildRequest, options, optionalCallback); } } /** - * Regenerates one of the login credentials for the specified container - * registry. + * Get the upload location for the user to be able to upload the source. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * - * @param {object} regenerateCredentialParameters Specifies name of the - * password which should be regenerated -- password or password2. - * - * @param {string} regenerateCredentialParameters.name Specifies name of the - * password which should be regenerated -- password or password2. Possible - * values include: 'password', 'password2' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3051,15 +4167,15 @@ class Registries { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - regenerateCredentialWithHttpOperationResponse(resourceGroupName, registryName, regenerateCredentialParameters, options) { + getBuildSourceUploadUrlWithHttpOperationResponse(resourceGroupName, registryName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, (err, result, request, response) => { + self._getBuildSourceUploadUrl(resourceGroupName, registryName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3070,21 +4186,13 @@ class Registries { } /** - * Regenerates one of the login credentials for the specified container - * registry. + * Get the upload location for the user to be able to upload the source. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * - * @param {object} regenerateCredentialParameters Specifies name of the - * password which should be regenerated -- password or password2. - * - * @param {string} regenerateCredentialParameters.name Specifies name of the - * password which should be regenerated -- password or password2. Possible - * values include: 'password', 'password2' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3097,7 +4205,7 @@ class Registries { * * {Promise} A promise is returned * - * @resolve {RegistryListCredentialsResult} - The deserialized result object. + * @resolve {SourceUploadDefinition} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3106,14 +4214,14 @@ class Registries { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link RegistryListCredentialsResult} for more + * See {@link SourceUploadDefinition} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, optionalCallback) { + getBuildSourceUploadUrl(resourceGroupName, registryName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3122,25 +4230,54 @@ class Registries { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, (err, result, request, response) => { + self._getBuildSourceUploadUrl(resourceGroupName, registryName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._regenerateCredential(resourceGroupName, registryName, regenerateCredentialParameters, options, optionalCallback); + return self._getBuildSourceUploadUrl(resourceGroupName, registryName, options, optionalCallback); } } /** - * Gets the quota usages for the specified container registry. + * Copies an image to this container registry from the specified container + * registry. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3148,15 +4285,15 @@ class Registries { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listUsagesWithHttpOperationResponse(resourceGroupName, registryName, options) { + beginImportImageWithHttpOperationResponse(resourceGroupName, registryName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listUsages(resourceGroupName, registryName, options, (err, result, request, response) => { + self._beginImportImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3167,13 +4304,42 @@ class Registries { } /** - * Gets the quota usages for the specified container registry. + * Copies an image to this container registry from the specified container + * registry. * * @param {string} resourceGroupName The name of the resource group to which * the container registry belongs. * * @param {string} registryName The name of the container registry. * + * @param {object} parameters The parameters specifying the image to copy and + * the source container registry. + * + * @param {object} parameters.source The source of the image. + * + * @param {string} parameters.source.resourceId The resource identifier of the + * target Azure Container Registry. + * + * @param {string} parameters.source.sourceImage Repository name of the source + * image. + * Specify an image by repository ('hello-world'). This will use the 'latest' + * tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + * + * @param {array} [parameters.targetTags] List of strings of the form + * repo[:tag]. When tag is omitted the source will be used (or 'latest' if + * source tag is also omitted). + * + * @param {array} [parameters.untaggedTargetRepositories] List of strings of + * repository names to do a manifest only copy. No tag will be created. + * + * @param {string} [parameters.mode] When Force, any existing target tags will + * be overwritten. When NoForce, any existing target tags will fail the + * operation before any copying begins. Possible values include: 'NoForce', + * 'Force' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3186,7 +4352,7 @@ class Registries { * * {Promise} A promise is returned * - * @resolve {RegistryUsageListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3194,15 +4360,13 @@ class Registries { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link RegistryUsageListResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listUsages(resourceGroupName, registryName, options, optionalCallback) { + beginImportImage(resourceGroupName, registryName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3211,14 +4375,14 @@ class Registries { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listUsages(resourceGroupName, registryName, options, (err, result, request, response) => { + self._beginImportImage(resourceGroupName, registryName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listUsages(resourceGroupName, registryName, options, optionalCallback); + return self._beginImportImage(resourceGroupName, registryName, parameters, options, optionalCallback); } } @@ -3577,6 +4741,104 @@ class Registries { } } + /** + * Creates a new build based on the request parameters and add it to the build + * queue. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginQueueBuildWithHttpOperationResponse(resourceGroupName, registryName, buildRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginQueueBuild(resourceGroupName, registryName, buildRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new build based on the request parameters and add it to the build + * queue. + * + * @param {string} resourceGroupName The name of the resource group to which + * the container registry belongs. + * + * @param {string} registryName The name of the container registry. + * + * @param {object} buildRequest The parameters of a build that needs to queued. + * + * @param {string} buildRequest.type Polymorphic Discriminator + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Build} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Build} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginQueueBuild(resourceGroupName, registryName, buildRequest, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginQueueBuild(resourceGroupName, registryName, buildRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginQueueBuild(resourceGroupName, registryName, buildRequest, options, optionalCallback); + } + } + /** * Lists all the container registries under the specified resource group. * diff --git a/lib/services/containerRegistryManagement/lib/operations/replications.js b/lib/services/containerRegistryManagement/lib/operations/replications.js index 9d31caad2e..691f1b4b09 100644 --- a/lib/services/containerRegistryManagement/lib/operations/replications.js +++ b/lib/services/containerRegistryManagement/lib/operations/replications.js @@ -52,11 +52,9 @@ function _get(resourceGroupName, registryName, replicationName, options, callbac if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -112,7 +110,7 @@ function _get(resourceGroupName, registryName, replicationName, options, callbac requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -473,11 +471,9 @@ function _list(resourceGroupName, registryName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -515,7 +511,7 @@ function _list(resourceGroupName, registryName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -643,11 +639,9 @@ function _beginCreate(resourceGroupName, registryName, replicationName, replicat if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -706,7 +700,7 @@ function _beginCreate(resourceGroupName, registryName, replicationName, replicat requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -856,11 +850,9 @@ function _beginDeleteMethod(resourceGroupName, registryName, replicationName, op if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -916,7 +908,7 @@ function _beginDeleteMethod(resourceGroupName, registryName, replicationName, op requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1026,11 +1018,9 @@ function _beginUpdate(resourceGroupName, registryName, replicationName, replicat if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1089,7 +1079,7 @@ function _beginUpdate(resourceGroupName, registryName, replicationName, replicat requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{replicationName}', encodeURIComponent(replicationName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/containerRegistryManagement/lib/operations/webhooks.js b/lib/services/containerRegistryManagement/lib/operations/webhooks.js index 6c9816e657..1def15c336 100644 --- a/lib/services/containerRegistryManagement/lib/operations/webhooks.js +++ b/lib/services/containerRegistryManagement/lib/operations/webhooks.js @@ -52,11 +52,9 @@ function _get(resourceGroupName, registryName, webhookName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -112,7 +110,7 @@ function _get(resourceGroupName, registryName, webhookName, options, callback) { requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -507,11 +505,9 @@ function _list(resourceGroupName, registryName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -549,7 +545,7 @@ function _list(resourceGroupName, registryName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -669,11 +665,9 @@ function _ping(resourceGroupName, registryName, webhookName, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -729,7 +723,7 @@ function _ping(resourceGroupName, registryName, webhookName, options, callback) requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -849,11 +843,9 @@ function _getCallbackConfig(resourceGroupName, registryName, webhookName, option if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -909,7 +901,7 @@ function _getCallbackConfig(resourceGroupName, registryName, webhookName, option requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1029,11 +1021,9 @@ function _listEvents(resourceGroupName, registryName, webhookName, options, call if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1089,7 +1079,7 @@ function _listEvents(resourceGroupName, registryName, webhookName, options, call requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1235,11 +1225,9 @@ function _beginCreate(resourceGroupName, registryName, webhookName, webhookCreat if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1298,7 +1286,7 @@ function _beginCreate(resourceGroupName, registryName, webhookName, webhookCreat requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1448,11 +1436,9 @@ function _beginDeleteMethod(resourceGroupName, registryName, webhookName, option if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1508,7 +1494,7 @@ function _beginDeleteMethod(resourceGroupName, registryName, webhookName, option requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1634,11 +1620,9 @@ function _beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdat if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2017-10-01'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1697,7 +1681,7 @@ function _beginUpdate(resourceGroupName, registryName, webhookName, webhookUpdat requestUrl = requestUrl.replace('{registryName}', encodeURIComponent(registryName)); requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/containerRegistryManagement/lib/package.json b/lib/services/containerRegistryManagement/lib/package.json new file mode 100644 index 0000000000..4f388855a5 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-containerregistry", + "author": "Microsoft Corporation", + "description": "ContainerRegistryManagementClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.2", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/containerRegistryManagementClient.js", + "types": "./lib/containerRegistryManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +} diff --git a/lib/services/containerRegistryManagement/package.json b/lib/services/containerRegistryManagement/package.json index 944058e3ac..49e9835241 100644 --- a/lib/services/containerRegistryManagement/package.json +++ b/lib/services/containerRegistryManagement/package.json @@ -1,36 +1,25 @@ { "name": "azure-arm-containerregistry", "author": "Microsoft Corporation", - "contributors": [ - "Antony, Sajay ", - "You, Dongjiang " - ], - "version": "2.1.0-preview", - "description": "Microsoft Azure Container Registry Management Client Library for Node", - "tags": [ - "azure", - "sdk" - ], + "description": "ContainerRegistryManagementClient Library with typescript type definitions for node", + "version": "2.3.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, "keywords": [ "node", "azure" ], + "license": "MIT", "main": "./lib/containerRegistryManagementClient.js", "types": "./lib/containerRegistryManagementClient.d.ts", - "license": "MIT", - "dependencies": { - "ms-rest": "^2.3.0", - "ms-rest-azure": "^2.5.2" - }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", + "homepage": "http://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", - "url": "git@github.com:Azure/azure-sdk-for-node.git" + "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { "url": "http://github.com/Azure/azure-sdk-for-node/issues" - }, - "scripts": { - "test": "npm -s run-script jshint" } -} \ No newline at end of file +}