azure_mgmt_resources 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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-02-01/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  3. data/lib/2016-02-01/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  4. data/lib/2016-02-01/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  5. data/lib/2016-02-01/generated/azure_mgmt_resources/resource_management_client.rb +8 -9
  6. data/lib/2016-07-01/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  7. data/lib/2016-07-01/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  8. data/lib/2016-07-01/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  9. data/lib/2016-07-01/generated/azure_mgmt_resources/resource_management_client.rb +7 -6
  10. data/lib/2016-09-01/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  11. data/lib/2016-09-01/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  12. data/lib/2016-09-01/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  13. data/lib/2016-09-01/generated/azure_mgmt_resources/resource_management_client.rb +7 -6
  14. data/lib/2017-05-10/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  15. data/lib/2017-05-10/generated/azure_mgmt_resources/models/resource.rb +1 -1
  16. data/lib/2017-05-10/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +1 -1
  17. data/lib/2017-05-10/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  18. data/lib/2017-05-10/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  19. data/lib/2017-05-10/generated/azure_mgmt_resources/resource_management_client.rb +7 -6
  20. data/lib/2018-02-01/generated/azure_mgmt_resources.rb +83 -0
  21. data/lib/2018-02-01/generated/azure_mgmt_resources/deployment_operations.rb +350 -0
  22. data/lib/2018-02-01/generated/azure_mgmt_resources/deployments.rb +1136 -0
  23. data/lib/2018-02-01/generated/azure_mgmt_resources/models/alias_path_type.rb +65 -0
  24. data/lib/2018-02-01/generated/azure_mgmt_resources/models/alias_type.rb +66 -0
  25. data/lib/2018-02-01/generated/azure_mgmt_resources/models/basic_dependency.rb +68 -0
  26. data/lib/2018-02-01/generated/azure_mgmt_resources/models/debug_setting.rb +54 -0
  27. data/lib/2018-02-01/generated/azure_mgmt_resources/models/dependency.rb +88 -0
  28. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment.rb +47 -0
  29. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_export_result.rb +46 -0
  30. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_extended.rb +70 -0
  31. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +46 -0
  32. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_list_result.rb +99 -0
  33. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_mode.rb +16 -0
  34. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_operation.rb +71 -0
  35. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +134 -0
  36. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +99 -0
  37. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_properties.rb +136 -0
  38. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +210 -0
  39. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_validate_result.rb +60 -0
  40. data/lib/2018-02-01/generated/azure_mgmt_resources/models/export_template_request.rb +69 -0
  41. data/lib/2018-02-01/generated/azure_mgmt_resources/models/generic_resource.rb +158 -0
  42. data/lib/2018-02-01/generated/azure_mgmt_resources/models/generic_resource_filter.rb +68 -0
  43. data/lib/2018-02-01/generated/azure_mgmt_resources/models/http_message.rb +46 -0
  44. data/lib/2018-02-01/generated/azure_mgmt_resources/models/identity.rb +73 -0
  45. data/lib/2018-02-01/generated/azure_mgmt_resources/models/on_error_deployment.rb +60 -0
  46. data/lib/2018-02-01/generated/azure_mgmt_resources/models/on_error_deployment_extended.rb +73 -0
  47. data/lib/2018-02-01/generated/azure_mgmt_resources/models/on_error_deployment_type.rb +16 -0
  48. data/lib/2018-02-01/generated/azure_mgmt_resources/models/parameters_link.rb +58 -0
  49. data/lib/2018-02-01/generated/azure_mgmt_resources/models/plan.rb +90 -0
  50. data/lib/2018-02-01/generated/azure_mgmt_resources/models/provider.rb +92 -0
  51. data/lib/2018-02-01/generated/azure_mgmt_resources/models/provider_list_result.rb +99 -0
  52. data/lib/2018-02-01/generated/azure_mgmt_resources/models/provider_resource_type.rb +125 -0
  53. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource.rb +101 -0
  54. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group.rb +115 -0
  55. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_export_result.rb +58 -0
  56. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_filter.rb +57 -0
  57. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_list_result.rb +99 -0
  58. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_patchable.rb +90 -0
  59. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_properties.rb +47 -0
  60. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_identity_type.rb +18 -0
  61. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_list_result.rb +99 -0
  62. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_management_error_with_details.rb +92 -0
  63. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +91 -0
  64. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resources_move_info.rb +65 -0
  65. data/lib/2018-02-01/generated/azure_mgmt_resources/models/sku.rb +101 -0
  66. data/lib/2018-02-01/generated/azure_mgmt_resources/models/sub_resource.rb +46 -0
  67. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tag_count.rb +57 -0
  68. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tag_details.rb +92 -0
  69. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tag_value.rb +70 -0
  70. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tags_list_result.rb +99 -0
  71. data/lib/2018-02-01/generated/azure_mgmt_resources/models/target_resource.rb +68 -0
  72. data/lib/2018-02-01/generated/azure_mgmt_resources/models/template_link.rb +58 -0
  73. data/lib/2018-02-01/generated/azure_mgmt_resources/module_definition.rb +9 -0
  74. data/lib/2018-02-01/generated/azure_mgmt_resources/providers.rb +520 -0
  75. data/lib/2018-02-01/generated/azure_mgmt_resources/resource_groups.rb +891 -0
  76. data/lib/2018-02-01/generated/azure_mgmt_resources/resource_management_client.rb +151 -0
  77. data/lib/2018-02-01/generated/azure_mgmt_resources/resources.rb +2178 -0
  78. data/lib/2018-02-01/generated/azure_mgmt_resources/tags.rb +599 -0
  79. data/lib/2018-05-01/generated/azure_mgmt_resources.rb +84 -0
  80. data/lib/2018-05-01/generated/azure_mgmt_resources/deployment_operations.rb +653 -0
  81. data/lib/2018-05-01/generated/azure_mgmt_resources/deployments.rb +2148 -0
  82. data/lib/2018-05-01/generated/azure_mgmt_resources/models/alias_path_type.rb +65 -0
  83. data/lib/2018-05-01/generated/azure_mgmt_resources/models/alias_type.rb +66 -0
  84. data/lib/2018-05-01/generated/azure_mgmt_resources/models/basic_dependency.rb +68 -0
  85. data/lib/2018-05-01/generated/azure_mgmt_resources/models/debug_setting.rb +54 -0
  86. data/lib/2018-05-01/generated/azure_mgmt_resources/models/dependency.rb +88 -0
  87. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment.rb +58 -0
  88. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_export_result.rb +46 -0
  89. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_extended.rb +81 -0
  90. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +46 -0
  91. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_list_result.rb +99 -0
  92. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_mode.rb +16 -0
  93. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_operation.rb +71 -0
  94. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +134 -0
  95. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +99 -0
  96. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_properties.rb +136 -0
  97. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +210 -0
  98. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_validate_result.rb +60 -0
  99. data/lib/2018-05-01/generated/azure_mgmt_resources/models/export_template_request.rb +69 -0
  100. data/lib/2018-05-01/generated/azure_mgmt_resources/models/generic_resource.rb +158 -0
  101. data/lib/2018-05-01/generated/azure_mgmt_resources/models/generic_resource_filter.rb +68 -0
  102. data/lib/2018-05-01/generated/azure_mgmt_resources/models/http_message.rb +46 -0
  103. data/lib/2018-05-01/generated/azure_mgmt_resources/models/identity.rb +96 -0
  104. data/lib/2018-05-01/generated/azure_mgmt_resources/models/identity_user_assigned_identities_value.rb +60 -0
  105. data/lib/2018-05-01/generated/azure_mgmt_resources/models/on_error_deployment.rb +60 -0
  106. data/lib/2018-05-01/generated/azure_mgmt_resources/models/on_error_deployment_extended.rb +73 -0
  107. data/lib/2018-05-01/generated/azure_mgmt_resources/models/on_error_deployment_type.rb +16 -0
  108. data/lib/2018-05-01/generated/azure_mgmt_resources/models/parameters_link.rb +58 -0
  109. data/lib/2018-05-01/generated/azure_mgmt_resources/models/plan.rb +90 -0
  110. data/lib/2018-05-01/generated/azure_mgmt_resources/models/provider.rb +92 -0
  111. data/lib/2018-05-01/generated/azure_mgmt_resources/models/provider_list_result.rb +99 -0
  112. data/lib/2018-05-01/generated/azure_mgmt_resources/models/provider_resource_type.rb +125 -0
  113. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource.rb +101 -0
  114. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group.rb +115 -0
  115. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_export_result.rb +58 -0
  116. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_filter.rb +57 -0
  117. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_list_result.rb +99 -0
  118. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_patchable.rb +90 -0
  119. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_properties.rb +47 -0
  120. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_identity_type.rb +18 -0
  121. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_list_result.rb +99 -0
  122. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_management_error_with_details.rb +92 -0
  123. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +91 -0
  124. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resources_move_info.rb +65 -0
  125. data/lib/2018-05-01/generated/azure_mgmt_resources/models/sku.rb +101 -0
  126. data/lib/2018-05-01/generated/azure_mgmt_resources/models/sub_resource.rb +46 -0
  127. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tag_count.rb +57 -0
  128. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tag_details.rb +92 -0
  129. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tag_value.rb +70 -0
  130. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tags_list_result.rb +99 -0
  131. data/lib/2018-05-01/generated/azure_mgmt_resources/models/target_resource.rb +68 -0
  132. data/lib/2018-05-01/generated/azure_mgmt_resources/models/template_link.rb +58 -0
  133. data/lib/2018-05-01/generated/azure_mgmt_resources/module_definition.rb +9 -0
  134. data/lib/2018-05-01/generated/azure_mgmt_resources/providers.rb +520 -0
  135. data/lib/2018-05-01/generated/azure_mgmt_resources/resource_groups.rb +891 -0
  136. data/lib/2018-05-01/generated/azure_mgmt_resources/resource_management_client.rb +151 -0
  137. data/lib/2018-05-01/generated/azure_mgmt_resources/resources.rb +2178 -0
  138. data/lib/2018-05-01/generated/azure_mgmt_resources/tags.rb +599 -0
  139. data/lib/azure_mgmt_resources.rb +4 -2
  140. data/lib/profiles/latest/modules/resources_profile_module.rb +138 -122
  141. data/lib/version.rb +1 -1
  142. metadata +124 -5
@@ -0,0 +1,151 @@
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::Resources::Mgmt::V2018_05_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ResourceManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The ID of the target subscription.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] The API version to use for this operation.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Deployments] deployments
39
+ attr_reader :deployments
40
+
41
+ # @return [Providers] providers
42
+ attr_reader :providers
43
+
44
+ # @return [Resources] resources
45
+ attr_reader :resources
46
+
47
+ # @return [ResourceGroups] resource_groups
48
+ attr_reader :resource_groups
49
+
50
+ # @return [Tags] tags
51
+ attr_reader :tags
52
+
53
+ # @return [DeploymentOperations] deployment_operations
54
+ attr_reader :deployment_operations
55
+
56
+ #
57
+ # Creates initializes a new instance of the ResourceManagementClient class.
58
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
59
+ # @param base_url [String] the base URI of the service.
60
+ # @param options [Array] filters to be applied to the HTTP requests.
61
+ #
62
+ def initialize(credentials = nil, base_url = nil, options = nil)
63
+ super(credentials, options)
64
+ @base_url = base_url || 'https://management.azure.com'
65
+
66
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
67
+ @credentials = credentials
68
+
69
+ @deployments = Deployments.new(self)
70
+ @providers = Providers.new(self)
71
+ @resources = Resources.new(self)
72
+ @resource_groups = ResourceGroups.new(self)
73
+ @tags = Tags.new(self)
74
+ @deployment_operations = DeploymentOperations.new(self)
75
+ @api_version = '2018-05-01'
76
+ @accept_language = 'en-US'
77
+ @long_running_operation_retry_timeout = 30
78
+ @generate_client_request_id = true
79
+ add_telemetry
80
+ end
81
+
82
+ #
83
+ # Makes a request and returns the body of the response.
84
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
85
+ # @param path [String] the path, relative to {base_url}.
86
+ # @param options [Hash{String=>String}] specifying any request options like :body.
87
+ # @return [Hash{String=>String}] containing the body of the response.
88
+ # Example:
89
+ #
90
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
91
+ # path = "/path"
92
+ # options = {
93
+ # body: request_content,
94
+ # query_params: {'api-version' => '2016-02-01'}
95
+ # }
96
+ # result = @client.make_request(:put, path, options)
97
+ #
98
+ def make_request(method, path, options = {})
99
+ result = make_request_with_http_info(method, path, options)
100
+ result.body unless result.nil?
101
+ end
102
+
103
+ #
104
+ # Makes a request and returns the operation response.
105
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
106
+ # @param path [String] the path, relative to {base_url}.
107
+ # @param options [Hash{String=>String}] specifying any request options like :body.
108
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
109
+ #
110
+ def make_request_with_http_info(method, path, options = {})
111
+ result = make_request_async(method, path, options).value!
112
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
113
+ result
114
+ end
115
+
116
+ #
117
+ # Makes a request asynchronously.
118
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
119
+ # @param path [String] the path, relative to {base_url}.
120
+ # @param options [Hash{String=>String}] specifying any request options like :body.
121
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
122
+ #
123
+ def make_request_async(method, path, options = {})
124
+ fail ArgumentError, 'method is nil' if method.nil?
125
+ fail ArgumentError, 'path is nil' if path.nil?
126
+
127
+ request_url = options[:base_url] || @base_url
128
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
129
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
130
+ end
131
+
132
+ request_headers = @request_headers
133
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
134
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
135
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
136
+
137
+ super(request_url, method, path, options)
138
+ end
139
+
140
+
141
+ private
142
+ #
143
+ # Adds telemetry information.
144
+ #
145
+ def add_telemetry
146
+ sdk_information = 'azure_mgmt_resources'
147
+ sdk_information = "#{sdk_information}/0.17.0"
148
+ add_user_agent_information(sdk_information)
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,2178 @@
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::Resources::Mgmt::V2018_05_01
7
+ #
8
+ # Provides operations for working with resources and resource groups.
9
+ #
10
+ class Resources
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Resources class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ResourceManagementClient] reference to the ResourceManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get all the resources for a resource group.
26
+ #
27
+ # @param resource_group_name [String] The resource group with the resources to
28
+ # get.
29
+ # @param filter [String] The filter to apply on the operation.
30
+ # @param expand [String] The $expand query parameter
31
+ # @param top [Integer] The number of results to return. If null is passed,
32
+ # returns all resources.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Array<GenericResource>] operation results.
37
+ #
38
+ def list_by_resource_group(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
39
+ first_page = list_by_resource_group_as_lazy(resource_group_name, filter:filter, expand:expand, top:top, custom_headers:custom_headers)
40
+ first_page.get_all_items
41
+ end
42
+
43
+ #
44
+ # Get all the resources for a resource group.
45
+ #
46
+ # @param resource_group_name [String] The resource group with the resources to
47
+ # get.
48
+ # @param filter [String] The filter to apply on the operation.
49
+ # @param expand [String] The $expand query parameter
50
+ # @param top [Integer] The number of results to return. If null is passed,
51
+ # returns all resources.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def list_by_resource_group_with_http_info(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
58
+ list_by_resource_group_async(resource_group_name, filter:filter, expand:expand, top:top, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Get all the resources for a resource group.
63
+ #
64
+ # @param resource_group_name [String] The resource group with the resources to
65
+ # get.
66
+ # @param filter [String] The filter to apply on the operation.
67
+ # @param expand [String] The $expand query parameter
68
+ # @param top [Integer] The number of results to return. If null is passed,
69
+ # returns all resources.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_by_resource_group_async(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
76
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
78
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
82
+
83
+
84
+ request_headers = {}
85
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
86
+
87
+ # Set Headers
88
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
89
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
90
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'
91
+
92
+ request_url = @base_url || @client.base_url
93
+
94
+ options = {
95
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
96
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
97
+ query_params: {'$filter' => filter,'$expand' => expand,'$top' => top,'api-version' => @client.api_version},
98
+ headers: request_headers.merge(custom_headers || {}),
99
+ base_url: request_url
100
+ }
101
+ promise = @client.make_request_async(:get, path_template, options)
102
+
103
+ promise = promise.then do |result|
104
+ http_response = result.response
105
+ status_code = http_response.status
106
+ response_content = http_response.body
107
+ unless status_code == 200
108
+ error_model = JSON.load(response_content)
109
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
110
+ end
111
+
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ # Deserialize Response
114
+ if status_code == 200
115
+ begin
116
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::ResourceListResult.mapper()
118
+ result.body = @client.deserialize(result_mapper, parsed_response)
119
+ rescue Exception => e
120
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
121
+ end
122
+ end
123
+
124
+ result
125
+ end
126
+
127
+ promise.execute
128
+ end
129
+
130
+ #
131
+ # Moves resources from one resource group to another resource group.
132
+ #
133
+ # The resources to move must be in the same source resource group. The target
134
+ # resource group may be in a different subscription. When moving resources,
135
+ # both the source group and the target group are locked for the duration of the
136
+ # operation. Write and delete operations are blocked on the groups until the
137
+ # move completes.
138
+ #
139
+ # @param source_resource_group_name [String] The name of the resource group
140
+ # containing the resources to move.
141
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
142
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
143
+ # will be added to the HTTP request.
144
+ #
145
+ def move_resources(source_resource_group_name, parameters, custom_headers:nil)
146
+ response = move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
147
+ nil
148
+ end
149
+
150
+ #
151
+ # @param source_resource_group_name [String] The name of the resource group
152
+ # containing the resources to move.
153
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
155
+ # will be added to the HTTP request.
156
+ #
157
+ # @return [Concurrent::Promise] promise which provides async access to http
158
+ # response.
159
+ #
160
+ def move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
161
+ # Send request
162
+ promise = begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers)
163
+
164
+ promise = promise.then do |response|
165
+ # Defining deserialization method.
166
+ deserialize_method = lambda do |parsed_response|
167
+ end
168
+
169
+ # Waiting for response.
170
+ @client.get_long_running_operation_result(response, deserialize_method)
171
+ end
172
+
173
+ promise
174
+ end
175
+
176
+ #
177
+ # Validates whether resources can be moved from one resource group to another
178
+ # resource group.
179
+ #
180
+ # This operation checks whether the specified resources can be moved to the
181
+ # target. The resources to move must be in the same source resource group. The
182
+ # target resource group may be in a different subscription. If validation
183
+ # succeeds, it returns HTTP response code 204 (no content). If validation
184
+ # fails, it returns HTTP response code 409 (Conflict) with an error message.
185
+ # Retrieve the URL in the Location header value to check the result of the
186
+ # long-running operation.
187
+ #
188
+ # @param source_resource_group_name [String] The name of the resource group
189
+ # containing the resources to validate for move.
190
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
192
+ # will be added to the HTTP request.
193
+ #
194
+ def validate_move_resources(source_resource_group_name, parameters, custom_headers:nil)
195
+ response = validate_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
196
+ nil
197
+ end
198
+
199
+ #
200
+ # @param source_resource_group_name [String] The name of the resource group
201
+ # containing the resources to validate for move.
202
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
203
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
204
+ # will be added to the HTTP request.
205
+ #
206
+ # @return [Concurrent::Promise] promise which provides async access to http
207
+ # response.
208
+ #
209
+ def validate_move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
210
+ # Send request
211
+ promise = begin_validate_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers)
212
+
213
+ promise = promise.then do |response|
214
+ # Defining deserialization method.
215
+ deserialize_method = lambda do |parsed_response|
216
+ end
217
+
218
+ # Waiting for response.
219
+ @client.get_long_running_operation_result(response, deserialize_method)
220
+ end
221
+
222
+ promise
223
+ end
224
+
225
+ #
226
+ # Get all the resources in a subscription.
227
+ #
228
+ # @param filter [String] The filter to apply on the operation.
229
+ # @param expand [String] The $expand query parameter.
230
+ # @param top [Integer] The number of results to return. If null is passed,
231
+ # returns all resource groups.
232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
233
+ # will be added to the HTTP request.
234
+ #
235
+ # @return [Array<GenericResource>] operation results.
236
+ #
237
+ def list(filter:nil, expand:nil, top:nil, custom_headers:nil)
238
+ first_page = list_as_lazy(filter:filter, expand:expand, top:top, custom_headers:custom_headers)
239
+ first_page.get_all_items
240
+ end
241
+
242
+ #
243
+ # Get all the resources in a subscription.
244
+ #
245
+ # @param filter [String] The filter to apply on the operation.
246
+ # @param expand [String] The $expand query parameter.
247
+ # @param top [Integer] The number of results to return. If null is passed,
248
+ # returns all resource groups.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
253
+ #
254
+ def list_with_http_info(filter:nil, expand:nil, top:nil, custom_headers:nil)
255
+ list_async(filter:filter, expand:expand, top:top, custom_headers:custom_headers).value!
256
+ end
257
+
258
+ #
259
+ # Get all the resources in a subscription.
260
+ #
261
+ # @param filter [String] The filter to apply on the operation.
262
+ # @param expand [String] The $expand query parameter.
263
+ # @param top [Integer] The number of results to return. If null is passed,
264
+ # returns all resource groups.
265
+ # @param [Hash{String => String}] A hash of custom headers that will be added
266
+ # to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
+ #
270
+ def list_async(filter:nil, expand:nil, top:nil, custom_headers:nil)
271
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
272
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
273
+
274
+
275
+ request_headers = {}
276
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
277
+
278
+ # Set Headers
279
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
280
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
281
+ path_template = 'subscriptions/{subscriptionId}/resources'
282
+
283
+ request_url = @base_url || @client.base_url
284
+
285
+ options = {
286
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
287
+ path_params: {'subscriptionId' => @client.subscription_id},
288
+ query_params: {'$filter' => filter,'$expand' => expand,'$top' => top,'api-version' => @client.api_version},
289
+ headers: request_headers.merge(custom_headers || {}),
290
+ base_url: request_url
291
+ }
292
+ promise = @client.make_request_async(:get, path_template, options)
293
+
294
+ promise = promise.then do |result|
295
+ http_response = result.response
296
+ status_code = http_response.status
297
+ response_content = http_response.body
298
+ unless status_code == 200
299
+ error_model = JSON.load(response_content)
300
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
301
+ end
302
+
303
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
304
+ # Deserialize Response
305
+ if status_code == 200
306
+ begin
307
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
308
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::ResourceListResult.mapper()
309
+ result.body = @client.deserialize(result_mapper, parsed_response)
310
+ rescue Exception => e
311
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
312
+ end
313
+ end
314
+
315
+ result
316
+ end
317
+
318
+ promise.execute
319
+ end
320
+
321
+ #
322
+ # Checks whether a resource exists.
323
+ #
324
+ # @param resource_group_name [String] The name of the resource group containing
325
+ # the resource to check. The name is case insensitive.
326
+ # @param resource_provider_namespace [String] The resource provider of the
327
+ # resource to check.
328
+ # @param parent_resource_path [String] The parent resource identity.
329
+ # @param resource_type [String] The resource type.
330
+ # @param resource_name [String] The name of the resource to check whether it
331
+ # exists.
332
+ # @param api_version [String] The API version to use for the operation.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ # @return [Boolean] operation results.
337
+ #
338
+ def check_existence(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
339
+ response = check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
340
+ response.body unless response.nil?
341
+ end
342
+
343
+ #
344
+ # Checks whether a resource exists.
345
+ #
346
+ # @param resource_group_name [String] The name of the resource group containing
347
+ # the resource to check. The name is case insensitive.
348
+ # @param resource_provider_namespace [String] The resource provider of the
349
+ # resource to check.
350
+ # @param parent_resource_path [String] The parent resource identity.
351
+ # @param resource_type [String] The resource type.
352
+ # @param resource_name [String] The name of the resource to check whether it
353
+ # exists.
354
+ # @param api_version [String] The API version to use for the operation.
355
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
356
+ # will be added to the HTTP request.
357
+ #
358
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
359
+ #
360
+ def check_existence_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
361
+ check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
362
+ end
363
+
364
+ #
365
+ # Checks whether a resource exists.
366
+ #
367
+ # @param resource_group_name [String] The name of the resource group containing
368
+ # the resource to check. The name is case insensitive.
369
+ # @param resource_provider_namespace [String] The resource provider of the
370
+ # resource to check.
371
+ # @param parent_resource_path [String] The parent resource identity.
372
+ # @param resource_type [String] The resource type.
373
+ # @param resource_name [String] The name of the resource to check whether it
374
+ # exists.
375
+ # @param api_version [String] The API version to use for the operation.
376
+ # @param [Hash{String => String}] A hash of custom headers that will be added
377
+ # to the HTTP request.
378
+ #
379
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
380
+ #
381
+ def check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
382
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
383
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
384
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
385
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
386
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
387
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
388
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
389
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
390
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
391
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
392
+
393
+
394
+ request_headers = {}
395
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
396
+
397
+ # Set Headers
398
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
399
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
400
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
401
+
402
+ request_url = @base_url || @client.base_url
403
+
404
+ options = {
405
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
406
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
407
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
408
+ query_params: {'api-version' => api_version},
409
+ headers: request_headers.merge(custom_headers || {}),
410
+ base_url: request_url
411
+ }
412
+ promise = @client.make_request_async(:head, path_template, options)
413
+
414
+ promise = promise.then do |result|
415
+ http_response = result.response
416
+ status_code = http_response.status
417
+ response_content = http_response.body
418
+ unless status_code == 204 || status_code == 404
419
+ error_model = JSON.load(response_content)
420
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
421
+ end
422
+
423
+ result.body = (status_code == 204)
424
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
425
+
426
+ result
427
+ end
428
+
429
+ promise.execute
430
+ end
431
+
432
+ #
433
+ # Deletes a resource.
434
+ #
435
+ # @param resource_group_name [String] The name of the resource group that
436
+ # contains the resource to delete. The name is case insensitive.
437
+ # @param resource_provider_namespace [String] The namespace of the resource
438
+ # provider.
439
+ # @param parent_resource_path [String] The parent resource identity.
440
+ # @param resource_type [String] The resource type.
441
+ # @param resource_name [String] The name of the resource to delete.
442
+ # @param api_version [String] The API version to use for the operation.
443
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
444
+ # will be added to the HTTP request.
445
+ #
446
+ def delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
447
+ response = delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
448
+ nil
449
+ end
450
+
451
+ #
452
+ # @param resource_group_name [String] The name of the resource group that
453
+ # contains the resource to delete. The name is case insensitive.
454
+ # @param resource_provider_namespace [String] The namespace of the resource
455
+ # provider.
456
+ # @param parent_resource_path [String] The parent resource identity.
457
+ # @param resource_type [String] The resource type.
458
+ # @param resource_name [String] The name of the resource to delete.
459
+ # @param api_version [String] The API version to use for the operation.
460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
461
+ # will be added to the HTTP request.
462
+ #
463
+ # @return [Concurrent::Promise] promise which provides async access to http
464
+ # response.
465
+ #
466
+ def delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
467
+ # Send request
468
+ promise = begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers)
469
+
470
+ promise = promise.then do |response|
471
+ # Defining deserialization method.
472
+ deserialize_method = lambda do |parsed_response|
473
+ end
474
+
475
+ # Waiting for response.
476
+ @client.get_long_running_operation_result(response, deserialize_method)
477
+ end
478
+
479
+ promise
480
+ end
481
+
482
+ #
483
+ # Creates a resource.
484
+ #
485
+ # @param resource_group_name [String] The name of the resource group for the
486
+ # resource. The name is case insensitive.
487
+ # @param resource_provider_namespace [String] The namespace of the resource
488
+ # provider.
489
+ # @param parent_resource_path [String] The parent resource identity.
490
+ # @param resource_type [String] The resource type of the resource to create.
491
+ # @param resource_name [String] The name of the resource to create.
492
+ # @param api_version [String] The API version to use for the operation.
493
+ # @param parameters [GenericResource] Parameters for creating or updating the
494
+ # resource.
495
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
496
+ # will be added to the HTTP request.
497
+ #
498
+ # @return [GenericResource] operation results.
499
+ #
500
+ def create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
501
+ response = create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
502
+ response.body unless response.nil?
503
+ end
504
+
505
+ #
506
+ # @param resource_group_name [String] The name of the resource group for the
507
+ # resource. The name is case insensitive.
508
+ # @param resource_provider_namespace [String] The namespace of the resource
509
+ # provider.
510
+ # @param parent_resource_path [String] The parent resource identity.
511
+ # @param resource_type [String] The resource type of the resource to create.
512
+ # @param resource_name [String] The name of the resource to create.
513
+ # @param api_version [String] The API version to use for the operation.
514
+ # @param parameters [GenericResource] Parameters for creating or updating the
515
+ # resource.
516
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
517
+ # will be added to the HTTP request.
518
+ #
519
+ # @return [Concurrent::Promise] promise which provides async access to http
520
+ # response.
521
+ #
522
+ def create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
523
+ # Send request
524
+ promise = begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers)
525
+
526
+ promise = promise.then do |response|
527
+ # Defining deserialization method.
528
+ deserialize_method = lambda do |parsed_response|
529
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
530
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
531
+ end
532
+
533
+ # Waiting for response.
534
+ @client.get_long_running_operation_result(response, deserialize_method)
535
+ end
536
+
537
+ promise
538
+ end
539
+
540
+ #
541
+ # Updates a resource.
542
+ #
543
+ # @param resource_group_name [String] The name of the resource group for the
544
+ # resource. The name is case insensitive.
545
+ # @param resource_provider_namespace [String] The namespace of the resource
546
+ # provider.
547
+ # @param parent_resource_path [String] The parent resource identity.
548
+ # @param resource_type [String] The resource type of the resource to update.
549
+ # @param resource_name [String] The name of the resource to update.
550
+ # @param api_version [String] The API version to use for the operation.
551
+ # @param parameters [GenericResource] Parameters for updating the resource.
552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
553
+ # will be added to the HTTP request.
554
+ #
555
+ # @return [GenericResource] operation results.
556
+ #
557
+ def update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
558
+ response = update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
559
+ response.body unless response.nil?
560
+ end
561
+
562
+ #
563
+ # @param resource_group_name [String] The name of the resource group for the
564
+ # resource. The name is case insensitive.
565
+ # @param resource_provider_namespace [String] The namespace of the resource
566
+ # provider.
567
+ # @param parent_resource_path [String] The parent resource identity.
568
+ # @param resource_type [String] The resource type of the resource to update.
569
+ # @param resource_name [String] The name of the resource to update.
570
+ # @param api_version [String] The API version to use for the operation.
571
+ # @param parameters [GenericResource] Parameters for updating the resource.
572
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
573
+ # will be added to the HTTP request.
574
+ #
575
+ # @return [Concurrent::Promise] promise which provides async access to http
576
+ # response.
577
+ #
578
+ def update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
579
+ # Send request
580
+ promise = begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers)
581
+
582
+ promise = promise.then do |response|
583
+ # Defining deserialization method.
584
+ deserialize_method = lambda do |parsed_response|
585
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
586
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
587
+ end
588
+
589
+ # Waiting for response.
590
+ @client.get_long_running_operation_result(response, deserialize_method)
591
+ end
592
+
593
+ promise
594
+ end
595
+
596
+ #
597
+ # Gets a resource.
598
+ #
599
+ # @param resource_group_name [String] The name of the resource group containing
600
+ # the resource to get. The name is case insensitive.
601
+ # @param resource_provider_namespace [String] The namespace of the resource
602
+ # provider.
603
+ # @param parent_resource_path [String] The parent resource identity.
604
+ # @param resource_type [String] The resource type of the resource.
605
+ # @param resource_name [String] The name of the resource to get.
606
+ # @param api_version [String] The API version to use for the operation.
607
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
608
+ # will be added to the HTTP request.
609
+ #
610
+ # @return [GenericResource] operation results.
611
+ #
612
+ def get(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
613
+ response = get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
614
+ response.body unless response.nil?
615
+ end
616
+
617
+ #
618
+ # Gets a resource.
619
+ #
620
+ # @param resource_group_name [String] The name of the resource group containing
621
+ # the resource to get. The name is case insensitive.
622
+ # @param resource_provider_namespace [String] The namespace of the resource
623
+ # provider.
624
+ # @param parent_resource_path [String] The parent resource identity.
625
+ # @param resource_type [String] The resource type of the resource.
626
+ # @param resource_name [String] The name of the resource to get.
627
+ # @param api_version [String] The API version to use for the operation.
628
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
629
+ # will be added to the HTTP request.
630
+ #
631
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
632
+ #
633
+ def get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
634
+ get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
635
+ end
636
+
637
+ #
638
+ # Gets a resource.
639
+ #
640
+ # @param resource_group_name [String] The name of the resource group containing
641
+ # the resource to get. The name is case insensitive.
642
+ # @param resource_provider_namespace [String] The namespace of the resource
643
+ # provider.
644
+ # @param parent_resource_path [String] The parent resource identity.
645
+ # @param resource_type [String] The resource type of the resource.
646
+ # @param resource_name [String] The name of the resource to get.
647
+ # @param api_version [String] The API version to use for the operation.
648
+ # @param [Hash{String => String}] A hash of custom headers that will be added
649
+ # to the HTTP request.
650
+ #
651
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
652
+ #
653
+ def get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
654
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
655
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
656
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
657
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
658
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
659
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
660
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
661
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
662
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
663
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
664
+
665
+
666
+ request_headers = {}
667
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
668
+
669
+ # Set Headers
670
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
671
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
672
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
673
+
674
+ request_url = @base_url || @client.base_url
675
+
676
+ options = {
677
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
678
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
679
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
680
+ query_params: {'api-version' => api_version},
681
+ headers: request_headers.merge(custom_headers || {}),
682
+ base_url: request_url
683
+ }
684
+ promise = @client.make_request_async(:get, path_template, options)
685
+
686
+ promise = promise.then do |result|
687
+ http_response = result.response
688
+ status_code = http_response.status
689
+ response_content = http_response.body
690
+ unless status_code == 200
691
+ error_model = JSON.load(response_content)
692
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
693
+ end
694
+
695
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
696
+ # Deserialize Response
697
+ if status_code == 200
698
+ begin
699
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
700
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
701
+ result.body = @client.deserialize(result_mapper, parsed_response)
702
+ rescue Exception => e
703
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
704
+ end
705
+ end
706
+
707
+ result
708
+ end
709
+
710
+ promise.execute
711
+ end
712
+
713
+ #
714
+ # Checks by ID whether a resource exists.
715
+ #
716
+ # @param resource_id [String] The fully qualified ID of the resource, including
717
+ # the resource name and resource type. Use the format,
718
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
719
+ # @param api_version [String] The API version to use for the operation.
720
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
721
+ # will be added to the HTTP request.
722
+ #
723
+ # @return [Boolean] operation results.
724
+ #
725
+ def check_existence_by_id(resource_id, api_version, custom_headers:nil)
726
+ response = check_existence_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
727
+ response.body unless response.nil?
728
+ end
729
+
730
+ #
731
+ # Checks by ID whether a resource exists.
732
+ #
733
+ # @param resource_id [String] The fully qualified ID of the resource, including
734
+ # the resource name and resource type. Use the format,
735
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
736
+ # @param api_version [String] The API version to use for the operation.
737
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
738
+ # will be added to the HTTP request.
739
+ #
740
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
741
+ #
742
+ def check_existence_by_id_with_http_info(resource_id, api_version, custom_headers:nil)
743
+ check_existence_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
744
+ end
745
+
746
+ #
747
+ # Checks by ID whether a resource exists.
748
+ #
749
+ # @param resource_id [String] The fully qualified ID of the resource, including
750
+ # the resource name and resource type. Use the format,
751
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
752
+ # @param api_version [String] The API version to use for the operation.
753
+ # @param [Hash{String => String}] A hash of custom headers that will be added
754
+ # to the HTTP request.
755
+ #
756
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
757
+ #
758
+ def check_existence_by_id_async(resource_id, api_version, custom_headers:nil)
759
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
760
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
761
+
762
+
763
+ request_headers = {}
764
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
765
+
766
+ # Set Headers
767
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
768
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
769
+ path_template = '{resourceId}'
770
+
771
+ request_url = @base_url || @client.base_url
772
+
773
+ options = {
774
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
775
+ skip_encoding_path_params: {'resourceId' => resource_id},
776
+ query_params: {'api-version' => api_version},
777
+ headers: request_headers.merge(custom_headers || {}),
778
+ base_url: request_url
779
+ }
780
+ promise = @client.make_request_async(:head, path_template, options)
781
+
782
+ promise = promise.then do |result|
783
+ http_response = result.response
784
+ status_code = http_response.status
785
+ response_content = http_response.body
786
+ unless status_code == 204 || status_code == 404
787
+ error_model = JSON.load(response_content)
788
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
789
+ end
790
+
791
+ result.body = (status_code == 204)
792
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
793
+
794
+ result
795
+ end
796
+
797
+ promise.execute
798
+ end
799
+
800
+ #
801
+ # Deletes a resource by ID.
802
+ #
803
+ # @param resource_id [String] The fully qualified ID of the resource, including
804
+ # the resource name and resource type. Use the format,
805
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
806
+ # @param api_version [String] The API version to use for the operation.
807
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
808
+ # will be added to the HTTP request.
809
+ #
810
+ def delete_by_id(resource_id, api_version, custom_headers:nil)
811
+ response = delete_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
812
+ nil
813
+ end
814
+
815
+ #
816
+ # @param resource_id [String] The fully qualified ID of the resource, including
817
+ # the resource name and resource type. Use the format,
818
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
819
+ # @param api_version [String] The API version to use for the operation.
820
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
821
+ # will be added to the HTTP request.
822
+ #
823
+ # @return [Concurrent::Promise] promise which provides async access to http
824
+ # response.
825
+ #
826
+ def delete_by_id_async(resource_id, api_version, custom_headers:nil)
827
+ # Send request
828
+ promise = begin_delete_by_id_async(resource_id, api_version, custom_headers:custom_headers)
829
+
830
+ promise = promise.then do |response|
831
+ # Defining deserialization method.
832
+ deserialize_method = lambda do |parsed_response|
833
+ end
834
+
835
+ # Waiting for response.
836
+ @client.get_long_running_operation_result(response, deserialize_method)
837
+ end
838
+
839
+ promise
840
+ end
841
+
842
+ #
843
+ # Create a resource by ID.
844
+ #
845
+ # @param resource_id [String] The fully qualified ID of the resource, including
846
+ # the resource name and resource type. Use the format,
847
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
848
+ # @param api_version [String] The API version to use for the operation.
849
+ # @param parameters [GenericResource] Create or update resource parameters.
850
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
851
+ # will be added to the HTTP request.
852
+ #
853
+ # @return [GenericResource] operation results.
854
+ #
855
+ def create_or_update_by_id(resource_id, api_version, parameters, custom_headers:nil)
856
+ response = create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
857
+ response.body unless response.nil?
858
+ end
859
+
860
+ #
861
+ # @param resource_id [String] The fully qualified ID of the resource, including
862
+ # the resource name and resource type. Use the format,
863
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
864
+ # @param api_version [String] The API version to use for the operation.
865
+ # @param parameters [GenericResource] Create or update resource parameters.
866
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
867
+ # will be added to the HTTP request.
868
+ #
869
+ # @return [Concurrent::Promise] promise which provides async access to http
870
+ # response.
871
+ #
872
+ def create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
873
+ # Send request
874
+ promise = begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers)
875
+
876
+ promise = promise.then do |response|
877
+ # Defining deserialization method.
878
+ deserialize_method = lambda do |parsed_response|
879
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
880
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
881
+ end
882
+
883
+ # Waiting for response.
884
+ @client.get_long_running_operation_result(response, deserialize_method)
885
+ end
886
+
887
+ promise
888
+ end
889
+
890
+ #
891
+ # Updates a resource by ID.
892
+ #
893
+ # @param resource_id [String] The fully qualified ID of the resource, including
894
+ # the resource name and resource type. Use the format,
895
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
896
+ # @param api_version [String] The API version to use for the operation.
897
+ # @param parameters [GenericResource] Update resource parameters.
898
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
899
+ # will be added to the HTTP request.
900
+ #
901
+ # @return [GenericResource] operation results.
902
+ #
903
+ def update_by_id(resource_id, api_version, parameters, custom_headers:nil)
904
+ response = update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
905
+ response.body unless response.nil?
906
+ end
907
+
908
+ #
909
+ # @param resource_id [String] The fully qualified ID of the resource, including
910
+ # the resource name and resource type. Use the format,
911
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
912
+ # @param api_version [String] The API version to use for the operation.
913
+ # @param parameters [GenericResource] Update resource parameters.
914
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
915
+ # will be added to the HTTP request.
916
+ #
917
+ # @return [Concurrent::Promise] promise which provides async access to http
918
+ # response.
919
+ #
920
+ def update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
921
+ # Send request
922
+ promise = begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers)
923
+
924
+ promise = promise.then do |response|
925
+ # Defining deserialization method.
926
+ deserialize_method = lambda do |parsed_response|
927
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
928
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
929
+ end
930
+
931
+ # Waiting for response.
932
+ @client.get_long_running_operation_result(response, deserialize_method)
933
+ end
934
+
935
+ promise
936
+ end
937
+
938
+ #
939
+ # Gets a resource by ID.
940
+ #
941
+ # @param resource_id [String] The fully qualified ID of the resource, including
942
+ # the resource name and resource type. Use the format,
943
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
944
+ # @param api_version [String] The API version to use for the operation.
945
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
946
+ # will be added to the HTTP request.
947
+ #
948
+ # @return [GenericResource] operation results.
949
+ #
950
+ def get_by_id(resource_id, api_version, custom_headers:nil)
951
+ response = get_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
952
+ response.body unless response.nil?
953
+ end
954
+
955
+ #
956
+ # Gets a resource by ID.
957
+ #
958
+ # @param resource_id [String] The fully qualified ID of the resource, including
959
+ # the resource name and resource type. Use the format,
960
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
961
+ # @param api_version [String] The API version to use for the operation.
962
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
963
+ # will be added to the HTTP request.
964
+ #
965
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
966
+ #
967
+ def get_by_id_with_http_info(resource_id, api_version, custom_headers:nil)
968
+ get_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
969
+ end
970
+
971
+ #
972
+ # Gets a resource by ID.
973
+ #
974
+ # @param resource_id [String] The fully qualified ID of the resource, including
975
+ # the resource name and resource type. Use the format,
976
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
977
+ # @param api_version [String] The API version to use for the operation.
978
+ # @param [Hash{String => String}] A hash of custom headers that will be added
979
+ # to the HTTP request.
980
+ #
981
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
982
+ #
983
+ def get_by_id_async(resource_id, api_version, custom_headers:nil)
984
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
985
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
986
+
987
+
988
+ request_headers = {}
989
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
990
+
991
+ # Set Headers
992
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
993
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
994
+ path_template = '{resourceId}'
995
+
996
+ request_url = @base_url || @client.base_url
997
+
998
+ options = {
999
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1000
+ skip_encoding_path_params: {'resourceId' => resource_id},
1001
+ query_params: {'api-version' => api_version},
1002
+ headers: request_headers.merge(custom_headers || {}),
1003
+ base_url: request_url
1004
+ }
1005
+ promise = @client.make_request_async(:get, path_template, options)
1006
+
1007
+ promise = promise.then do |result|
1008
+ http_response = result.response
1009
+ status_code = http_response.status
1010
+ response_content = http_response.body
1011
+ unless status_code == 200
1012
+ error_model = JSON.load(response_content)
1013
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1014
+ end
1015
+
1016
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1017
+ # Deserialize Response
1018
+ if status_code == 200
1019
+ begin
1020
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1021
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1022
+ result.body = @client.deserialize(result_mapper, parsed_response)
1023
+ rescue Exception => e
1024
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1025
+ end
1026
+ end
1027
+
1028
+ result
1029
+ end
1030
+
1031
+ promise.execute
1032
+ end
1033
+
1034
+ #
1035
+ # Moves resources from one resource group to another resource group.
1036
+ #
1037
+ # The resources to move must be in the same source resource group. The target
1038
+ # resource group may be in a different subscription. When moving resources,
1039
+ # both the source group and the target group are locked for the duration of the
1040
+ # operation. Write and delete operations are blocked on the groups until the
1041
+ # move completes.
1042
+ #
1043
+ # @param source_resource_group_name [String] The name of the resource group
1044
+ # containing the resources to move.
1045
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
1046
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1047
+ # will be added to the HTTP request.
1048
+ #
1049
+ #
1050
+ def begin_move_resources(source_resource_group_name, parameters, custom_headers:nil)
1051
+ response = begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
1052
+ nil
1053
+ end
1054
+
1055
+ #
1056
+ # Moves resources from one resource group to another resource group.
1057
+ #
1058
+ # The resources to move must be in the same source resource group. The target
1059
+ # resource group may be in a different subscription. When moving resources,
1060
+ # both the source group and the target group are locked for the duration of the
1061
+ # operation. Write and delete operations are blocked on the groups until the
1062
+ # move completes.
1063
+ #
1064
+ # @param source_resource_group_name [String] The name of the resource group
1065
+ # containing the resources to move.
1066
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
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_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers:nil)
1073
+ begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
1074
+ end
1075
+
1076
+ #
1077
+ # Moves resources from one resource group to another resource group.
1078
+ #
1079
+ # The resources to move must be in the same source resource group. The target
1080
+ # resource group may be in a different subscription. When moving resources,
1081
+ # both the source group and the target group are locked for the duration of the
1082
+ # operation. Write and delete operations are blocked on the groups until the
1083
+ # move completes.
1084
+ #
1085
+ # @param source_resource_group_name [String] The name of the resource group
1086
+ # containing the resources to move.
1087
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
1088
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1089
+ # to the HTTP request.
1090
+ #
1091
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1092
+ #
1093
+ def begin_move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
1094
+ fail ArgumentError, 'source_resource_group_name is nil' if source_resource_group_name.nil?
1095
+ fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !source_resource_group_name.nil? && source_resource_group_name.length > 90
1096
+ fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !source_resource_group_name.nil? && source_resource_group_name.length < 1
1097
+ fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !source_resource_group_name.nil? && source_resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1098
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1099
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1100
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1101
+
1102
+
1103
+ request_headers = {}
1104
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1105
+
1106
+ # Set Headers
1107
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1108
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1109
+
1110
+ # Serialize Request
1111
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::ResourcesMoveInfo.mapper()
1112
+ request_content = @client.serialize(request_mapper, parameters)
1113
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1114
+
1115
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'
1116
+
1117
+ request_url = @base_url || @client.base_url
1118
+
1119
+ options = {
1120
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1121
+ path_params: {'sourceResourceGroupName' => source_resource_group_name,'subscriptionId' => @client.subscription_id},
1122
+ query_params: {'api-version' => @client.api_version},
1123
+ body: request_content,
1124
+ headers: request_headers.merge(custom_headers || {}),
1125
+ base_url: request_url
1126
+ }
1127
+ promise = @client.make_request_async(:post, path_template, options)
1128
+
1129
+ promise = promise.then do |result|
1130
+ http_response = result.response
1131
+ status_code = http_response.status
1132
+ response_content = http_response.body
1133
+ unless status_code == 202 || status_code == 204
1134
+ error_model = JSON.load(response_content)
1135
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1136
+ end
1137
+
1138
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1139
+
1140
+ result
1141
+ end
1142
+
1143
+ promise.execute
1144
+ end
1145
+
1146
+ #
1147
+ # Validates whether resources can be moved from one resource group to another
1148
+ # resource group.
1149
+ #
1150
+ # This operation checks whether the specified resources can be moved to the
1151
+ # target. The resources to move must be in the same source resource group. The
1152
+ # target resource group may be in a different subscription. If validation
1153
+ # succeeds, it returns HTTP response code 204 (no content). If validation
1154
+ # fails, it returns HTTP response code 409 (Conflict) with an error message.
1155
+ # Retrieve the URL in the Location header value to check the result of the
1156
+ # long-running operation.
1157
+ #
1158
+ # @param source_resource_group_name [String] The name of the resource group
1159
+ # containing the resources to validate for move.
1160
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
1161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1162
+ # will be added to the HTTP request.
1163
+ #
1164
+ #
1165
+ def begin_validate_move_resources(source_resource_group_name, parameters, custom_headers:nil)
1166
+ response = begin_validate_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
1167
+ nil
1168
+ end
1169
+
1170
+ #
1171
+ # Validates whether resources can be moved from one resource group to another
1172
+ # resource group.
1173
+ #
1174
+ # This operation checks whether the specified resources can be moved to the
1175
+ # target. The resources to move must be in the same source resource group. The
1176
+ # target resource group may be in a different subscription. If validation
1177
+ # succeeds, it returns HTTP response code 204 (no content). If validation
1178
+ # fails, it returns HTTP response code 409 (Conflict) with an error message.
1179
+ # Retrieve the URL in the Location header value to check the result of the
1180
+ # long-running operation.
1181
+ #
1182
+ # @param source_resource_group_name [String] The name of the resource group
1183
+ # containing the resources to validate for move.
1184
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
1185
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1186
+ # will be added to the HTTP request.
1187
+ #
1188
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1189
+ #
1190
+ def begin_validate_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers:nil)
1191
+ begin_validate_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
1192
+ end
1193
+
1194
+ #
1195
+ # Validates whether resources can be moved from one resource group to another
1196
+ # resource group.
1197
+ #
1198
+ # This operation checks whether the specified resources can be moved to the
1199
+ # target. The resources to move must be in the same source resource group. The
1200
+ # target resource group may be in a different subscription. If validation
1201
+ # succeeds, it returns HTTP response code 204 (no content). If validation
1202
+ # fails, it returns HTTP response code 409 (Conflict) with an error message.
1203
+ # Retrieve the URL in the Location header value to check the result of the
1204
+ # long-running operation.
1205
+ #
1206
+ # @param source_resource_group_name [String] The name of the resource group
1207
+ # containing the resources to validate for move.
1208
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
1209
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1210
+ # to the HTTP request.
1211
+ #
1212
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1213
+ #
1214
+ def begin_validate_move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
1215
+ fail ArgumentError, 'source_resource_group_name is nil' if source_resource_group_name.nil?
1216
+ fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !source_resource_group_name.nil? && source_resource_group_name.length > 90
1217
+ fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !source_resource_group_name.nil? && source_resource_group_name.length < 1
1218
+ fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !source_resource_group_name.nil? && source_resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1219
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1220
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1221
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1222
+
1223
+
1224
+ request_headers = {}
1225
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1226
+
1227
+ # Set Headers
1228
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1229
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1230
+
1231
+ # Serialize Request
1232
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::ResourcesMoveInfo.mapper()
1233
+ request_content = @client.serialize(request_mapper, parameters)
1234
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1235
+
1236
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'
1237
+
1238
+ request_url = @base_url || @client.base_url
1239
+
1240
+ options = {
1241
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1242
+ path_params: {'sourceResourceGroupName' => source_resource_group_name,'subscriptionId' => @client.subscription_id},
1243
+ query_params: {'api-version' => @client.api_version},
1244
+ body: request_content,
1245
+ headers: request_headers.merge(custom_headers || {}),
1246
+ base_url: request_url
1247
+ }
1248
+ promise = @client.make_request_async(:post, path_template, options)
1249
+
1250
+ promise = promise.then do |result|
1251
+ http_response = result.response
1252
+ status_code = http_response.status
1253
+ response_content = http_response.body
1254
+ unless status_code == 202 || status_code == 204 || status_code == 409
1255
+ error_model = JSON.load(response_content)
1256
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1257
+ end
1258
+
1259
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1260
+
1261
+ result
1262
+ end
1263
+
1264
+ promise.execute
1265
+ end
1266
+
1267
+ #
1268
+ # Deletes a resource.
1269
+ #
1270
+ # @param resource_group_name [String] The name of the resource group that
1271
+ # contains the resource to delete. The name is case insensitive.
1272
+ # @param resource_provider_namespace [String] The namespace of the resource
1273
+ # provider.
1274
+ # @param parent_resource_path [String] The parent resource identity.
1275
+ # @param resource_type [String] The resource type.
1276
+ # @param resource_name [String] The name of the resource to delete.
1277
+ # @param api_version [String] The API version to use for the operation.
1278
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1279
+ # will be added to the HTTP request.
1280
+ #
1281
+ #
1282
+ def begin_delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
1283
+ response = begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
1284
+ nil
1285
+ end
1286
+
1287
+ #
1288
+ # Deletes a resource.
1289
+ #
1290
+ # @param resource_group_name [String] The name of the resource group that
1291
+ # contains the resource to delete. The name is case insensitive.
1292
+ # @param resource_provider_namespace [String] The namespace of the resource
1293
+ # provider.
1294
+ # @param parent_resource_path [String] The parent resource identity.
1295
+ # @param resource_type [String] The resource type.
1296
+ # @param resource_name [String] The name of the resource to delete.
1297
+ # @param api_version [String] The API version to use for the operation.
1298
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1299
+ # will be added to the HTTP request.
1300
+ #
1301
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1302
+ #
1303
+ def begin_delete_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
1304
+ begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
1305
+ end
1306
+
1307
+ #
1308
+ # Deletes a resource.
1309
+ #
1310
+ # @param resource_group_name [String] The name of the resource group that
1311
+ # contains the resource to delete. The name is case insensitive.
1312
+ # @param resource_provider_namespace [String] The namespace of the resource
1313
+ # provider.
1314
+ # @param parent_resource_path [String] The parent resource identity.
1315
+ # @param resource_type [String] The resource type.
1316
+ # @param resource_name [String] The name of the resource to delete.
1317
+ # @param api_version [String] The API version to use for the operation.
1318
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1319
+ # to the HTTP request.
1320
+ #
1321
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1322
+ #
1323
+ def begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
1324
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1325
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1326
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1327
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1328
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
1329
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
1330
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
1331
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1332
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1333
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1334
+
1335
+
1336
+ request_headers = {}
1337
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1338
+
1339
+ # Set Headers
1340
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1341
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1342
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
1343
+
1344
+ request_url = @base_url || @client.base_url
1345
+
1346
+ options = {
1347
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1348
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
1349
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
1350
+ query_params: {'api-version' => api_version},
1351
+ headers: request_headers.merge(custom_headers || {}),
1352
+ base_url: request_url
1353
+ }
1354
+ promise = @client.make_request_async(:delete, path_template, options)
1355
+
1356
+ promise = promise.then do |result|
1357
+ http_response = result.response
1358
+ status_code = http_response.status
1359
+ response_content = http_response.body
1360
+ unless status_code == 200 || status_code == 204 || status_code == 202
1361
+ error_model = JSON.load(response_content)
1362
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1363
+ end
1364
+
1365
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1366
+
1367
+ result
1368
+ end
1369
+
1370
+ promise.execute
1371
+ end
1372
+
1373
+ #
1374
+ # Creates a resource.
1375
+ #
1376
+ # @param resource_group_name [String] The name of the resource group for the
1377
+ # resource. The name is case insensitive.
1378
+ # @param resource_provider_namespace [String] The namespace of the resource
1379
+ # provider.
1380
+ # @param parent_resource_path [String] The parent resource identity.
1381
+ # @param resource_type [String] The resource type of the resource to create.
1382
+ # @param resource_name [String] The name of the resource to create.
1383
+ # @param api_version [String] The API version to use for the operation.
1384
+ # @param parameters [GenericResource] Parameters for creating or updating the
1385
+ # resource.
1386
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1387
+ # will be added to the HTTP request.
1388
+ #
1389
+ # @return [GenericResource] operation results.
1390
+ #
1391
+ def begin_create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
1392
+ response = begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
1393
+ response.body unless response.nil?
1394
+ end
1395
+
1396
+ #
1397
+ # Creates a resource.
1398
+ #
1399
+ # @param resource_group_name [String] The name of the resource group for the
1400
+ # resource. The name is case insensitive.
1401
+ # @param resource_provider_namespace [String] The namespace of the resource
1402
+ # provider.
1403
+ # @param parent_resource_path [String] The parent resource identity.
1404
+ # @param resource_type [String] The resource type of the resource to create.
1405
+ # @param resource_name [String] The name of the resource to create.
1406
+ # @param api_version [String] The API version to use for the operation.
1407
+ # @param parameters [GenericResource] Parameters for creating or updating the
1408
+ # resource.
1409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1410
+ # will be added to the HTTP request.
1411
+ #
1412
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1413
+ #
1414
+ def begin_create_or_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
1415
+ begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
1416
+ end
1417
+
1418
+ #
1419
+ # Creates a resource.
1420
+ #
1421
+ # @param resource_group_name [String] The name of the resource group for the
1422
+ # resource. The name is case insensitive.
1423
+ # @param resource_provider_namespace [String] The namespace of the resource
1424
+ # provider.
1425
+ # @param parent_resource_path [String] The parent resource identity.
1426
+ # @param resource_type [String] The resource type of the resource to create.
1427
+ # @param resource_name [String] The name of the resource to create.
1428
+ # @param api_version [String] The API version to use for the operation.
1429
+ # @param parameters [GenericResource] Parameters for creating or updating the
1430
+ # resource.
1431
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1432
+ # to the HTTP request.
1433
+ #
1434
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1435
+ #
1436
+ def begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
1437
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1438
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1439
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1440
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1441
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
1442
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
1443
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
1444
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1445
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1446
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1447
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1448
+
1449
+
1450
+ request_headers = {}
1451
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1452
+
1453
+ # Set Headers
1454
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1455
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1456
+
1457
+ # Serialize Request
1458
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1459
+ request_content = @client.serialize(request_mapper, parameters)
1460
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1461
+
1462
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
1463
+
1464
+ request_url = @base_url || @client.base_url
1465
+
1466
+ options = {
1467
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1468
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
1469
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
1470
+ query_params: {'api-version' => api_version},
1471
+ body: request_content,
1472
+ headers: request_headers.merge(custom_headers || {}),
1473
+ base_url: request_url
1474
+ }
1475
+ promise = @client.make_request_async(:put, path_template, options)
1476
+
1477
+ promise = promise.then do |result|
1478
+ http_response = result.response
1479
+ status_code = http_response.status
1480
+ response_content = http_response.body
1481
+ unless status_code == 201 || status_code == 200 || status_code == 202
1482
+ error_model = JSON.load(response_content)
1483
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1484
+ end
1485
+
1486
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1487
+ # Deserialize Response
1488
+ if status_code == 201
1489
+ begin
1490
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1491
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1492
+ result.body = @client.deserialize(result_mapper, parsed_response)
1493
+ rescue Exception => e
1494
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1495
+ end
1496
+ end
1497
+ # Deserialize Response
1498
+ if status_code == 200
1499
+ begin
1500
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1501
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1502
+ result.body = @client.deserialize(result_mapper, parsed_response)
1503
+ rescue Exception => e
1504
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1505
+ end
1506
+ end
1507
+
1508
+ result
1509
+ end
1510
+
1511
+ promise.execute
1512
+ end
1513
+
1514
+ #
1515
+ # Updates a resource.
1516
+ #
1517
+ # @param resource_group_name [String] The name of the resource group for the
1518
+ # resource. The name is case insensitive.
1519
+ # @param resource_provider_namespace [String] The namespace of the resource
1520
+ # provider.
1521
+ # @param parent_resource_path [String] The parent resource identity.
1522
+ # @param resource_type [String] The resource type of the resource to update.
1523
+ # @param resource_name [String] The name of the resource to update.
1524
+ # @param api_version [String] The API version to use for the operation.
1525
+ # @param parameters [GenericResource] Parameters for updating the resource.
1526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1527
+ # will be added to the HTTP request.
1528
+ #
1529
+ # @return [GenericResource] operation results.
1530
+ #
1531
+ def begin_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
1532
+ response = begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
1533
+ response.body unless response.nil?
1534
+ end
1535
+
1536
+ #
1537
+ # Updates a resource.
1538
+ #
1539
+ # @param resource_group_name [String] The name of the resource group for the
1540
+ # resource. The name is case insensitive.
1541
+ # @param resource_provider_namespace [String] The namespace of the resource
1542
+ # provider.
1543
+ # @param parent_resource_path [String] The parent resource identity.
1544
+ # @param resource_type [String] The resource type of the resource to update.
1545
+ # @param resource_name [String] The name of the resource to update.
1546
+ # @param api_version [String] The API version to use for the operation.
1547
+ # @param parameters [GenericResource] Parameters for updating the resource.
1548
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1549
+ # will be added to the HTTP request.
1550
+ #
1551
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1552
+ #
1553
+ def begin_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
1554
+ begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
1555
+ end
1556
+
1557
+ #
1558
+ # Updates a resource.
1559
+ #
1560
+ # @param resource_group_name [String] The name of the resource group for the
1561
+ # resource. The name is case insensitive.
1562
+ # @param resource_provider_namespace [String] The namespace of the resource
1563
+ # provider.
1564
+ # @param parent_resource_path [String] The parent resource identity.
1565
+ # @param resource_type [String] The resource type of the resource to update.
1566
+ # @param resource_name [String] The name of the resource to update.
1567
+ # @param api_version [String] The API version to use for the operation.
1568
+ # @param parameters [GenericResource] Parameters for updating the resource.
1569
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1570
+ # to the HTTP request.
1571
+ #
1572
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1573
+ #
1574
+ def begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
1575
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1576
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1577
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1578
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1579
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
1580
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
1581
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
1582
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1583
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1584
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1585
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1586
+
1587
+
1588
+ request_headers = {}
1589
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1590
+
1591
+ # Set Headers
1592
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1593
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1594
+
1595
+ # Serialize Request
1596
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1597
+ request_content = @client.serialize(request_mapper, parameters)
1598
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1599
+
1600
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
1601
+
1602
+ request_url = @base_url || @client.base_url
1603
+
1604
+ options = {
1605
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1606
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
1607
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
1608
+ query_params: {'api-version' => api_version},
1609
+ body: request_content,
1610
+ headers: request_headers.merge(custom_headers || {}),
1611
+ base_url: request_url
1612
+ }
1613
+ promise = @client.make_request_async(:patch, path_template, options)
1614
+
1615
+ promise = promise.then do |result|
1616
+ http_response = result.response
1617
+ status_code = http_response.status
1618
+ response_content = http_response.body
1619
+ unless status_code == 200 || status_code == 202
1620
+ error_model = JSON.load(response_content)
1621
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1622
+ end
1623
+
1624
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1625
+ # Deserialize Response
1626
+ if status_code == 200
1627
+ begin
1628
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1629
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1630
+ result.body = @client.deserialize(result_mapper, parsed_response)
1631
+ rescue Exception => e
1632
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1633
+ end
1634
+ end
1635
+
1636
+ result
1637
+ end
1638
+
1639
+ promise.execute
1640
+ end
1641
+
1642
+ #
1643
+ # Deletes a resource by ID.
1644
+ #
1645
+ # @param resource_id [String] The fully qualified ID of the resource, including
1646
+ # the resource name and resource type. Use the format,
1647
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1648
+ # @param api_version [String] The API version to use for the operation.
1649
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1650
+ # will be added to the HTTP request.
1651
+ #
1652
+ #
1653
+ def begin_delete_by_id(resource_id, api_version, custom_headers:nil)
1654
+ response = begin_delete_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
1655
+ nil
1656
+ end
1657
+
1658
+ #
1659
+ # Deletes a resource by ID.
1660
+ #
1661
+ # @param resource_id [String] The fully qualified ID of the resource, including
1662
+ # the resource name and resource type. Use the format,
1663
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1664
+ # @param api_version [String] The API version to use for the operation.
1665
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1666
+ # will be added to the HTTP request.
1667
+ #
1668
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1669
+ #
1670
+ def begin_delete_by_id_with_http_info(resource_id, api_version, custom_headers:nil)
1671
+ begin_delete_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
1672
+ end
1673
+
1674
+ #
1675
+ # Deletes a resource by ID.
1676
+ #
1677
+ # @param resource_id [String] The fully qualified ID of the resource, including
1678
+ # the resource name and resource type. Use the format,
1679
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1680
+ # @param api_version [String] The API version to use for the operation.
1681
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1682
+ # to the HTTP request.
1683
+ #
1684
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1685
+ #
1686
+ def begin_delete_by_id_async(resource_id, api_version, custom_headers:nil)
1687
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1688
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1689
+
1690
+
1691
+ request_headers = {}
1692
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1693
+
1694
+ # Set Headers
1695
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1696
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1697
+ path_template = '{resourceId}'
1698
+
1699
+ request_url = @base_url || @client.base_url
1700
+
1701
+ options = {
1702
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1703
+ skip_encoding_path_params: {'resourceId' => resource_id},
1704
+ query_params: {'api-version' => api_version},
1705
+ headers: request_headers.merge(custom_headers || {}),
1706
+ base_url: request_url
1707
+ }
1708
+ promise = @client.make_request_async(:delete, path_template, options)
1709
+
1710
+ promise = promise.then do |result|
1711
+ http_response = result.response
1712
+ status_code = http_response.status
1713
+ response_content = http_response.body
1714
+ unless status_code == 200 || status_code == 204 || status_code == 202
1715
+ error_model = JSON.load(response_content)
1716
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1717
+ end
1718
+
1719
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1720
+
1721
+ result
1722
+ end
1723
+
1724
+ promise.execute
1725
+ end
1726
+
1727
+ #
1728
+ # Create a resource by ID.
1729
+ #
1730
+ # @param resource_id [String] The fully qualified ID of the resource, including
1731
+ # the resource name and resource type. Use the format,
1732
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1733
+ # @param api_version [String] The API version to use for the operation.
1734
+ # @param parameters [GenericResource] Create or update resource parameters.
1735
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1736
+ # will be added to the HTTP request.
1737
+ #
1738
+ # @return [GenericResource] operation results.
1739
+ #
1740
+ def begin_create_or_update_by_id(resource_id, api_version, parameters, custom_headers:nil)
1741
+ response = begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
1742
+ response.body unless response.nil?
1743
+ end
1744
+
1745
+ #
1746
+ # Create a resource by ID.
1747
+ #
1748
+ # @param resource_id [String] The fully qualified ID of the resource, including
1749
+ # the resource name and resource type. Use the format,
1750
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1751
+ # @param api_version [String] The API version to use for the operation.
1752
+ # @param parameters [GenericResource] Create or update resource parameters.
1753
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1754
+ # will be added to the HTTP request.
1755
+ #
1756
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1757
+ #
1758
+ def begin_create_or_update_by_id_with_http_info(resource_id, api_version, parameters, custom_headers:nil)
1759
+ begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
1760
+ end
1761
+
1762
+ #
1763
+ # Create a resource by ID.
1764
+ #
1765
+ # @param resource_id [String] The fully qualified ID of the resource, including
1766
+ # the resource name and resource type. Use the format,
1767
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1768
+ # @param api_version [String] The API version to use for the operation.
1769
+ # @param parameters [GenericResource] Create or update resource parameters.
1770
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1771
+ # to the HTTP request.
1772
+ #
1773
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1774
+ #
1775
+ def begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
1776
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1777
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1778
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1779
+
1780
+
1781
+ request_headers = {}
1782
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1783
+
1784
+ # Set Headers
1785
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1786
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1787
+
1788
+ # Serialize Request
1789
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1790
+ request_content = @client.serialize(request_mapper, parameters)
1791
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1792
+
1793
+ path_template = '{resourceId}'
1794
+
1795
+ request_url = @base_url || @client.base_url
1796
+
1797
+ options = {
1798
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1799
+ skip_encoding_path_params: {'resourceId' => resource_id},
1800
+ query_params: {'api-version' => api_version},
1801
+ body: request_content,
1802
+ headers: request_headers.merge(custom_headers || {}),
1803
+ base_url: request_url
1804
+ }
1805
+ promise = @client.make_request_async(:put, path_template, options)
1806
+
1807
+ promise = promise.then do |result|
1808
+ http_response = result.response
1809
+ status_code = http_response.status
1810
+ response_content = http_response.body
1811
+ unless status_code == 201 || status_code == 200 || status_code == 202
1812
+ error_model = JSON.load(response_content)
1813
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1814
+ end
1815
+
1816
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1817
+ # Deserialize Response
1818
+ if status_code == 201
1819
+ begin
1820
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1821
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1822
+ result.body = @client.deserialize(result_mapper, parsed_response)
1823
+ rescue Exception => e
1824
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1825
+ end
1826
+ end
1827
+ # Deserialize Response
1828
+ if status_code == 200
1829
+ begin
1830
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1831
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1832
+ result.body = @client.deserialize(result_mapper, parsed_response)
1833
+ rescue Exception => e
1834
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1835
+ end
1836
+ end
1837
+
1838
+ result
1839
+ end
1840
+
1841
+ promise.execute
1842
+ end
1843
+
1844
+ #
1845
+ # Updates a resource by ID.
1846
+ #
1847
+ # @param resource_id [String] The fully qualified ID of the resource, including
1848
+ # the resource name and resource type. Use the format,
1849
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1850
+ # @param api_version [String] The API version to use for the operation.
1851
+ # @param parameters [GenericResource] Update resource parameters.
1852
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1853
+ # will be added to the HTTP request.
1854
+ #
1855
+ # @return [GenericResource] operation results.
1856
+ #
1857
+ def begin_update_by_id(resource_id, api_version, parameters, custom_headers:nil)
1858
+ response = begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
1859
+ response.body unless response.nil?
1860
+ end
1861
+
1862
+ #
1863
+ # Updates a resource by ID.
1864
+ #
1865
+ # @param resource_id [String] The fully qualified ID of the resource, including
1866
+ # the resource name and resource type. Use the format,
1867
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1868
+ # @param api_version [String] The API version to use for the operation.
1869
+ # @param parameters [GenericResource] Update resource parameters.
1870
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1871
+ # will be added to the HTTP request.
1872
+ #
1873
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1874
+ #
1875
+ def begin_update_by_id_with_http_info(resource_id, api_version, parameters, custom_headers:nil)
1876
+ begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
1877
+ end
1878
+
1879
+ #
1880
+ # Updates a resource by ID.
1881
+ #
1882
+ # @param resource_id [String] The fully qualified ID of the resource, including
1883
+ # the resource name and resource type. Use the format,
1884
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1885
+ # @param api_version [String] The API version to use for the operation.
1886
+ # @param parameters [GenericResource] Update resource parameters.
1887
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1888
+ # to the HTTP request.
1889
+ #
1890
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1891
+ #
1892
+ def begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
1893
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1894
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1895
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1896
+
1897
+
1898
+ request_headers = {}
1899
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1900
+
1901
+ # Set Headers
1902
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1903
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1904
+
1905
+ # Serialize Request
1906
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1907
+ request_content = @client.serialize(request_mapper, parameters)
1908
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1909
+
1910
+ path_template = '{resourceId}'
1911
+
1912
+ request_url = @base_url || @client.base_url
1913
+
1914
+ options = {
1915
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1916
+ skip_encoding_path_params: {'resourceId' => resource_id},
1917
+ query_params: {'api-version' => api_version},
1918
+ body: request_content,
1919
+ headers: request_headers.merge(custom_headers || {}),
1920
+ base_url: request_url
1921
+ }
1922
+ promise = @client.make_request_async(:patch, path_template, options)
1923
+
1924
+ promise = promise.then do |result|
1925
+ http_response = result.response
1926
+ status_code = http_response.status
1927
+ response_content = http_response.body
1928
+ unless status_code == 200 || status_code == 202
1929
+ error_model = JSON.load(response_content)
1930
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1931
+ end
1932
+
1933
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1934
+ # Deserialize Response
1935
+ if status_code == 200
1936
+ begin
1937
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1938
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::GenericResource.mapper()
1939
+ result.body = @client.deserialize(result_mapper, parsed_response)
1940
+ rescue Exception => e
1941
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1942
+ end
1943
+ end
1944
+
1945
+ result
1946
+ end
1947
+
1948
+ promise.execute
1949
+ end
1950
+
1951
+ #
1952
+ # Get all the resources for a resource group.
1953
+ #
1954
+ # @param next_page_link [String] The NextLink from the previous successful call
1955
+ # to List operation.
1956
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1957
+ # will be added to the HTTP request.
1958
+ #
1959
+ # @return [ResourceListResult] operation results.
1960
+ #
1961
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
1962
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1963
+ response.body unless response.nil?
1964
+ end
1965
+
1966
+ #
1967
+ # Get all the resources for a resource group.
1968
+ #
1969
+ # @param next_page_link [String] The NextLink from the previous successful call
1970
+ # to List operation.
1971
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1972
+ # will be added to the HTTP request.
1973
+ #
1974
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1975
+ #
1976
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1977
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1978
+ end
1979
+
1980
+ #
1981
+ # Get all the resources for a resource group.
1982
+ #
1983
+ # @param next_page_link [String] The NextLink from the previous successful call
1984
+ # to List operation.
1985
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1986
+ # to the HTTP request.
1987
+ #
1988
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1989
+ #
1990
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1991
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1992
+
1993
+
1994
+ request_headers = {}
1995
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1996
+
1997
+ # Set Headers
1998
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1999
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2000
+ path_template = '{nextLink}'
2001
+
2002
+ request_url = @base_url || @client.base_url
2003
+
2004
+ options = {
2005
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2006
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2007
+ headers: request_headers.merge(custom_headers || {}),
2008
+ base_url: request_url
2009
+ }
2010
+ promise = @client.make_request_async(:get, path_template, options)
2011
+
2012
+ promise = promise.then do |result|
2013
+ http_response = result.response
2014
+ status_code = http_response.status
2015
+ response_content = http_response.body
2016
+ unless status_code == 200
2017
+ error_model = JSON.load(response_content)
2018
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2019
+ end
2020
+
2021
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2022
+ # Deserialize Response
2023
+ if status_code == 200
2024
+ begin
2025
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2026
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::ResourceListResult.mapper()
2027
+ result.body = @client.deserialize(result_mapper, parsed_response)
2028
+ rescue Exception => e
2029
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2030
+ end
2031
+ end
2032
+
2033
+ result
2034
+ end
2035
+
2036
+ promise.execute
2037
+ end
2038
+
2039
+ #
2040
+ # Get all the resources in a subscription.
2041
+ #
2042
+ # @param next_page_link [String] The NextLink from the previous successful call
2043
+ # to List operation.
2044
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2045
+ # will be added to the HTTP request.
2046
+ #
2047
+ # @return [ResourceListResult] operation results.
2048
+ #
2049
+ def list_next(next_page_link, custom_headers:nil)
2050
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
2051
+ response.body unless response.nil?
2052
+ end
2053
+
2054
+ #
2055
+ # Get all the resources in a subscription.
2056
+ #
2057
+ # @param next_page_link [String] The NextLink from the previous successful call
2058
+ # to List operation.
2059
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2060
+ # will be added to the HTTP request.
2061
+ #
2062
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2063
+ #
2064
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
2065
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
2066
+ end
2067
+
2068
+ #
2069
+ # Get all the resources in a subscription.
2070
+ #
2071
+ # @param next_page_link [String] The NextLink from the previous successful call
2072
+ # to List operation.
2073
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2074
+ # to the HTTP request.
2075
+ #
2076
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2077
+ #
2078
+ def list_next_async(next_page_link, custom_headers:nil)
2079
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2080
+
2081
+
2082
+ request_headers = {}
2083
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2084
+
2085
+ # Set Headers
2086
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2087
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2088
+ path_template = '{nextLink}'
2089
+
2090
+ request_url = @base_url || @client.base_url
2091
+
2092
+ options = {
2093
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2094
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2095
+ headers: request_headers.merge(custom_headers || {}),
2096
+ base_url: request_url
2097
+ }
2098
+ promise = @client.make_request_async(:get, path_template, options)
2099
+
2100
+ promise = promise.then do |result|
2101
+ http_response = result.response
2102
+ status_code = http_response.status
2103
+ response_content = http_response.body
2104
+ unless status_code == 200
2105
+ error_model = JSON.load(response_content)
2106
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2107
+ end
2108
+
2109
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2110
+ # Deserialize Response
2111
+ if status_code == 200
2112
+ begin
2113
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2114
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::ResourceListResult.mapper()
2115
+ result.body = @client.deserialize(result_mapper, parsed_response)
2116
+ rescue Exception => e
2117
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2118
+ end
2119
+ end
2120
+
2121
+ result
2122
+ end
2123
+
2124
+ promise.execute
2125
+ end
2126
+
2127
+ #
2128
+ # Get all the resources for a resource group.
2129
+ #
2130
+ # @param resource_group_name [String] The resource group with the resources to
2131
+ # get.
2132
+ # @param filter [String] The filter to apply on the operation.
2133
+ # @param expand [String] The $expand query parameter
2134
+ # @param top [Integer] The number of results to return. If null is passed,
2135
+ # returns all resources.
2136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2137
+ # will be added to the HTTP request.
2138
+ #
2139
+ # @return [ResourceListResult] which provide lazy access to pages of the
2140
+ # response.
2141
+ #
2142
+ def list_by_resource_group_as_lazy(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
2143
+ response = list_by_resource_group_async(resource_group_name, filter:filter, expand:expand, top:top, custom_headers:custom_headers).value!
2144
+ unless response.nil?
2145
+ page = response.body
2146
+ page.next_method = Proc.new do |next_page_link|
2147
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
2148
+ end
2149
+ page
2150
+ end
2151
+ end
2152
+
2153
+ #
2154
+ # Get all the resources in a subscription.
2155
+ #
2156
+ # @param filter [String] The filter to apply on the operation.
2157
+ # @param expand [String] The $expand query parameter.
2158
+ # @param top [Integer] The number of results to return. If null is passed,
2159
+ # returns all resource groups.
2160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2161
+ # will be added to the HTTP request.
2162
+ #
2163
+ # @return [ResourceListResult] which provide lazy access to pages of the
2164
+ # response.
2165
+ #
2166
+ def list_as_lazy(filter:nil, expand:nil, top:nil, custom_headers:nil)
2167
+ response = list_async(filter:filter, expand:expand, top:top, custom_headers:custom_headers).value!
2168
+ unless response.nil?
2169
+ page = response.body
2170
+ page.next_method = Proc.new do |next_page_link|
2171
+ list_next_async(next_page_link, custom_headers:custom_headers)
2172
+ end
2173
+ page
2174
+ end
2175
+ end
2176
+
2177
+ end
2178
+ end