azure_mgmt_container_instance 0.17.6 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-08-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  3. data/lib/2017-10-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  5. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  6. data/lib/2018-04-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  7. data/lib/2018-06-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  8. data/lib/2018-09-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  9. data/lib/2018-10-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  10. data/lib/2019-12-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +1 -1
  11. data/lib/2020-11-01/generated/azure_mgmt_container_instance.rb +92 -0
  12. data/lib/2020-11-01/generated/azure_mgmt_container_instance/container_groups.rb +1404 -0
  13. data/lib/2020-11-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +145 -0
  14. data/lib/2020-11-01/generated/azure_mgmt_container_instance/containers.rb +375 -0
  15. data/lib/2020-11-01/generated/azure_mgmt_container_instance/location.rb +552 -0
  16. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/azure_file_volume.rb +84 -0
  17. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/cached_images.rb +57 -0
  18. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/cached_images_list_result.rb +98 -0
  19. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/capabilities.rb +108 -0
  20. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/capabilities_capabilities.rb +71 -0
  21. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/capabilities_list_result.rb +98 -0
  22. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container.rb +192 -0
  23. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_attach_response.rb +59 -0
  24. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_exec.rb +54 -0
  25. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_exec_request.rb +58 -0
  26. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_exec_request_terminal_size.rb +57 -0
  27. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_exec_response.rb +57 -0
  28. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group.rb +314 -0
  29. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_diagnostics.rb +47 -0
  30. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_identity.rb +102 -0
  31. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_identity_user_assigned_identities_value.rb +61 -0
  32. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_ip_address_type.rb +16 -0
  33. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_list_result.rb +99 -0
  34. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_network_profile.rb +46 -0
  35. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb +16 -0
  36. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_properties_instance_view.rb +69 -0
  37. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_restart_policy.rb +17 -0
  38. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_group_sku.rb +16 -0
  39. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_http_get.rb +80 -0
  40. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_instance_operations_origin.rb +16 -0
  41. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_network_protocol.rb +16 -0
  42. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_port.rb +58 -0
  43. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_probe.rb +114 -0
  44. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb +95 -0
  45. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/container_state.rb +99 -0
  46. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/dns_configuration.rb +77 -0
  47. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/encryption_properties.rb +68 -0
  48. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/environment_variable.rb +68 -0
  49. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/event.rb +107 -0
  50. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/git_repo_volume.rb +72 -0
  51. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/gpu_resource.rb +58 -0
  52. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/gpu_sku.rb +17 -0
  53. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/http_headers.rb +57 -0
  54. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/image_registry_credential.rb +69 -0
  55. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/init_container_definition.rb +133 -0
  56. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/init_container_properties_definition_instance_view.rb +96 -0
  57. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/ip_address.rb +102 -0
  58. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/log_analytics.rb +108 -0
  59. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/log_analytics_log_type.rb +16 -0
  60. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/logs.rb +46 -0
  61. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/operating_system_types.rb +16 -0
  62. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/operation.rb +81 -0
  63. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/operation_display.rb +79 -0
  64. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/operation_list_result.rb +99 -0
  65. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/port.rb +58 -0
  66. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/resource.rb +110 -0
  67. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/resource_identity_type.rb +18 -0
  68. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/resource_limits.rb +69 -0
  69. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/resource_requests.rb +69 -0
  70. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/resource_requirements.rb +61 -0
  71. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/scheme.rb +16 -0
  72. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/usage.rb +84 -0
  73. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/usage_list_result.rb +56 -0
  74. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/usage_name.rb +59 -0
  75. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/volume.rb +100 -0
  76. data/lib/2020-11-01/generated/azure_mgmt_container_instance/models/volume_mount.rb +70 -0
  77. data/lib/2020-11-01/generated/azure_mgmt_container_instance/module_definition.rb +9 -0
  78. data/lib/2020-11-01/generated/azure_mgmt_container_instance/operations.rb +219 -0
  79. data/lib/azure_mgmt_container_instance.rb +6 -5
  80. data/lib/profiles/latest/modules/containerinstance_profile_module.rb +149 -141
  81. data/lib/version.rb +1 -1
  82. metadata +71 -3
@@ -0,0 +1,145 @@
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::ContainerInstance::Mgmt::V2020_11_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ContainerInstanceManagementClient < 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] Subscription credentials which uniquely identify
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client API version
26
+ attr_reader :api_version
27
+
28
+ # @return [String] The preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] The retry timeout in seconds for Long Running
32
+ # Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
36
+ # generated. When set to true a unique x-ms-client-request-id value is
37
+ # generated and included in each request. Default is true.
38
+ attr_accessor :generate_client_request_id
39
+
40
+ # @return [ContainerGroups] container_groups
41
+ attr_reader :container_groups
42
+
43
+ # @return [Operations] operations
44
+ attr_reader :operations
45
+
46
+ # @return [Location] location
47
+ attr_reader :location
48
+
49
+ # @return [Containers] containers
50
+ attr_reader :containers
51
+
52
+ #
53
+ # Creates initializes a new instance of the ContainerInstanceManagementClient class.
54
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
55
+ # @param base_url [String] the base URI of the service.
56
+ # @param options [Array] filters to be applied to the HTTP requests.
57
+ #
58
+ def initialize(credentials = nil, base_url = nil, options = nil)
59
+ super(credentials, options)
60
+ @base_url = base_url || 'https://management.azure.com'
61
+
62
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
63
+ @credentials = credentials
64
+
65
+ @container_groups = ContainerGroups.new(self)
66
+ @operations = Operations.new(self)
67
+ @location = Location.new(self)
68
+ @containers = Containers.new(self)
69
+ @api_version = '2020-11-01'
70
+ @accept_language = 'en-US'
71
+ @long_running_operation_retry_timeout = 30
72
+ @generate_client_request_id = true
73
+ add_telemetry
74
+ end
75
+
76
+ #
77
+ # Makes a request and returns the body of the response.
78
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
79
+ # @param path [String] the path, relative to {base_url}.
80
+ # @param options [Hash{String=>String}] specifying any request options like :body.
81
+ # @return [Hash{String=>String}] containing the body of the response.
82
+ # Example:
83
+ #
84
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
85
+ # path = "/path"
86
+ # options = {
87
+ # body: request_content,
88
+ # query_params: {'api-version' => '2016-02-01'}
89
+ # }
90
+ # result = @client.make_request(:put, path, options)
91
+ #
92
+ def make_request(method, path, options = {})
93
+ result = make_request_with_http_info(method, path, options)
94
+ result.body unless result.nil?
95
+ end
96
+
97
+ #
98
+ # Makes a request and returns the operation response.
99
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
100
+ # @param path [String] the path, relative to {base_url}.
101
+ # @param options [Hash{String=>String}] specifying any request options like :body.
102
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
103
+ #
104
+ def make_request_with_http_info(method, path, options = {})
105
+ result = make_request_async(method, path, options).value!
106
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
107
+ result
108
+ end
109
+
110
+ #
111
+ # Makes a request asynchronously.
112
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
113
+ # @param path [String] the path, relative to {base_url}.
114
+ # @param options [Hash{String=>String}] specifying any request options like :body.
115
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
116
+ #
117
+ def make_request_async(method, path, options = {})
118
+ fail ArgumentError, 'method is nil' if method.nil?
119
+ fail ArgumentError, 'path is nil' if path.nil?
120
+
121
+ request_url = options[:base_url] || @base_url
122
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
123
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
124
+ end
125
+
126
+ request_headers = @request_headers
127
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
128
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
129
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
130
+
131
+ super(request_url, method, path, options)
132
+ end
133
+
134
+
135
+ private
136
+ #
137
+ # Adds telemetry information.
138
+ #
139
+ def add_telemetry
140
+ sdk_information = 'azure_mgmt_container_instance'
141
+ sdk_information = "#{sdk_information}/0.18.0"
142
+ add_user_agent_information(sdk_information)
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,375 @@
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::ContainerInstance::Mgmt::V2020_11_01
7
+ #
8
+ # Containers
9
+ #
10
+ class Containers
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Containers class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ContainerInstanceManagementClient] reference to the ContainerInstanceManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get the logs for a specified container instance.
26
+ #
27
+ # Get the logs for a specified container instance in a specified resource group
28
+ # and container group.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group.
31
+ # @param container_group_name [String] The name of the container group.
32
+ # @param container_name [String] The name of the container instance.
33
+ # @param tail [Integer] The number of lines to show from the tail of the
34
+ # container instance log. If not provided, all available logs are shown up to
35
+ # 4mb.
36
+ # @param timestamps [Boolean] If true, adds a timestamp at the beginning of
37
+ # every line of log output. If not provided, defaults to false.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [Logs] operation results.
42
+ #
43
+ def list_logs(resource_group_name, container_group_name, container_name, tail:nil, timestamps:nil, custom_headers:nil)
44
+ response = list_logs_async(resource_group_name, container_group_name, container_name, tail:tail, timestamps:timestamps, custom_headers:custom_headers).value!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Get the logs for a specified container instance.
50
+ #
51
+ # Get the logs for a specified container instance in a specified resource group
52
+ # and container group.
53
+ #
54
+ # @param resource_group_name [String] The name of the resource group.
55
+ # @param container_group_name [String] The name of the container group.
56
+ # @param container_name [String] The name of the container instance.
57
+ # @param tail [Integer] The number of lines to show from the tail of the
58
+ # container instance log. If not provided, all available logs are shown up to
59
+ # 4mb.
60
+ # @param timestamps [Boolean] If true, adds a timestamp at the beginning of
61
+ # every line of log output. If not provided, defaults to false.
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
+ #
67
+ def list_logs_with_http_info(resource_group_name, container_group_name, container_name, tail:nil, timestamps:nil, custom_headers:nil)
68
+ list_logs_async(resource_group_name, container_group_name, container_name, tail:tail, timestamps:timestamps, custom_headers:custom_headers).value!
69
+ end
70
+
71
+ #
72
+ # Get the logs for a specified container instance.
73
+ #
74
+ # Get the logs for a specified container instance in a specified resource group
75
+ # and container group.
76
+ #
77
+ # @param resource_group_name [String] The name of the resource group.
78
+ # @param container_group_name [String] The name of the container group.
79
+ # @param container_name [String] The name of the container instance.
80
+ # @param tail [Integer] The number of lines to show from the tail of the
81
+ # container instance log. If not provided, all available logs are shown up to
82
+ # 4mb.
83
+ # @param timestamps [Boolean] If true, adds a timestamp at the beginning of
84
+ # every line of log output. If not provided, defaults to false.
85
+ # @param [Hash{String => String}] A hash of custom headers that will be added
86
+ # to the HTTP request.
87
+ #
88
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
89
+ #
90
+ def list_logs_async(resource_group_name, container_group_name, container_name, tail:nil, timestamps:nil, custom_headers:nil)
91
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
92
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
93
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
94
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
95
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
96
+
97
+
98
+ request_headers = {}
99
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
100
+
101
+ # Set Headers
102
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
103
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
104
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs'
105
+
106
+ request_url = @base_url || @client.base_url
107
+
108
+ options = {
109
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
110
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name,'containerName' => container_name},
111
+ query_params: {'api-version' => @client.api_version,'tail' => tail,'timestamps' => timestamps},
112
+ headers: request_headers.merge(custom_headers || {}),
113
+ base_url: request_url
114
+ }
115
+ promise = @client.make_request_async(:get, path_template, options)
116
+
117
+ promise = promise.then do |result|
118
+ http_response = result.response
119
+ status_code = http_response.status
120
+ response_content = http_response.body
121
+ unless status_code == 200
122
+ error_model = JSON.load(response_content)
123
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
124
+ end
125
+
126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
127
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
128
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
129
+ # Deserialize Response
130
+ if status_code == 200
131
+ begin
132
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
133
+ result_mapper = Azure::ContainerInstance::Mgmt::V2020_11_01::Models::Logs.mapper()
134
+ result.body = @client.deserialize(result_mapper, parsed_response)
135
+ rescue Exception => e
136
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
137
+ end
138
+ end
139
+
140
+ result
141
+ end
142
+
143
+ promise.execute
144
+ end
145
+
146
+ #
147
+ # Executes a command in a specific container instance.
148
+ #
149
+ # Executes a command for a specific container instance in a specified resource
150
+ # group and container group.
151
+ #
152
+ # @param resource_group_name [String] The name of the resource group.
153
+ # @param container_group_name [String] The name of the container group.
154
+ # @param container_name [String] The name of the container instance.
155
+ # @param container_exec_request [ContainerExecRequest] The request for the exec
156
+ # command.
157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
158
+ # will be added to the HTTP request.
159
+ #
160
+ # @return [ContainerExecResponse] operation results.
161
+ #
162
+ def execute_command(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
163
+ response = execute_command_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:custom_headers).value!
164
+ response.body unless response.nil?
165
+ end
166
+
167
+ #
168
+ # Executes a command in a specific container instance.
169
+ #
170
+ # Executes a command for a specific container instance in a specified resource
171
+ # group and container group.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group.
174
+ # @param container_group_name [String] The name of the container group.
175
+ # @param container_name [String] The name of the container instance.
176
+ # @param container_exec_request [ContainerExecRequest] The request for the exec
177
+ # command.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
182
+ #
183
+ def execute_command_with_http_info(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
184
+ execute_command_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:custom_headers).value!
185
+ end
186
+
187
+ #
188
+ # Executes a command in a specific container instance.
189
+ #
190
+ # Executes a command for a specific container instance in a specified resource
191
+ # group and container group.
192
+ #
193
+ # @param resource_group_name [String] The name of the resource group.
194
+ # @param container_group_name [String] The name of the container group.
195
+ # @param container_name [String] The name of the container instance.
196
+ # @param container_exec_request [ContainerExecRequest] The request for the exec
197
+ # command.
198
+ # @param [Hash{String => String}] A hash of custom headers that will be added
199
+ # to the HTTP request.
200
+ #
201
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
202
+ #
203
+ def execute_command_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
204
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
205
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
206
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
207
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
208
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
209
+ fail ArgumentError, 'container_exec_request is nil' if container_exec_request.nil?
210
+
211
+
212
+ request_headers = {}
213
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
214
+
215
+ # Set Headers
216
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
217
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
218
+
219
+ # Serialize Request
220
+ request_mapper = Azure::ContainerInstance::Mgmt::V2020_11_01::Models::ContainerExecRequest.mapper()
221
+ request_content = @client.serialize(request_mapper, container_exec_request)
222
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
223
+
224
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'
225
+
226
+ request_url = @base_url || @client.base_url
227
+
228
+ options = {
229
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
230
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name,'containerName' => container_name},
231
+ query_params: {'api-version' => @client.api_version},
232
+ body: request_content,
233
+ headers: request_headers.merge(custom_headers || {}),
234
+ base_url: request_url
235
+ }
236
+ promise = @client.make_request_async(:post, path_template, options)
237
+
238
+ promise = promise.then do |result|
239
+ http_response = result.response
240
+ status_code = http_response.status
241
+ response_content = http_response.body
242
+ unless status_code == 200
243
+ error_model = JSON.load(response_content)
244
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
245
+ end
246
+
247
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
248
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
249
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
250
+ # Deserialize Response
251
+ if status_code == 200
252
+ begin
253
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
254
+ result_mapper = Azure::ContainerInstance::Mgmt::V2020_11_01::Models::ContainerExecResponse.mapper()
255
+ result.body = @client.deserialize(result_mapper, parsed_response)
256
+ rescue Exception => e
257
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
258
+ end
259
+ end
260
+
261
+ result
262
+ end
263
+
264
+ promise.execute
265
+ end
266
+
267
+ #
268
+ # Attach to the output of a specific container instance.
269
+ #
270
+ # Attach to the output stream of a specific container instance in a specified
271
+ # resource group and container group.
272
+ #
273
+ # @param resource_group_name [String] The name of the resource group.
274
+ # @param container_group_name [String] The name of the container group.
275
+ # @param container_name [String] The name of the container instance.
276
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
277
+ # will be added to the HTTP request.
278
+ #
279
+ # @return [ContainerAttachResponse] operation results.
280
+ #
281
+ def attach(resource_group_name, container_group_name, container_name, custom_headers:nil)
282
+ response = attach_async(resource_group_name, container_group_name, container_name, custom_headers:custom_headers).value!
283
+ response.body unless response.nil?
284
+ end
285
+
286
+ #
287
+ # Attach to the output of a specific container instance.
288
+ #
289
+ # Attach to the output stream of a specific container instance in a specified
290
+ # resource group and container group.
291
+ #
292
+ # @param resource_group_name [String] The name of the resource group.
293
+ # @param container_group_name [String] The name of the container group.
294
+ # @param container_name [String] The name of the container instance.
295
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
296
+ # will be added to the HTTP request.
297
+ #
298
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
299
+ #
300
+ def attach_with_http_info(resource_group_name, container_group_name, container_name, custom_headers:nil)
301
+ attach_async(resource_group_name, container_group_name, container_name, custom_headers:custom_headers).value!
302
+ end
303
+
304
+ #
305
+ # Attach to the output of a specific container instance.
306
+ #
307
+ # Attach to the output stream of a specific container instance in a specified
308
+ # resource group and container group.
309
+ #
310
+ # @param resource_group_name [String] The name of the resource group.
311
+ # @param container_group_name [String] The name of the container group.
312
+ # @param container_name [String] The name of the container instance.
313
+ # @param [Hash{String => String}] A hash of custom headers that will be added
314
+ # to the HTTP request.
315
+ #
316
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
317
+ #
318
+ def attach_async(resource_group_name, container_group_name, container_name, custom_headers:nil)
319
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
320
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
321
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
322
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
323
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
324
+
325
+
326
+ request_headers = {}
327
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
328
+
329
+ # Set Headers
330
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
331
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
332
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach'
333
+
334
+ request_url = @base_url || @client.base_url
335
+
336
+ options = {
337
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
338
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name,'containerName' => container_name},
339
+ query_params: {'api-version' => @client.api_version},
340
+ headers: request_headers.merge(custom_headers || {}),
341
+ base_url: request_url
342
+ }
343
+ promise = @client.make_request_async(:post, path_template, options)
344
+
345
+ promise = promise.then do |result|
346
+ http_response = result.response
347
+ status_code = http_response.status
348
+ response_content = http_response.body
349
+ unless status_code == 200
350
+ error_model = JSON.load(response_content)
351
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
352
+ end
353
+
354
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
355
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
356
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
357
+ # Deserialize Response
358
+ if status_code == 200
359
+ begin
360
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
361
+ result_mapper = Azure::ContainerInstance::Mgmt::V2020_11_01::Models::ContainerAttachResponse.mapper()
362
+ result.body = @client.deserialize(result_mapper, parsed_response)
363
+ rescue Exception => e
364
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
365
+ end
366
+ end
367
+
368
+ result
369
+ end
370
+
371
+ promise.execute
372
+ end
373
+
374
+ end
375
+ end