Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR containerregistry/resource-manager] add option to import images from public registries #3323

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export default class ContainerRegistryManagementClient extends AzureServiceClien
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {string} [options.acceptLanguage] - The preferred language for the response.
*
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
* @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
*/
constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class ContainerRegistryManagementClient extends ServiceClient {
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
* @param {string} [options.acceptLanguage] - The preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
constructor(credentials, subscriptionId, baseUri, options) {
if (credentials === null || credentials === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ class ImportImageParameters {
/**
* Create a ImportImageParameters.
* @member {object} source The source of the image.
* @member {string} [source.resourceId] The resource identifier of the target
* @member {string} [source.resourceId] The resource identifier of the source
* Azure Container Registry.
* @member {string} [source.registryUri] The address of the source registry.
* @member {string} [source.sourceImage] Repository name of the source image.
* Specify an image by repository ('hello-world'). This will use the 'latest'
* tag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
class ImportSource {
/**
* Create a ImportSource.
* @member {string} resourceId The resource identifier of the target Azure
* @member {string} [resourceId] The resource identifier of the source Azure
* Container Registry.
* @member {string} [registryUri] The address of the source registry.
* @member {string} sourceImage Repository name of the source image.
* Specify an image by repository ('hello-world'). This will use the 'latest'
* tag.
Expand All @@ -43,12 +44,19 @@ class ImportSource {
className: 'ImportSource',
modelProperties: {
resourceId: {
required: true,
required: false,
serializedName: 'resourceId',
type: {
name: 'String'
}
},
registryUri: {
required: false,
serializedName: 'registryUri',
type: {
name: 'String'
}
},
sourceImage: {
required: true,
serializedName: 'sourceImage',
Expand Down
103 changes: 100 additions & 3 deletions lib/services/containerRegistryManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export { CloudError } from 'ms-rest-azure';
* @class
* Initializes a new instance of the ImportSource class.
* @constructor
* @member {string} resourceId The resource identifier of the target Azure
* @member {string} [resourceId] The resource identifier of the source Azure
* Container Registry.
* @member {string} [registryUri] The address of the source registry.
* @member {string} sourceImage Repository name of the source image.
* Specify an image by repository ('hello-world'). This will use the 'latest'
* tag.
Expand All @@ -30,7 +31,8 @@ export { CloudError } from 'ms-rest-azure';
* ('hello-world@sha256:abc123').
*/
export interface ImportSource {
resourceId: string;
resourceId?: string;
registryUri?: string;
sourceImage: string;
}

Expand All @@ -39,8 +41,9 @@ export interface ImportSource {
* Initializes a new instance of the ImportImageParameters class.
* @constructor
* @member {object} source The source of the image.
* @member {string} [source.resourceId] The resource identifier of the target
* @member {string} [source.resourceId] The resource identifier of the source
* Azure Container Registry.
* @member {string} [source.registryUri] The address of the source registry.
* @member {string} [source.sourceImage] Repository name of the source image.
* Specify an image by repository ('hello-world'). This will use the 'latest'
* tag.
Expand Down Expand Up @@ -115,12 +118,49 @@ export interface OperationDisplayDefinition {
description?: string;
}

/**
* @class
* Initializes a new instance of the OperationMetricSpecificationDefinition class.
* @constructor
* The definition of Azure Monitoring metric.
*
* @member {string} [name] Metric name.
* @member {string} [displayName] Metric display name.
* @member {string} [displayDescription] Metric description.
* @member {string} [unit] Metric unit.
* @member {string} [aggregationType] Metric aggregation type.
* @member {string} [internalMetricName] Internal metric name.
*/
export interface OperationMetricSpecificationDefinition {
name?: string;
displayName?: string;
displayDescription?: string;
unit?: string;
aggregationType?: string;
internalMetricName?: string;
}

/**
* @class
* Initializes a new instance of the OperationServiceSpecificationDefinition class.
* @constructor
* The definition of Azure Monitoring metrics list.
*
* @member {array} [metricSpecifications] A list of Azure Monitoring metrics
* definition.
*/
export interface OperationServiceSpecificationDefinition {
metricSpecifications?: OperationMetricSpecificationDefinition[];
}

/**
* @class
* Initializes a new instance of the OperationDefinition class.
* @constructor
* The definition of a container registry operation.
*
* @member {string} [origin] The origin information of the container registry
* operation.
* @member {string} [name] Operation name: {provider}/{resource}/{operation}.
* @member {object} [display] The display information for the container
* registry operation.
Expand All @@ -130,10 +170,16 @@ export interface OperationDisplayDefinition {
* performed.
* @member {string} [display.operation] The operation that users can perform.
* @member {string} [display.description] The description for the operation.
* @member {object} [serviceSpecification] The definition of Azure Monitoring
* service.
* @member {array} [serviceSpecification.metricSpecifications] A list of Azure
* Monitoring metrics definition.
*/
export interface OperationDefinition {
origin?: string;
name?: string;
display?: OperationDisplayDefinition;
serviceSpecification?: OperationServiceSpecificationDefinition;
}

/**
Expand Down Expand Up @@ -349,6 +395,57 @@ export interface RegistryUsageListResult {
value?: RegistryUsage[];
}

/**
* @class
* Initializes a new instance of the QuarantinePolicy class.
* @constructor
* An object that represents quarantine policy for a container registry.
*
* @member {string} [status] The value that indicates whether the policy is
* enabled or not. Possible values include: 'enabled', 'disabled'
*/
export interface QuarantinePolicy {
status?: string;
}

/**
* @class
* Initializes a new instance of the TrustPolicy class.
* @constructor
* An object that represents content trust policy for a container registry.
*
* @member {string} [type] The type of trust policy. Possible values include:
* 'Notary'
* @member {string} [status] The value that indicates whether the policy is
* enabled or not. Possible values include: 'enabled', 'disabled'
*/
export interface TrustPolicy {
type?: string;
status?: string;
}

/**
* @class
* Initializes a new instance of the RegistryPolicies class.
* @constructor
* An object that represents policies for a container registry.
*
* @member {object} [quarantinePolicy] An object that represents quarantine
* policy for a container registry.
* @member {string} [quarantinePolicy.status] The value that indicates whether
* the policy is enabled or not. Possible values include: 'enabled', 'disabled'
* @member {object} [trustPolicy] An object that represents content trust
* policy for a container registry.
* @member {string} [trustPolicy.type] The type of trust policy. Possible
* values include: 'Notary'
* @member {string} [trustPolicy.status] The value that indicates whether the
* policy is enabled or not. Possible values include: 'enabled', 'disabled'
*/
export interface RegistryPolicies {
quarantinePolicy?: QuarantinePolicy;
trustPolicy?: TrustPolicy;
}

/**
* @class
* Initializes a new instance of the Replication class.
Expand Down
5 changes: 5 additions & 0 deletions lib/services/containerRegistryManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ exports.ImportImageParameters = require('./importImageParameters');
exports.RegistryNameCheckRequest = require('./registryNameCheckRequest');
exports.RegistryNameStatus = require('./registryNameStatus');
exports.OperationDisplayDefinition = require('./operationDisplayDefinition');
exports.OperationMetricSpecificationDefinition = require('./operationMetricSpecificationDefinition');
exports.OperationServiceSpecificationDefinition = require('./operationServiceSpecificationDefinition');
exports.OperationDefinition = require('./operationDefinition');
exports.Sku = require('./sku');
exports.Status = require('./status');
Expand All @@ -35,6 +37,9 @@ exports.RegistryListCredentialsResult = require('./registryListCredentialsResult
exports.RegenerateCredentialParameters = require('./regenerateCredentialParameters');
exports.RegistryUsage = require('./registryUsage');
exports.RegistryUsageListResult = require('./registryUsageListResult');
exports.QuarantinePolicy = require('./quarantinePolicy');
exports.TrustPolicy = require('./trustPolicy');
exports.RegistryPolicies = require('./registryPolicies');
exports.Replication = require('./replication');
exports.ReplicationUpdateParameters = require('./replicationUpdateParameters');
exports.Webhook = require('./webhook');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const models = require('./index');
class OperationDefinition {
/**
* Create a OperationDefinition.
* @member {string} [origin] The origin information of the container registry
* operation.
* @member {string} [name] Operation name: {provider}/{resource}/{operation}.
* @member {object} [display] The display information for the container
* registry operation.
Expand All @@ -28,6 +30,10 @@ class OperationDefinition {
* performed.
* @member {string} [display.operation] The operation that users can perform.
* @member {string} [display.description] The description for the operation.
* @member {object} [serviceSpecification] The definition of Azure Monitoring
* service.
* @member {array} [serviceSpecification.metricSpecifications] A list of
* Azure Monitoring metrics definition.
*/
constructor() {
}
Expand All @@ -46,6 +52,13 @@ class OperationDefinition {
name: 'Composite',
className: 'OperationDefinition',
modelProperties: {
origin: {
required: false,
serializedName: 'origin',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
Expand All @@ -60,6 +73,14 @@ class OperationDefinition {
name: 'Composite',
className: 'OperationDisplayDefinition'
}
},
serviceSpecification: {
required: false,
serializedName: 'properties.serviceSpecification',
type: {
name: 'Composite',
className: 'OperationServiceSpecificationDefinition'
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* 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 definition of Azure Monitoring metric.
*
*/
class OperationMetricSpecificationDefinition {
/**
* Create a OperationMetricSpecificationDefinition.
* @member {string} [name] Metric name.
* @member {string} [displayName] Metric display name.
* @member {string} [displayDescription] Metric description.
* @member {string} [unit] Metric unit.
* @member {string} [aggregationType] Metric aggregation type.
* @member {string} [internalMetricName] Internal metric name.
*/
constructor() {
}

/**
* Defines the metadata of OperationMetricSpecificationDefinition
*
* @returns {object} metadata of OperationMetricSpecificationDefinition
*
*/
mapper() {
return {
required: false,
serializedName: 'OperationMetricSpecificationDefinition',
type: {
name: 'Composite',
className: 'OperationMetricSpecificationDefinition',
modelProperties: {
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
displayName: {
required: false,
serializedName: 'displayName',
type: {
name: 'String'
}
},
displayDescription: {
required: false,
serializedName: 'displayDescription',
type: {
name: 'String'
}
},
unit: {
required: false,
serializedName: 'unit',
type: {
name: 'String'
}
},
aggregationType: {
required: false,
serializedName: 'aggregationType',
type: {
name: 'String'
}
},
internalMetricName: {
required: false,
serializedName: 'internalMetricName',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = OperationMetricSpecificationDefinition;
Loading