azure_mgmt_container_registry 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-06-27-preview/generated/azure_mgmt_container_registry/container_registry_management_client.rb +7 -6
  3. data/lib/2017-03-01/generated/azure_mgmt_container_registry/container_registry_management_client.rb +7 -6
  4. data/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/container_registry_management_client.rb +7 -6
  5. data/lib/2017-10-01/generated/azure_mgmt_container_registry.rb +26 -16
  6. data/lib/2017-10-01/generated/azure_mgmt_container_registry/container_registry_management_client.rb +7 -6
  7. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/import_image_parameters.rb +104 -0
  8. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/import_mode.rb +16 -0
  9. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/import_source.rb +64 -0
  10. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/operation_definition.rb +25 -0
  11. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/operation_metric_specification_definition.rb +101 -0
  12. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/operation_service_specification_definition.rb +56 -0
  13. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/policy_status.rb +16 -0
  14. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/quarantine_policy.rb +47 -0
  15. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/registry_policies.rb +61 -0
  16. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/trust_policy.rb +59 -0
  17. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/trust_policy_type.rb +15 -0
  18. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/webhook_action.rb +1 -0
  19. data/lib/2017-10-01/generated/azure_mgmt_container_registry/registries.rb +407 -0
  20. data/lib/azure_mgmt_container_registry.rb +2 -2
  21. data/lib/profiles/latest/modules/containerregistry_profile_module.rb +90 -50
  22. data/lib/version.rb +1 -1
  23. metadata +14 -4
@@ -0,0 +1,101 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # The definition of Azure Monitoring metric.
10
+ #
11
+ class OperationMetricSpecificationDefinition
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Metric name.
16
+ attr_accessor :name
17
+
18
+ # @return [String] Metric display name.
19
+ attr_accessor :display_name
20
+
21
+ # @return [String] Metric description.
22
+ attr_accessor :display_description
23
+
24
+ # @return [String] Metric unit.
25
+ attr_accessor :unit
26
+
27
+ # @return [String] Metric aggregation type.
28
+ attr_accessor :aggregation_type
29
+
30
+ # @return [String] Internal metric name.
31
+ attr_accessor :internal_metric_name
32
+
33
+
34
+ #
35
+ # Mapper for OperationMetricSpecificationDefinition class as Ruby Hash.
36
+ # This will be used for serialization/deserialization.
37
+ #
38
+ def self.mapper()
39
+ {
40
+ client_side_validation: true,
41
+ required: false,
42
+ serialized_name: 'OperationMetricSpecificationDefinition',
43
+ type: {
44
+ name: 'Composite',
45
+ class_name: 'OperationMetricSpecificationDefinition',
46
+ model_properties: {
47
+ name: {
48
+ client_side_validation: true,
49
+ required: false,
50
+ serialized_name: 'name',
51
+ type: {
52
+ name: 'String'
53
+ }
54
+ },
55
+ display_name: {
56
+ client_side_validation: true,
57
+ required: false,
58
+ serialized_name: 'displayName',
59
+ type: {
60
+ name: 'String'
61
+ }
62
+ },
63
+ display_description: {
64
+ client_side_validation: true,
65
+ required: false,
66
+ serialized_name: 'displayDescription',
67
+ type: {
68
+ name: 'String'
69
+ }
70
+ },
71
+ unit: {
72
+ client_side_validation: true,
73
+ required: false,
74
+ serialized_name: 'unit',
75
+ type: {
76
+ name: 'String'
77
+ }
78
+ },
79
+ aggregation_type: {
80
+ client_side_validation: true,
81
+ required: false,
82
+ serialized_name: 'aggregationType',
83
+ type: {
84
+ name: 'String'
85
+ }
86
+ },
87
+ internal_metric_name: {
88
+ client_side_validation: true,
89
+ required: false,
90
+ serialized_name: 'internalMetricName',
91
+ type: {
92
+ name: 'String'
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # The definition of Azure Monitoring metrics list.
10
+ #
11
+ class OperationServiceSpecificationDefinition
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<OperationMetricSpecificationDefinition>] A list of Azure
16
+ # Monitoring metrics definition.
17
+ attr_accessor :metric_specifications
18
+
19
+
20
+ #
21
+ # Mapper for OperationServiceSpecificationDefinition class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ client_side_validation: true,
27
+ required: false,
28
+ serialized_name: 'OperationServiceSpecificationDefinition',
29
+ type: {
30
+ name: 'Composite',
31
+ class_name: 'OperationServiceSpecificationDefinition',
32
+ model_properties: {
33
+ metric_specifications: {
34
+ client_side_validation: true,
35
+ required: false,
36
+ serialized_name: 'metricSpecifications',
37
+ type: {
38
+ name: 'Sequence',
39
+ element: {
40
+ client_side_validation: true,
41
+ required: false,
42
+ serialized_name: 'OperationMetricSpecificationDefinitionElementType',
43
+ type: {
44
+ name: 'Composite',
45
+ class_name: 'OperationMetricSpecificationDefinition'
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # Defines values for PolicyStatus
10
+ #
11
+ module PolicyStatus
12
+ Enabled = "enabled"
13
+ Disabled = "disabled"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # An object that represents quarantine policy for a container registry.
10
+ #
11
+ class QuarantinePolicy
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [PolicyStatus] The value that indicates whether the policy is
16
+ # enabled or not. Possible values include: 'enabled', 'disabled'
17
+ attr_accessor :status
18
+
19
+
20
+ #
21
+ # Mapper for QuarantinePolicy class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ client_side_validation: true,
27
+ required: false,
28
+ serialized_name: 'QuarantinePolicy',
29
+ type: {
30
+ name: 'Composite',
31
+ class_name: 'QuarantinePolicy',
32
+ model_properties: {
33
+ status: {
34
+ client_side_validation: true,
35
+ required: false,
36
+ serialized_name: 'status',
37
+ type: {
38
+ name: 'String'
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,61 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # An object that represents policies for a container registry.
10
+ #
11
+ class RegistryPolicies
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [QuarantinePolicy] An object that represents quarantine policy
16
+ # for a container registry.
17
+ attr_accessor :quarantine_policy
18
+
19
+ # @return [TrustPolicy] An object that represents content trust policy
20
+ # for a container registry.
21
+ attr_accessor :trust_policy
22
+
23
+
24
+ #
25
+ # Mapper for RegistryPolicies class as Ruby Hash.
26
+ # This will be used for serialization/deserialization.
27
+ #
28
+ def self.mapper()
29
+ {
30
+ client_side_validation: true,
31
+ required: false,
32
+ serialized_name: 'RegistryPolicies',
33
+ type: {
34
+ name: 'Composite',
35
+ class_name: 'RegistryPolicies',
36
+ model_properties: {
37
+ quarantine_policy: {
38
+ client_side_validation: true,
39
+ required: false,
40
+ serialized_name: 'quarantinePolicy',
41
+ type: {
42
+ name: 'Composite',
43
+ class_name: 'QuarantinePolicy'
44
+ }
45
+ },
46
+ trust_policy: {
47
+ client_side_validation: true,
48
+ required: false,
49
+ serialized_name: 'trustPolicy',
50
+ type: {
51
+ name: 'Composite',
52
+ class_name: 'TrustPolicy'
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,59 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # An object that represents content trust policy for a container registry.
10
+ #
11
+ class TrustPolicy
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [TrustPolicyType] The type of trust policy. Possible values
16
+ # include: 'Notary'
17
+ attr_accessor :type
18
+
19
+ # @return [PolicyStatus] The value that indicates whether the policy is
20
+ # enabled or not. Possible values include: 'enabled', 'disabled'
21
+ attr_accessor :status
22
+
23
+
24
+ #
25
+ # Mapper for TrustPolicy class as Ruby Hash.
26
+ # This will be used for serialization/deserialization.
27
+ #
28
+ def self.mapper()
29
+ {
30
+ client_side_validation: true,
31
+ required: false,
32
+ serialized_name: 'TrustPolicy',
33
+ type: {
34
+ name: 'Composite',
35
+ class_name: 'TrustPolicy',
36
+ model_properties: {
37
+ type: {
38
+ client_side_validation: true,
39
+ required: false,
40
+ serialized_name: 'type',
41
+ type: {
42
+ name: 'String'
43
+ }
44
+ },
45
+ status: {
46
+ client_side_validation: true,
47
+ required: false,
48
+ serialized_name: 'status',
49
+ type: {
50
+ name: 'String'
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ContainerRegistry::Mgmt::V2017_10_01
7
+ module Models
8
+ #
9
+ # Defines values for TrustPolicyType
10
+ #
11
+ module TrustPolicyType
12
+ Notary = "Notary"
13
+ end
14
+ end
15
+ end
@@ -11,6 +11,7 @@ module Azure::ContainerRegistry::Mgmt::V2017_10_01
11
11
  module WebhookAction
12
12
  Push = "push"
13
13
  Delete = "delete"
14
+ Quarantine = "quarantine"
14
15
  end
15
16
  end
16
17
  end
@@ -21,6 +21,51 @@ module Azure::ContainerRegistry::Mgmt::V2017_10_01
21
21
  # @return [ContainerRegistryManagementClient] reference to the ContainerRegistryManagementClient
22
22
  attr_reader :client
23
23
 
24
+ #
25
+ # Copies an image to this container registry from the specified container
26
+ # registry.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group to which
29
+ # the container registry belongs.
30
+ # @param registry_name [String] The name of the container registry.
31
+ # @param parameters [ImportImageParameters] The parameters specifying the image
32
+ # to copy and the source container registry.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ def import_image(resource_group_name, registry_name, parameters, custom_headers:nil)
37
+ response = import_image_async(resource_group_name, registry_name, parameters, custom_headers:custom_headers).value!
38
+ nil
39
+ end
40
+
41
+ #
42
+ # @param resource_group_name [String] The name of the resource group to which
43
+ # the container registry belongs.
44
+ # @param registry_name [String] The name of the container registry.
45
+ # @param parameters [ImportImageParameters] The parameters specifying the image
46
+ # to copy and the source container registry.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [Concurrent::Promise] promise which provides async access to http
51
+ # response.
52
+ #
53
+ def import_image_async(resource_group_name, registry_name, parameters, custom_headers:nil)
54
+ # Send request
55
+ promise = begin_import_image_async(resource_group_name, registry_name, parameters, custom_headers:custom_headers)
56
+
57
+ promise = promise.then do |response|
58
+ # Defining deserialization method.
59
+ deserialize_method = lambda do |parsed_response|
60
+ end
61
+
62
+ # Waiting for response.
63
+ @client.get_long_running_operation_result(response, deserialize_method)
64
+ end
65
+
66
+ promise
67
+ end
68
+
24
69
  #
25
70
  # Checks whether the container registry name is available for use. The name
26
71
  # must contain only alphanumeric characters, be globally unique, and between 5
@@ -846,6 +891,256 @@ module Azure::ContainerRegistry::Mgmt::V2017_10_01
846
891
  promise.execute
847
892
  end
848
893
 
894
+ #
895
+ # Lists the policies for the specified container registry.
896
+ #
897
+ # @param resource_group_name [String] The name of the resource group to which
898
+ # the container registry belongs.
899
+ # @param registry_name [String] The name of the container registry.
900
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
901
+ # will be added to the HTTP request.
902
+ #
903
+ # @return [RegistryPolicies] operation results.
904
+ #
905
+ def list_policies(resource_group_name, registry_name, custom_headers:nil)
906
+ response = list_policies_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
907
+ response.body unless response.nil?
908
+ end
909
+
910
+ #
911
+ # Lists the policies for the specified container registry.
912
+ #
913
+ # @param resource_group_name [String] The name of the resource group to which
914
+ # the container registry belongs.
915
+ # @param registry_name [String] The name of the container registry.
916
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
917
+ # will be added to the HTTP request.
918
+ #
919
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
920
+ #
921
+ def list_policies_with_http_info(resource_group_name, registry_name, custom_headers:nil)
922
+ list_policies_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
923
+ end
924
+
925
+ #
926
+ # Lists the policies for the specified container registry.
927
+ #
928
+ # @param resource_group_name [String] The name of the resource group to which
929
+ # the container registry belongs.
930
+ # @param registry_name [String] The name of the container registry.
931
+ # @param [Hash{String => String}] A hash of custom headers that will be added
932
+ # to the HTTP request.
933
+ #
934
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
935
+ #
936
+ def list_policies_async(resource_group_name, registry_name, custom_headers:nil)
937
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
938
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
939
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
940
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
941
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
942
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
943
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
944
+
945
+
946
+ request_headers = {}
947
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
948
+
949
+ # Set Headers
950
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
951
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
952
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listPolicies'
953
+
954
+ request_url = @base_url || @client.base_url
955
+
956
+ options = {
957
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
958
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
959
+ query_params: {'api-version' => @client.api_version},
960
+ headers: request_headers.merge(custom_headers || {}),
961
+ base_url: request_url
962
+ }
963
+ promise = @client.make_request_async(:get, path_template, options)
964
+
965
+ promise = promise.then do |result|
966
+ http_response = result.response
967
+ status_code = http_response.status
968
+ response_content = http_response.body
969
+ unless status_code == 200
970
+ error_model = JSON.load(response_content)
971
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
972
+ end
973
+
974
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
975
+ # Deserialize Response
976
+ if status_code == 200
977
+ begin
978
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
979
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2017_10_01::Models::RegistryPolicies.mapper()
980
+ result.body = @client.deserialize(result_mapper, parsed_response)
981
+ rescue Exception => e
982
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
983
+ end
984
+ end
985
+
986
+ result
987
+ end
988
+
989
+ promise.execute
990
+ end
991
+
992
+ #
993
+ # Updates the policies for the specified container registry.
994
+ #
995
+ # @param resource_group_name [String] The name of the resource group to which
996
+ # the container registry belongs.
997
+ # @param registry_name [String] The name of the container registry.
998
+ # @param registry_policies_update_parameters [RegistryPolicies] The parameters
999
+ # for updating policies of a container registry.
1000
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1001
+ # will be added to the HTTP request.
1002
+ #
1003
+ # @return [RegistryPolicies] operation results.
1004
+ #
1005
+ def update_policies(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:nil)
1006
+ response = update_policies_async(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:custom_headers).value!
1007
+ response.body unless response.nil?
1008
+ end
1009
+
1010
+ #
1011
+ # @param resource_group_name [String] The name of the resource group to which
1012
+ # the container registry belongs.
1013
+ # @param registry_name [String] The name of the container registry.
1014
+ # @param registry_policies_update_parameters [RegistryPolicies] The parameters
1015
+ # for updating policies of a container registry.
1016
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1017
+ # will be added to the HTTP request.
1018
+ #
1019
+ # @return [Concurrent::Promise] promise which provides async access to http
1020
+ # response.
1021
+ #
1022
+ def update_policies_async(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:nil)
1023
+ # Send request
1024
+ promise = begin_update_policies_async(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:custom_headers)
1025
+
1026
+ promise = promise.then do |response|
1027
+ # Defining deserialization method.
1028
+ deserialize_method = lambda do |parsed_response|
1029
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2017_10_01::Models::RegistryPolicies.mapper()
1030
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1031
+ end
1032
+
1033
+ # Waiting for response.
1034
+ @client.get_long_running_operation_result(response, deserialize_method)
1035
+ end
1036
+
1037
+ promise
1038
+ end
1039
+
1040
+ #
1041
+ # Copies an image to this container registry from the specified container
1042
+ # registry.
1043
+ #
1044
+ # @param resource_group_name [String] The name of the resource group to which
1045
+ # the container registry belongs.
1046
+ # @param registry_name [String] The name of the container registry.
1047
+ # @param parameters [ImportImageParameters] The parameters specifying the image
1048
+ # to copy and the source container registry.
1049
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1050
+ # will be added to the HTTP request.
1051
+ #
1052
+ #
1053
+ def begin_import_image(resource_group_name, registry_name, parameters, custom_headers:nil)
1054
+ response = begin_import_image_async(resource_group_name, registry_name, parameters, custom_headers:custom_headers).value!
1055
+ nil
1056
+ end
1057
+
1058
+ #
1059
+ # Copies an image to this container registry from the specified container
1060
+ # registry.
1061
+ #
1062
+ # @param resource_group_name [String] The name of the resource group to which
1063
+ # the container registry belongs.
1064
+ # @param registry_name [String] The name of the container registry.
1065
+ # @param parameters [ImportImageParameters] The parameters specifying the image
1066
+ # to copy and the source container registry.
1067
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1068
+ # will be added to the HTTP request.
1069
+ #
1070
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1071
+ #
1072
+ def begin_import_image_with_http_info(resource_group_name, registry_name, parameters, custom_headers:nil)
1073
+ begin_import_image_async(resource_group_name, registry_name, parameters, custom_headers:custom_headers).value!
1074
+ end
1075
+
1076
+ #
1077
+ # Copies an image to this container registry from the specified container
1078
+ # registry.
1079
+ #
1080
+ # @param resource_group_name [String] The name of the resource group to which
1081
+ # the container registry belongs.
1082
+ # @param registry_name [String] The name of the container registry.
1083
+ # @param parameters [ImportImageParameters] The parameters specifying the image
1084
+ # to copy and the source container registry.
1085
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1086
+ # to the HTTP request.
1087
+ #
1088
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1089
+ #
1090
+ def begin_import_image_async(resource_group_name, registry_name, parameters, custom_headers:nil)
1091
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1092
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1093
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1094
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
1095
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
1096
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
1097
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
1098
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1099
+
1100
+
1101
+ request_headers = {}
1102
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1103
+
1104
+ # Set Headers
1105
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1106
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1107
+
1108
+ # Serialize Request
1109
+ request_mapper = Azure::ContainerRegistry::Mgmt::V2017_10_01::Models::ImportImageParameters.mapper()
1110
+ request_content = @client.serialize(request_mapper, parameters)
1111
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1112
+
1113
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'
1114
+
1115
+ request_url = @base_url || @client.base_url
1116
+
1117
+ options = {
1118
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1119
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
1120
+ query_params: {'api-version' => @client.api_version},
1121
+ body: request_content,
1122
+ headers: request_headers.merge(custom_headers || {}),
1123
+ base_url: request_url
1124
+ }
1125
+ promise = @client.make_request_async(:post, path_template, options)
1126
+
1127
+ promise = promise.then do |result|
1128
+ http_response = result.response
1129
+ status_code = http_response.status
1130
+ response_content = http_response.body
1131
+ unless status_code == 200 || status_code == 202
1132
+ error_model = JSON.load(response_content)
1133
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1134
+ end
1135
+
1136
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1137
+
1138
+ result
1139
+ end
1140
+
1141
+ promise.execute
1142
+ end
1143
+
849
1144
  #
850
1145
  # Creates a container registry with the specified parameters.
851
1146
  #
@@ -1174,6 +1469,118 @@ module Azure::ContainerRegistry::Mgmt::V2017_10_01
1174
1469
  promise.execute
1175
1470
  end
1176
1471
 
1472
+ #
1473
+ # Updates the policies for the specified container registry.
1474
+ #
1475
+ # @param resource_group_name [String] The name of the resource group to which
1476
+ # the container registry belongs.
1477
+ # @param registry_name [String] The name of the container registry.
1478
+ # @param registry_policies_update_parameters [RegistryPolicies] The parameters
1479
+ # for updating policies of a container registry.
1480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1481
+ # will be added to the HTTP request.
1482
+ #
1483
+ # @return [RegistryPolicies] operation results.
1484
+ #
1485
+ def begin_update_policies(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:nil)
1486
+ response = begin_update_policies_async(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:custom_headers).value!
1487
+ response.body unless response.nil?
1488
+ end
1489
+
1490
+ #
1491
+ # Updates the policies for the specified container registry.
1492
+ #
1493
+ # @param resource_group_name [String] The name of the resource group to which
1494
+ # the container registry belongs.
1495
+ # @param registry_name [String] The name of the container registry.
1496
+ # @param registry_policies_update_parameters [RegistryPolicies] The parameters
1497
+ # for updating policies of a container registry.
1498
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1499
+ # will be added to the HTTP request.
1500
+ #
1501
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1502
+ #
1503
+ def begin_update_policies_with_http_info(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:nil)
1504
+ begin_update_policies_async(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:custom_headers).value!
1505
+ end
1506
+
1507
+ #
1508
+ # Updates the policies for the specified container registry.
1509
+ #
1510
+ # @param resource_group_name [String] The name of the resource group to which
1511
+ # the container registry belongs.
1512
+ # @param registry_name [String] The name of the container registry.
1513
+ # @param registry_policies_update_parameters [RegistryPolicies] The parameters
1514
+ # for updating policies of a container registry.
1515
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1516
+ # to the HTTP request.
1517
+ #
1518
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1519
+ #
1520
+ def begin_update_policies_async(resource_group_name, registry_name, registry_policies_update_parameters, custom_headers:nil)
1521
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1522
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1523
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1524
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
1525
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
1526
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
1527
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
1528
+ fail ArgumentError, 'registry_policies_update_parameters is nil' if registry_policies_update_parameters.nil?
1529
+
1530
+
1531
+ request_headers = {}
1532
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1533
+
1534
+ # Set Headers
1535
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1536
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1537
+
1538
+ # Serialize Request
1539
+ request_mapper = Azure::ContainerRegistry::Mgmt::V2017_10_01::Models::RegistryPolicies.mapper()
1540
+ request_content = @client.serialize(request_mapper, registry_policies_update_parameters)
1541
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1542
+
1543
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies'
1544
+
1545
+ request_url = @base_url || @client.base_url
1546
+
1547
+ options = {
1548
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1549
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
1550
+ query_params: {'api-version' => @client.api_version},
1551
+ body: request_content,
1552
+ headers: request_headers.merge(custom_headers || {}),
1553
+ base_url: request_url
1554
+ }
1555
+ promise = @client.make_request_async(:post, path_template, options)
1556
+
1557
+ promise = promise.then do |result|
1558
+ http_response = result.response
1559
+ status_code = http_response.status
1560
+ response_content = http_response.body
1561
+ unless status_code == 200 || status_code == 202
1562
+ error_model = JSON.load(response_content)
1563
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1564
+ end
1565
+
1566
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1567
+ # Deserialize Response
1568
+ if status_code == 200
1569
+ begin
1570
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1571
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2017_10_01::Models::RegistryPolicies.mapper()
1572
+ result.body = @client.deserialize(result_mapper, parsed_response)
1573
+ rescue Exception => e
1574
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1575
+ end
1576
+ end
1577
+
1578
+ result
1579
+ end
1580
+
1581
+ promise.execute
1582
+ end
1583
+
1177
1584
  #
1178
1585
  # Lists all the container registries under the specified resource group.
1179
1586
  #