azure_mgmt_resources 0.18.0 → 0.18.1

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