diff --git a/lib/services/containerRegistryManagement/README.md b/lib/services/containerRegistryManagement/README.md index a9f17bfdfd..b977d48fb7 100644 --- a/lib/services/containerRegistryManagement/README.md +++ b/lib/services/containerRegistryManagement/README.md @@ -1,3 +1,8 @@ +--- +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** @@ -28,7 +33,7 @@ msRestAzure.interactiveLogin().then((creds) => { console.log(result); }); }).catch((err) => { - console.log('An error ocurred:'); + console.log('An error occurred:'); console.dir(err, {depth: null, colors: true}); }); diff --git a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts index eb0fa12553..0bc7fd95cf 100644 --- a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts +++ b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.d.ts @@ -47,8 +47,6 @@ export default class ContainerRegistryManagementClient extends AzureServiceClien subscriptionId: string; - apiVersion: string; - acceptLanguage: string; longRunningOperationRetryTimeout: number; @@ -60,6 +58,9 @@ export default class ContainerRegistryManagementClient extends AzureServiceClien operations: operations.Operations; replications: operations.Replications; webhooks: operations.Webhooks; + builds: operations.Builds; + buildSteps: operations.BuildSteps; + buildTasks: operations.BuildTasks; } export { ContainerRegistryManagementClient, models as ContainerRegistryManagementModels }; diff --git a/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.js b/lib/services/containerRegistryManagement/lib/containerRegistryManagementClient.js index 000a4dd96c..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); } 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..d83fb0d542 --- /dev/null +++ b/lib/services/containerRegistryManagement/lib/models/buildFilter.js @@ -0,0 +1,121 @@ +/* + * 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 {array} [outputImageNames] The list of all images 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' + } + }, + outputImageNames: { + required: false, + serializedName: 'outputImageNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + 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/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/index.d.ts b/lib/services/containerRegistryManagement/lib/models/index.d.ts index 270349182e..e543dcf11c 100644 --- a/lib/services/containerRegistryManagement/lib/models/index.d.ts +++ b/lib/services/containerRegistryManagement/lib/models/index.d.ts @@ -800,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 {array} [outputImageNames] The list of all images 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; + outputImageNames?: 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 @@ -865,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 937ec8aaeb..cb2d81152f 100644 --- a/lib/services/containerRegistryManagement/lib/models/index.js +++ b/lib/services/containerRegistryManagement/lib/models/index.js @@ -50,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 95aa82caef..e1d57a4040 100644 --- a/lib/services/containerRegistryManagement/lib/operations/index.d.ts +++ b/lib/services/containerRegistryManagement/lib/operations/index.d.ts @@ -851,6 +851,139 @@ 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. @@ -1243,6 +1376,77 @@ export interface Registries { beginUpdate(resourceGroupName: string, registryName: string, registryUpdateParameters: models.RegistryUpdateParameters, 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. + */ + 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. * @@ -3141,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 22b63fb9fe..8ba49758c9 100644 --- a/lib/services/containerRegistryManagement/lib/operations/registries.js +++ b/lib/services/containerRegistryManagement/lib/operations/registries.js @@ -146,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.'); } @@ -173,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('&'); } @@ -305,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.'); } @@ -347,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('&'); } @@ -731,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.'); } @@ -755,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('&'); } @@ -868,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.'); } @@ -888,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('&'); } @@ -1007,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.'); } @@ -1049,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('&'); } @@ -1176,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.'); } @@ -1221,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('&'); } @@ -1354,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.'); } @@ -1396,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('&'); } @@ -1478,6 +1464,249 @@ function _listUsages(resourceGroupName, registryName, options, callback) { }); } + +/** + * 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 _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. + * + * @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 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 _getBuildSourceUploadUrl(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 = '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 (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}/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(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['SourceUploadDefinition']().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. @@ -1542,11 +1771,9 @@ function _beginImportImage(resourceGroupName, registryName, parameters, options, 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.'); } @@ -1587,7 +1814,7 @@ function _beginImportImage(resourceGroupName, registryName, parameters, options, 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('&'); } @@ -1724,11 +1951,9 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba 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.'); } @@ -1769,7 +1994,7 @@ function _beginCreate(resourceGroupName, registryName, registry, options, callba 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('&'); } @@ -1917,11 +2142,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.'); } @@ -1959,7 +2182,7 @@ function _beginDeleteMethod(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('&'); } @@ -2084,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.'); } @@ -2129,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('&'); } @@ -2243,10 +2464,17 @@ function _beginUpdate(resourceGroupName, registryName, registryUpdateParameters, } /** - * 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. * @@ -2260,13 +2488,13 @@ function _beginUpdate(resourceGroupName, registryName, registryUpdateParameters, * {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 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 _listByResourceGroupNext(nextPageLink, options, callback) { +function _beginQueueBuild(resourceGroupName, registryName, buildRequest, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2276,13 +2504,186 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-02-01-preview'; // 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.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.'); + 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. + * + * @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); @@ -2515,10 +2916,13 @@ 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; } @@ -3650,6 +4054,193 @@ 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. + */ + queueBuildWithHttpOperationResponse(resourceGroupName, registryName, buildRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._queueBuild(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. + */ + queueBuild(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._queueBuild(resourceGroupName, registryName, buildRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._queueBuild(resourceGroupName, registryName, buildRequest, options, optionalCallback); + } + } + + /** + * 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} - The error object. + */ + getBuildSourceUploadUrlWithHttpOperationResponse(resourceGroupName, registryName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getBuildSourceUploadUrl(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; + }); + }); + } + + /** + * 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 {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 {SourceUploadDefinition} - 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 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. + */ + getBuildSourceUploadUrl(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._getBuildSourceUploadUrl(resourceGroupName, registryName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getBuildSourceUploadUrl(resourceGroupName, registryName, options, optionalCallback); + } + } + /** * Copies an image to this container registry from the specified container * registry. @@ -4150,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/package.json b/lib/services/containerRegistryManagement/package.json index a3ea222ecc..49e9835241 100644 --- a/lib/services/containerRegistryManagement/package.json +++ b/lib/services/containerRegistryManagement/package.json @@ -2,12 +2,15 @@ "name": "azure-arm-containerregistry", "author": "Microsoft Corporation", "description": "ContainerRegistryManagementClient Library with typescript type definitions for node", - "version": "2.1.0-preview", + "version": "2.3.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/containerRegistryManagementClient.js", "types": "./lib/containerRegistryManagementClient.d.ts",