azure_mgmt_container_instance 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-08-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +7 -6
  3. data/lib/2017-10-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +7 -6
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +7 -6
  5. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance.rb +18 -14
  6. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/container_groups.rb +120 -71
  7. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/container_instance_management_client.rb +11 -6
  8. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/models/container_exec_request.rb +58 -0
  9. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/models/container_exec_request_terminal_size.rb +57 -0
  10. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/models/container_exec_response.rb +57 -0
  11. data/lib/2018-02-01-preview/generated/azure_mgmt_container_instance/start_container.rb +144 -0
  12. data/lib/2018-04-01/generated/azure_mgmt_container_instance.rb +67 -0
  13. data/lib/2018-04-01/generated/azure_mgmt_container_instance/container_group_usage.rb +113 -0
  14. data/lib/2018-04-01/generated/azure_mgmt_container_instance/container_groups.rb +984 -0
  15. data/lib/2018-04-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +149 -0
  16. data/lib/2018-04-01/generated/azure_mgmt_container_instance/container_logs.rb +139 -0
  17. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/azure_file_volume.rb +84 -0
  18. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container.rb +168 -0
  19. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_exec_request.rb +58 -0
  20. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_exec_request_terminal_size.rb +57 -0
  21. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_exec_response.rb +59 -0
  22. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_group.rb +216 -0
  23. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_group_list_result.rb +99 -0
  24. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb +16 -0
  25. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_group_properties_instance_view.rb +69 -0
  26. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_group_restart_policy.rb +17 -0
  27. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_instance_operations_origin.rb +16 -0
  28. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_network_protocol.rb +16 -0
  29. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_port.rb +58 -0
  30. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb +95 -0
  31. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/container_state.rb +99 -0
  32. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/environment_variable.rb +57 -0
  33. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/event.rb +107 -0
  34. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/git_repo_volume.rb +72 -0
  35. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/image_registry_credential.rb +69 -0
  36. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/ip_address.rb +103 -0
  37. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/logs.rb +47 -0
  38. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/operating_system_types.rb +16 -0
  39. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/operation.rb +72 -0
  40. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/operation_display.rb +83 -0
  41. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/operation_list_result.rb +67 -0
  42. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/port.rb +58 -0
  43. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/resource.rb +101 -0
  44. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/resource_limits.rb +57 -0
  45. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/resource_requests.rb +57 -0
  46. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/resource_requirements.rb +61 -0
  47. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/usage.rb +84 -0
  48. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/usage_list_result.rb +56 -0
  49. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/usage_name.rb +59 -0
  50. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/volume.rb +100 -0
  51. data/lib/2018-04-01/generated/azure_mgmt_container_instance/models/volume_mount.rb +70 -0
  52. data/lib/2018-04-01/generated/azure_mgmt_container_instance/module_definition.rb +9 -0
  53. data/lib/2018-04-01/generated/azure_mgmt_container_instance/operations.rb +107 -0
  54. data/lib/2018-04-01/generated/azure_mgmt_container_instance/start_container.rb +144 -0
  55. data/lib/2018-06-01/generated/azure_mgmt_container_instance.rb +71 -0
  56. data/lib/2018-06-01/generated/azure_mgmt_container_instance/container_group_usage.rb +113 -0
  57. data/lib/2018-06-01/generated/azure_mgmt_container_instance/container_groups.rb +984 -0
  58. data/lib/2018-06-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb +145 -0
  59. data/lib/2018-06-01/generated/azure_mgmt_container_instance/container_operations.rb +258 -0
  60. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/azure_file_volume.rb +84 -0
  61. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container.rb +192 -0
  62. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_exec.rb +54 -0
  63. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_exec_request.rb +58 -0
  64. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_exec_request_terminal_size.rb +57 -0
  65. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_exec_response.rb +57 -0
  66. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_group.rb +229 -0
  67. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_group_diagnostics.rb +47 -0
  68. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_group_list_result.rb +99 -0
  69. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb +16 -0
  70. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_group_properties_instance_view.rb +69 -0
  71. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_group_restart_policy.rb +17 -0
  72. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_http_get.rb +68 -0
  73. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_instance_operations_origin.rb +16 -0
  74. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_network_protocol.rb +16 -0
  75. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_port.rb +58 -0
  76. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_probe.rb +114 -0
  77. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb +95 -0
  78. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/container_state.rb +94 -0
  79. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/environment_variable.rb +68 -0
  80. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/event.rb +101 -0
  81. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/git_repo_volume.rb +72 -0
  82. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/image_registry_credential.rb +69 -0
  83. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/ip_address.rb +103 -0
  84. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/log_analytics.rb +57 -0
  85. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/logs.rb +46 -0
  86. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/operating_system_types.rb +16 -0
  87. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/operation.rb +70 -0
  88. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/operation_display.rb +79 -0
  89. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/operation_list_result.rb +67 -0
  90. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/port.rb +58 -0
  91. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/resource.rb +101 -0
  92. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/resource_limits.rb +57 -0
  93. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/resource_requests.rb +57 -0
  94. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/resource_requirements.rb +61 -0
  95. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/usage.rb +84 -0
  96. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/usage_list_result.rb +56 -0
  97. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/usage_name.rb +59 -0
  98. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/volume.rb +100 -0
  99. data/lib/2018-06-01/generated/azure_mgmt_container_instance/models/volume_mount.rb +70 -0
  100. data/lib/2018-06-01/generated/azure_mgmt_container_instance/module_definition.rb +9 -0
  101. data/lib/2018-06-01/generated/azure_mgmt_container_instance/operations.rb +107 -0
  102. data/lib/azure_mgmt_container_instance.rb +3 -1
  103. data/lib/profiles/latest/modules/containerinstance_profile_module.rb +116 -84
  104. data/lib/version.rb +1 -1
  105. metadata +98 -4
@@ -0,0 +1,144 @@
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::V2018_04_01
7
+ #
8
+ # StartContainer
9
+ #
10
+ class StartContainer
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the StartContainer 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
+ # Starts the exec command for a specific container instance.
26
+ #
27
+ # Starts the exec command for a specified container instance in a specified
28
+ # resource group 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 container_exec_request [ContainerExecRequest] The request for the exec
34
+ # command.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [ContainerExecResponse] operation results.
39
+ #
40
+ def launch_exec(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
41
+ response = launch_exec_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Starts the exec command for a specific container instance.
47
+ #
48
+ # Starts the exec command for a specified container instance in a specified
49
+ # resource group and container group.
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group.
52
+ # @param container_group_name [String] The name of the container group.
53
+ # @param container_name [String] The name of the container instance.
54
+ # @param container_exec_request [ContainerExecRequest] The request for the exec
55
+ # command.
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def launch_exec_with_http_info(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
62
+ launch_exec_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Starts the exec command for a specific container instance.
67
+ #
68
+ # Starts the exec command for a specified container instance in a specified
69
+ # resource group and container group.
70
+ #
71
+ # @param resource_group_name [String] The name of the resource group.
72
+ # @param container_group_name [String] The name of the container group.
73
+ # @param container_name [String] The name of the container instance.
74
+ # @param container_exec_request [ContainerExecRequest] The request for the exec
75
+ # command.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def launch_exec_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
84
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
85
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
86
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
87
+ fail ArgumentError, 'container_exec_request is nil' if container_exec_request.nil?
88
+
89
+
90
+ request_headers = {}
91
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
92
+
93
+ # Set Headers
94
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
95
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
96
+
97
+ # Serialize Request
98
+ request_mapper = Azure::ContainerInstance::Mgmt::V2018_04_01::Models::ContainerExecRequest.mapper()
99
+ request_content = @client.serialize(request_mapper, container_exec_request)
100
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
101
+
102
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'
103
+
104
+ request_url = @base_url || @client.base_url
105
+
106
+ options = {
107
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
108
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name,'containerName' => container_name},
109
+ query_params: {'api-version' => @client.api_version},
110
+ body: request_content,
111
+ headers: request_headers.merge(custom_headers || {}),
112
+ base_url: request_url
113
+ }
114
+ promise = @client.make_request_async(:post, path_template, options)
115
+
116
+ promise = promise.then do |result|
117
+ http_response = result.response
118
+ status_code = http_response.status
119
+ response_content = http_response.body
120
+ unless status_code == 200
121
+ error_model = JSON.load(response_content)
122
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
123
+ end
124
+
125
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 200
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_04_01::Models::ContainerExecResponse.mapper()
131
+ result.body = @client.deserialize(result_mapper, parsed_response)
132
+ rescue Exception => e
133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
134
+ end
135
+ end
136
+
137
+ result
138
+ end
139
+
140
+ promise.execute
141
+ end
142
+
143
+ end
144
+ end
@@ -0,0 +1,71 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-06-01/generated/azure_mgmt_container_instance/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ContainerInstance::Mgmt::V2018_06_01
23
+ autoload :ContainerGroups, '2018-06-01/generated/azure_mgmt_container_instance/container_groups.rb'
24
+ autoload :Operations, '2018-06-01/generated/azure_mgmt_container_instance/operations.rb'
25
+ autoload :ContainerGroupUsage, '2018-06-01/generated/azure_mgmt_container_instance/container_group_usage.rb'
26
+ autoload :ContainerOperations, '2018-06-01/generated/azure_mgmt_container_instance/container_operations.rb'
27
+ autoload :ContainerInstanceManagementClient, '2018-06-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb'
28
+
29
+ module Models
30
+ autoload :Port, '2018-06-01/generated/azure_mgmt_container_instance/models/port.rb'
31
+ autoload :IpAddress, '2018-06-01/generated/azure_mgmt_container_instance/models/ip_address.rb'
32
+ autoload :EnvironmentVariable, '2018-06-01/generated/azure_mgmt_container_instance/models/environment_variable.rb'
33
+ autoload :ContainerGroupPropertiesInstanceView, '2018-06-01/generated/azure_mgmt_container_instance/models/container_group_properties_instance_view.rb'
34
+ autoload :Event, '2018-06-01/generated/azure_mgmt_container_instance/models/event.rb'
35
+ autoload :LogAnalytics, '2018-06-01/generated/azure_mgmt_container_instance/models/log_analytics.rb'
36
+ autoload :ResourceRequests, '2018-06-01/generated/azure_mgmt_container_instance/models/resource_requests.rb'
37
+ autoload :ContainerGroupDiagnostics, '2018-06-01/generated/azure_mgmt_container_instance/models/container_group_diagnostics.rb'
38
+ autoload :ResourceRequirements, '2018-06-01/generated/azure_mgmt_container_instance/models/resource_requirements.rb'
39
+ autoload :VolumeMount, '2018-06-01/generated/azure_mgmt_container_instance/models/volume_mount.rb'
40
+ autoload :ContainerHttpGet, '2018-06-01/generated/azure_mgmt_container_instance/models/container_http_get.rb'
41
+ autoload :OperationDisplay, '2018-06-01/generated/azure_mgmt_container_instance/models/operation_display.rb'
42
+ autoload :Container, '2018-06-01/generated/azure_mgmt_container_instance/models/container.rb'
43
+ autoload :Operation, '2018-06-01/generated/azure_mgmt_container_instance/models/operation.rb'
44
+ autoload :GitRepoVolume, '2018-06-01/generated/azure_mgmt_container_instance/models/git_repo_volume.rb'
45
+ autoload :OperationListResult, '2018-06-01/generated/azure_mgmt_container_instance/models/operation_list_result.rb'
46
+ autoload :ImageRegistryCredential, '2018-06-01/generated/azure_mgmt_container_instance/models/image_registry_credential.rb'
47
+ autoload :UsageName, '2018-06-01/generated/azure_mgmt_container_instance/models/usage_name.rb'
48
+ autoload :ContainerState, '2018-06-01/generated/azure_mgmt_container_instance/models/container_state.rb'
49
+ autoload :Usage, '2018-06-01/generated/azure_mgmt_container_instance/models/usage.rb'
50
+ autoload :ResourceLimits, '2018-06-01/generated/azure_mgmt_container_instance/models/resource_limits.rb'
51
+ autoload :UsageListResult, '2018-06-01/generated/azure_mgmt_container_instance/models/usage_list_result.rb'
52
+ autoload :ContainerProbe, '2018-06-01/generated/azure_mgmt_container_instance/models/container_probe.rb'
53
+ autoload :ContainerGroupListResult, '2018-06-01/generated/azure_mgmt_container_instance/models/container_group_list_result.rb'
54
+ autoload :Volume, '2018-06-01/generated/azure_mgmt_container_instance/models/volume.rb'
55
+ autoload :Logs, '2018-06-01/generated/azure_mgmt_container_instance/models/logs.rb'
56
+ autoload :ContainerPropertiesInstanceView, '2018-06-01/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb'
57
+ autoload :ContainerExecRequestTerminalSize, '2018-06-01/generated/azure_mgmt_container_instance/models/container_exec_request_terminal_size.rb'
58
+ autoload :AzureFileVolume, '2018-06-01/generated/azure_mgmt_container_instance/models/azure_file_volume.rb'
59
+ autoload :ContainerExecRequest, '2018-06-01/generated/azure_mgmt_container_instance/models/container_exec_request.rb'
60
+ autoload :ContainerExec, '2018-06-01/generated/azure_mgmt_container_instance/models/container_exec.rb'
61
+ autoload :ContainerExecResponse, '2018-06-01/generated/azure_mgmt_container_instance/models/container_exec_response.rb'
62
+ autoload :ContainerPort, '2018-06-01/generated/azure_mgmt_container_instance/models/container_port.rb'
63
+ autoload :Resource, '2018-06-01/generated/azure_mgmt_container_instance/models/resource.rb'
64
+ autoload :ContainerGroup, '2018-06-01/generated/azure_mgmt_container_instance/models/container_group.rb'
65
+ autoload :ContainerNetworkProtocol, '2018-06-01/generated/azure_mgmt_container_instance/models/container_network_protocol.rb'
66
+ autoload :ContainerGroupRestartPolicy, '2018-06-01/generated/azure_mgmt_container_instance/models/container_group_restart_policy.rb'
67
+ autoload :ContainerGroupNetworkProtocol, '2018-06-01/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb'
68
+ autoload :OperatingSystemTypes, '2018-06-01/generated/azure_mgmt_container_instance/models/operating_system_types.rb'
69
+ autoload :ContainerInstanceOperationsOrigin, '2018-06-01/generated/azure_mgmt_container_instance/models/container_instance_operations_origin.rb'
70
+ end
71
+ end
@@ -0,0 +1,113 @@
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::V2018_06_01
7
+ #
8
+ # ContainerGroupUsage
9
+ #
10
+ class ContainerGroupUsage
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ContainerGroupUsage 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 usage for a subscription
26
+ #
27
+ # @param location [String] The identifier for the physical azure location.
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [UsageListResult] operation results.
32
+ #
33
+ def list(location, custom_headers:nil)
34
+ response = list_async(location, custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Get the usage for a subscription
40
+ #
41
+ # @param location [String] The identifier for the physical azure location.
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def list_with_http_info(location, custom_headers:nil)
48
+ list_async(location, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Get the usage for a subscription
53
+ #
54
+ # @param location [String] The identifier for the physical azure location.
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(location, custom_headers:nil)
61
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
62
+ fail ArgumentError, 'location is nil' if location.nil?
63
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::UsageListResult.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ end
113
+ end
@@ -0,0 +1,984 @@
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::V2018_06_01
7
+ #
8
+ # ContainerGroups
9
+ #
10
+ class ContainerGroups
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ContainerGroups 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 a list of container groups in the specified subscription.
26
+ #
27
+ # Get a list of container groups in the specified subscription. This operation
28
+ # returns properties of each container group including containers, image
29
+ # registry credentials, restart policy, IP address type, OS type, state, and
30
+ # volumes.
31
+ #
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<ContainerGroup>] operation results.
36
+ #
37
+ def list(custom_headers:nil)
38
+ first_page = list_as_lazy(custom_headers:custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # Get a list of container groups in the specified subscription.
44
+ #
45
+ # Get a list of container groups in the specified subscription. This operation
46
+ # returns properties of each container group including containers, image
47
+ # registry credentials, restart policy, IP address type, OS type, state, and
48
+ # volumes.
49
+ #
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(custom_headers:nil)
56
+ list_async(custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Get a list of container groups in the specified subscription.
61
+ #
62
+ # Get a list of container groups in the specified subscription. This operation
63
+ # returns properties of each container group including containers, image
64
+ # registry credentials, restart policy, IP address type, OS type, state, and
65
+ # volumes.
66
+ #
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(custom_headers:nil)
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'subscriptionId' => @client.subscription_id},
90
+ query_params: {'api-version' => @client.api_version},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:get, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ # Deserialize Response
107
+ if status_code == 200
108
+ begin
109
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
110
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroupListResult.mapper()
111
+ result.body = @client.deserialize(result_mapper, parsed_response)
112
+ rescue Exception => e
113
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
114
+ end
115
+ end
116
+
117
+ result
118
+ end
119
+
120
+ promise.execute
121
+ end
122
+
123
+ #
124
+ # Get a list of container groups in the specified subscription and resource
125
+ # group.
126
+ #
127
+ # Get a list of container groups in a specified subscription and resource
128
+ # group. This operation returns properties of each container group including
129
+ # containers, image registry credentials, restart policy, IP address type, OS
130
+ # type, state, and volumes.
131
+ #
132
+ # @param resource_group_name [String] The name of the resource group.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [Array<ContainerGroup>] operation results.
137
+ #
138
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
139
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
140
+ first_page.get_all_items
141
+ end
142
+
143
+ #
144
+ # Get a list of container groups in the specified subscription and resource
145
+ # group.
146
+ #
147
+ # Get a list of container groups in a specified subscription and resource
148
+ # group. This operation returns properties of each container group including
149
+ # containers, image registry credentials, restart policy, IP address type, OS
150
+ # type, state, and volumes.
151
+ #
152
+ # @param resource_group_name [String] The name of the resource group.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
157
+ #
158
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
159
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Get a list of container groups in the specified subscription and resource
164
+ # group.
165
+ #
166
+ # Get a list of container groups in a specified subscription and resource
167
+ # group. This operation returns properties of each container group including
168
+ # containers, image registry credentials, restart policy, IP address type, OS
169
+ # type, state, and volumes.
170
+ #
171
+ # @param resource_group_name [String] The name of the resource group.
172
+ # @param [Hash{String => String}] A hash of custom headers that will be added
173
+ # to the HTTP request.
174
+ #
175
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
176
+ #
177
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
178
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
179
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
180
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
181
+
182
+
183
+ request_headers = {}
184
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
185
+
186
+ # Set Headers
187
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
188
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
189
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups'
190
+
191
+ request_url = @base_url || @client.base_url
192
+
193
+ options = {
194
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
195
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
196
+ query_params: {'api-version' => @client.api_version},
197
+ headers: request_headers.merge(custom_headers || {}),
198
+ base_url: request_url
199
+ }
200
+ promise = @client.make_request_async(:get, path_template, options)
201
+
202
+ promise = promise.then do |result|
203
+ http_response = result.response
204
+ status_code = http_response.status
205
+ response_content = http_response.body
206
+ unless status_code == 200
207
+ error_model = JSON.load(response_content)
208
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
209
+ end
210
+
211
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
212
+ # Deserialize Response
213
+ if status_code == 200
214
+ begin
215
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
216
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroupListResult.mapper()
217
+ result.body = @client.deserialize(result_mapper, parsed_response)
218
+ rescue Exception => e
219
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
220
+ end
221
+ end
222
+
223
+ result
224
+ end
225
+
226
+ promise.execute
227
+ end
228
+
229
+ #
230
+ # Get the properties of the specified container group.
231
+ #
232
+ # Gets the properties of the specified container group in the specified
233
+ # subscription and resource group. The operation returns the properties of each
234
+ # container group including containers, image registry credentials, restart
235
+ # policy, IP address type, OS type, state, and volumes.
236
+ #
237
+ # @param resource_group_name [String] The name of the resource group.
238
+ # @param container_group_name [String] The name of the container group.
239
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
240
+ # will be added to the HTTP request.
241
+ #
242
+ # @return [ContainerGroup] operation results.
243
+ #
244
+ def get(resource_group_name, container_group_name, custom_headers:nil)
245
+ response = get_async(resource_group_name, container_group_name, custom_headers:custom_headers).value!
246
+ response.body unless response.nil?
247
+ end
248
+
249
+ #
250
+ # Get the properties of the specified container group.
251
+ #
252
+ # Gets the properties of the specified container group in the specified
253
+ # subscription and resource group. The operation returns the properties of each
254
+ # container group including containers, image registry credentials, restart
255
+ # policy, IP address type, OS type, state, and volumes.
256
+ #
257
+ # @param resource_group_name [String] The name of the resource group.
258
+ # @param container_group_name [String] The name of the container group.
259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
260
+ # will be added to the HTTP request.
261
+ #
262
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
263
+ #
264
+ def get_with_http_info(resource_group_name, container_group_name, custom_headers:nil)
265
+ get_async(resource_group_name, container_group_name, custom_headers:custom_headers).value!
266
+ end
267
+
268
+ #
269
+ # Get the properties of the specified container group.
270
+ #
271
+ # Gets the properties of the specified container group in the specified
272
+ # subscription and resource group. The operation returns the properties of each
273
+ # container group including containers, image registry credentials, restart
274
+ # policy, IP address type, OS type, state, and volumes.
275
+ #
276
+ # @param resource_group_name [String] The name of the resource group.
277
+ # @param container_group_name [String] The name of the container group.
278
+ # @param [Hash{String => String}] A hash of custom headers that will be added
279
+ # to the HTTP request.
280
+ #
281
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
282
+ #
283
+ def get_async(resource_group_name, container_group_name, custom_headers:nil)
284
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
285
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
286
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
287
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
288
+
289
+
290
+ request_headers = {}
291
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
292
+
293
+ # Set Headers
294
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
295
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
296
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
297
+
298
+ request_url = @base_url || @client.base_url
299
+
300
+ options = {
301
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
302
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
303
+ query_params: {'api-version' => @client.api_version},
304
+ headers: request_headers.merge(custom_headers || {}),
305
+ base_url: request_url
306
+ }
307
+ promise = @client.make_request_async(:get, path_template, options)
308
+
309
+ promise = promise.then do |result|
310
+ http_response = result.response
311
+ status_code = http_response.status
312
+ response_content = http_response.body
313
+ unless status_code == 200
314
+ error_model = JSON.load(response_content)
315
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
316
+ end
317
+
318
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
319
+ # Deserialize Response
320
+ if status_code == 200
321
+ begin
322
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
323
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
324
+ result.body = @client.deserialize(result_mapper, parsed_response)
325
+ rescue Exception => e
326
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
327
+ end
328
+ end
329
+
330
+ result
331
+ end
332
+
333
+ promise.execute
334
+ end
335
+
336
+ #
337
+ # Create or update container groups.
338
+ #
339
+ # Create or update container groups with specified configurations.
340
+ #
341
+ # @param resource_group_name [String] The name of the resource group.
342
+ # @param container_group_name [String] The name of the container group.
343
+ # @param container_group [ContainerGroup] The properties of the container group
344
+ # to be created or updated.
345
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
346
+ # will be added to the HTTP request.
347
+ #
348
+ # @return [ContainerGroup] operation results.
349
+ #
350
+ def create_or_update(resource_group_name, container_group_name, container_group, custom_headers:nil)
351
+ response = create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers:custom_headers).value!
352
+ response.body unless response.nil?
353
+ end
354
+
355
+ #
356
+ # @param resource_group_name [String] The name of the resource group.
357
+ # @param container_group_name [String] The name of the container group.
358
+ # @param container_group [ContainerGroup] The properties of the container group
359
+ # to be created or updated.
360
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
361
+ # will be added to the HTTP request.
362
+ #
363
+ # @return [Concurrent::Promise] promise which provides async access to http
364
+ # response.
365
+ #
366
+ def create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers:nil)
367
+ # Send request
368
+ promise = begin_create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers:custom_headers)
369
+
370
+ promise = promise.then do |response|
371
+ # Defining deserialization method.
372
+ deserialize_method = lambda do |parsed_response|
373
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
374
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
375
+ end
376
+
377
+ # Waiting for response.
378
+ @client.get_long_running_operation_result(response, deserialize_method)
379
+ end
380
+
381
+ promise
382
+ end
383
+
384
+ #
385
+ # Update container groups.
386
+ #
387
+ # Updates container group tags with specified values.
388
+ #
389
+ # @param resource_group_name [String] The name of the resource group.
390
+ # @param container_group_name [String] The name of the container group.
391
+ # @param resource [Resource] The container group resource with just the tags to
392
+ # be updated.
393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
+ # will be added to the HTTP request.
395
+ #
396
+ # @return [ContainerGroup] operation results.
397
+ #
398
+ def update(resource_group_name, container_group_name, resource, custom_headers:nil)
399
+ response = update_async(resource_group_name, container_group_name, resource, custom_headers:custom_headers).value!
400
+ response.body unless response.nil?
401
+ end
402
+
403
+ #
404
+ # Update container groups.
405
+ #
406
+ # Updates container group tags with specified values.
407
+ #
408
+ # @param resource_group_name [String] The name of the resource group.
409
+ # @param container_group_name [String] The name of the container group.
410
+ # @param resource [Resource] The container group resource with just the tags to
411
+ # be updated.
412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
413
+ # will be added to the HTTP request.
414
+ #
415
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
416
+ #
417
+ def update_with_http_info(resource_group_name, container_group_name, resource, custom_headers:nil)
418
+ update_async(resource_group_name, container_group_name, resource, custom_headers:custom_headers).value!
419
+ end
420
+
421
+ #
422
+ # Update container groups.
423
+ #
424
+ # Updates container group tags with specified values.
425
+ #
426
+ # @param resource_group_name [String] The name of the resource group.
427
+ # @param container_group_name [String] The name of the container group.
428
+ # @param resource [Resource] The container group resource with just the tags to
429
+ # be updated.
430
+ # @param [Hash{String => String}] A hash of custom headers that will be added
431
+ # to the HTTP request.
432
+ #
433
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
434
+ #
435
+ def update_async(resource_group_name, container_group_name, resource, custom_headers:nil)
436
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
437
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
438
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
439
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
440
+ fail ArgumentError, 'resource is nil' if resource.nil?
441
+
442
+
443
+ request_headers = {}
444
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
445
+
446
+ # Set Headers
447
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
448
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
449
+
450
+ # Serialize Request
451
+ request_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::Resource.mapper()
452
+ request_content = @client.serialize(request_mapper, resource)
453
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
454
+
455
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
456
+
457
+ request_url = @base_url || @client.base_url
458
+
459
+ options = {
460
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
461
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
462
+ query_params: {'api-version' => @client.api_version},
463
+ body: request_content,
464
+ headers: request_headers.merge(custom_headers || {}),
465
+ base_url: request_url
466
+ }
467
+ promise = @client.make_request_async(:patch, path_template, options)
468
+
469
+ promise = promise.then do |result|
470
+ http_response = result.response
471
+ status_code = http_response.status
472
+ response_content = http_response.body
473
+ unless status_code == 200
474
+ error_model = JSON.load(response_content)
475
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
476
+ end
477
+
478
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
479
+ # Deserialize Response
480
+ if status_code == 200
481
+ begin
482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
483
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
484
+ result.body = @client.deserialize(result_mapper, parsed_response)
485
+ rescue Exception => e
486
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
487
+ end
488
+ end
489
+
490
+ result
491
+ end
492
+
493
+ promise.execute
494
+ end
495
+
496
+ #
497
+ # Delete the specified container group.
498
+ #
499
+ # Delete the specified container group in the specified subscription and
500
+ # resource group. The operation does not delete other resources provided by the
501
+ # user, such as volumes.
502
+ #
503
+ # @param resource_group_name [String] The name of the resource group.
504
+ # @param container_group_name [String] The name of the container group.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [ContainerGroup] operation results.
509
+ #
510
+ def delete(resource_group_name, container_group_name, custom_headers:nil)
511
+ response = delete_async(resource_group_name, container_group_name, custom_headers:custom_headers).value!
512
+ response.body unless response.nil?
513
+ end
514
+
515
+ #
516
+ # Delete the specified container group.
517
+ #
518
+ # Delete the specified container group in the specified subscription and
519
+ # resource group. The operation does not delete other resources provided by the
520
+ # user, such as volumes.
521
+ #
522
+ # @param resource_group_name [String] The name of the resource group.
523
+ # @param container_group_name [String] The name of the container group.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
528
+ #
529
+ def delete_with_http_info(resource_group_name, container_group_name, custom_headers:nil)
530
+ delete_async(resource_group_name, container_group_name, custom_headers:custom_headers).value!
531
+ end
532
+
533
+ #
534
+ # Delete the specified container group.
535
+ #
536
+ # Delete the specified container group in the specified subscription and
537
+ # resource group. The operation does not delete other resources provided by the
538
+ # user, such as volumes.
539
+ #
540
+ # @param resource_group_name [String] The name of the resource group.
541
+ # @param container_group_name [String] The name of the container group.
542
+ # @param [Hash{String => String}] A hash of custom headers that will be added
543
+ # to the HTTP request.
544
+ #
545
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
546
+ #
547
+ def delete_async(resource_group_name, container_group_name, custom_headers:nil)
548
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
549
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
550
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
551
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
552
+
553
+
554
+ request_headers = {}
555
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
556
+
557
+ # Set Headers
558
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
559
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
560
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
561
+
562
+ request_url = @base_url || @client.base_url
563
+
564
+ options = {
565
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
566
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
567
+ query_params: {'api-version' => @client.api_version},
568
+ headers: request_headers.merge(custom_headers || {}),
569
+ base_url: request_url
570
+ }
571
+ promise = @client.make_request_async(:delete, path_template, options)
572
+
573
+ promise = promise.then do |result|
574
+ http_response = result.response
575
+ status_code = http_response.status
576
+ response_content = http_response.body
577
+ unless status_code == 200 || status_code == 204
578
+ error_model = JSON.load(response_content)
579
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
580
+ end
581
+
582
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
583
+ # Deserialize Response
584
+ if status_code == 200
585
+ begin
586
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
587
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
588
+ result.body = @client.deserialize(result_mapper, parsed_response)
589
+ rescue Exception => e
590
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
591
+ end
592
+ end
593
+
594
+ result
595
+ end
596
+
597
+ promise.execute
598
+ end
599
+
600
+ #
601
+ # Create or update container groups.
602
+ #
603
+ # Create or update container groups with specified configurations.
604
+ #
605
+ # @param resource_group_name [String] The name of the resource group.
606
+ # @param container_group_name [String] The name of the container group.
607
+ # @param container_group [ContainerGroup] The properties of the container group
608
+ # to be created or updated.
609
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
610
+ # will be added to the HTTP request.
611
+ #
612
+ # @return [ContainerGroup] operation results.
613
+ #
614
+ def begin_create_or_update(resource_group_name, container_group_name, container_group, custom_headers:nil)
615
+ response = begin_create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers:custom_headers).value!
616
+ response.body unless response.nil?
617
+ end
618
+
619
+ #
620
+ # Create or update container groups.
621
+ #
622
+ # Create or update container groups with specified configurations.
623
+ #
624
+ # @param resource_group_name [String] The name of the resource group.
625
+ # @param container_group_name [String] The name of the container group.
626
+ # @param container_group [ContainerGroup] The properties of the container group
627
+ # to be created or updated.
628
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
629
+ # will be added to the HTTP request.
630
+ #
631
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
632
+ #
633
+ def begin_create_or_update_with_http_info(resource_group_name, container_group_name, container_group, custom_headers:nil)
634
+ begin_create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers:custom_headers).value!
635
+ end
636
+
637
+ #
638
+ # Create or update container groups.
639
+ #
640
+ # Create or update container groups with specified configurations.
641
+ #
642
+ # @param resource_group_name [String] The name of the resource group.
643
+ # @param container_group_name [String] The name of the container group.
644
+ # @param container_group [ContainerGroup] The properties of the container group
645
+ # to be created or updated.
646
+ # @param [Hash{String => String}] A hash of custom headers that will be added
647
+ # to the HTTP request.
648
+ #
649
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
650
+ #
651
+ def begin_create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers:nil)
652
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
653
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
654
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
655
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
656
+ fail ArgumentError, 'container_group is nil' if container_group.nil?
657
+
658
+
659
+ request_headers = {}
660
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
661
+
662
+ # Set Headers
663
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
664
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
665
+
666
+ # Serialize Request
667
+ request_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
668
+ request_content = @client.serialize(request_mapper, container_group)
669
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
670
+
671
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
672
+
673
+ request_url = @base_url || @client.base_url
674
+
675
+ options = {
676
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
677
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
678
+ query_params: {'api-version' => @client.api_version},
679
+ body: request_content,
680
+ headers: request_headers.merge(custom_headers || {}),
681
+ base_url: request_url
682
+ }
683
+ promise = @client.make_request_async(:put, path_template, options)
684
+
685
+ promise = promise.then do |result|
686
+ http_response = result.response
687
+ status_code = http_response.status
688
+ response_content = http_response.body
689
+ unless status_code == 200 || status_code == 201
690
+ error_model = JSON.load(response_content)
691
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
692
+ end
693
+
694
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
695
+ # Deserialize Response
696
+ if status_code == 200
697
+ begin
698
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
699
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
700
+ result.body = @client.deserialize(result_mapper, parsed_response)
701
+ rescue Exception => e
702
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
703
+ end
704
+ end
705
+ # Deserialize Response
706
+ if status_code == 201
707
+ begin
708
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
709
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroup.mapper()
710
+ result.body = @client.deserialize(result_mapper, parsed_response)
711
+ rescue Exception => e
712
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
713
+ end
714
+ end
715
+
716
+ result
717
+ end
718
+
719
+ promise.execute
720
+ end
721
+
722
+ #
723
+ # Get a list of container groups in the specified subscription.
724
+ #
725
+ # Get a list of container groups in the specified subscription. This operation
726
+ # returns properties of each container group including containers, image
727
+ # registry credentials, restart policy, IP address type, OS type, state, and
728
+ # volumes.
729
+ #
730
+ # @param next_page_link [String] The NextLink from the previous successful call
731
+ # to List operation.
732
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
733
+ # will be added to the HTTP request.
734
+ #
735
+ # @return [ContainerGroupListResult] operation results.
736
+ #
737
+ def list_next(next_page_link, custom_headers:nil)
738
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
739
+ response.body unless response.nil?
740
+ end
741
+
742
+ #
743
+ # Get a list of container groups in the specified subscription.
744
+ #
745
+ # Get a list of container groups in the specified subscription. This operation
746
+ # returns properties of each container group including containers, image
747
+ # registry credentials, restart policy, IP address type, OS type, state, and
748
+ # volumes.
749
+ #
750
+ # @param next_page_link [String] The NextLink from the previous successful call
751
+ # to List operation.
752
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
753
+ # will be added to the HTTP request.
754
+ #
755
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
756
+ #
757
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
758
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
759
+ end
760
+
761
+ #
762
+ # Get a list of container groups in the specified subscription.
763
+ #
764
+ # Get a list of container groups in the specified subscription. This operation
765
+ # returns properties of each container group including containers, image
766
+ # registry credentials, restart policy, IP address type, OS type, state, and
767
+ # volumes.
768
+ #
769
+ # @param next_page_link [String] The NextLink from the previous successful call
770
+ # to List operation.
771
+ # @param [Hash{String => String}] A hash of custom headers that will be added
772
+ # to the HTTP request.
773
+ #
774
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
775
+ #
776
+ def list_next_async(next_page_link, custom_headers:nil)
777
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'
787
+
788
+ request_url = @base_url || @client.base_url
789
+
790
+ options = {
791
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
792
+ skip_encoding_path_params: {'nextLink' => next_page_link},
793
+ headers: request_headers.merge(custom_headers || {}),
794
+ base_url: request_url
795
+ }
796
+ promise = @client.make_request_async(:get, path_template, options)
797
+
798
+ promise = promise.then do |result|
799
+ http_response = result.response
800
+ status_code = http_response.status
801
+ response_content = http_response.body
802
+ unless status_code == 200
803
+ error_model = JSON.load(response_content)
804
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
805
+ end
806
+
807
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
808
+ # Deserialize Response
809
+ if status_code == 200
810
+ begin
811
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
812
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroupListResult.mapper()
813
+ result.body = @client.deserialize(result_mapper, parsed_response)
814
+ rescue Exception => e
815
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
816
+ end
817
+ end
818
+
819
+ result
820
+ end
821
+
822
+ promise.execute
823
+ end
824
+
825
+ #
826
+ # Get a list of container groups in the specified subscription and resource
827
+ # group.
828
+ #
829
+ # Get a list of container groups in a specified subscription and resource
830
+ # group. This operation returns properties of each container group including
831
+ # containers, image registry credentials, restart policy, IP address type, OS
832
+ # type, state, and volumes.
833
+ #
834
+ # @param next_page_link [String] The NextLink from the previous successful call
835
+ # to List 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 [ContainerGroupListResult] operation results.
840
+ #
841
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
842
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
843
+ response.body unless response.nil?
844
+ end
845
+
846
+ #
847
+ # Get a list of container groups in the specified subscription and resource
848
+ # group.
849
+ #
850
+ # Get a list of container groups in a specified subscription and resource
851
+ # group. This operation returns properties of each container group including
852
+ # containers, image registry credentials, restart policy, IP address type, OS
853
+ # type, state, and volumes.
854
+ #
855
+ # @param next_page_link [String] The NextLink from the previous successful call
856
+ # to List operation.
857
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
858
+ # will be added to the HTTP request.
859
+ #
860
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
861
+ #
862
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
863
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
864
+ end
865
+
866
+ #
867
+ # Get a list of container groups in the specified subscription and resource
868
+ # group.
869
+ #
870
+ # Get a list of container groups in a specified subscription and resource
871
+ # group. This operation returns properties of each container group including
872
+ # containers, image registry credentials, restart policy, IP address type, OS
873
+ # type, state, and volumes.
874
+ #
875
+ # @param next_page_link [String] The NextLink from the previous successful call
876
+ # to List operation.
877
+ # @param [Hash{String => String}] A hash of custom headers that will be added
878
+ # to the HTTP request.
879
+ #
880
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
881
+ #
882
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
883
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
884
+
885
+
886
+ request_headers = {}
887
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
888
+
889
+ # Set Headers
890
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
891
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
892
+ path_template = '{nextLink}'
893
+
894
+ request_url = @base_url || @client.base_url
895
+
896
+ options = {
897
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
898
+ skip_encoding_path_params: {'nextLink' => next_page_link},
899
+ headers: request_headers.merge(custom_headers || {}),
900
+ base_url: request_url
901
+ }
902
+ promise = @client.make_request_async(:get, path_template, options)
903
+
904
+ promise = promise.then do |result|
905
+ http_response = result.response
906
+ status_code = http_response.status
907
+ response_content = http_response.body
908
+ unless status_code == 200
909
+ error_model = JSON.load(response_content)
910
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
911
+ end
912
+
913
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
914
+ # Deserialize Response
915
+ if status_code == 200
916
+ begin
917
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
918
+ result_mapper = Azure::ContainerInstance::Mgmt::V2018_06_01::Models::ContainerGroupListResult.mapper()
919
+ result.body = @client.deserialize(result_mapper, parsed_response)
920
+ rescue Exception => e
921
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
922
+ end
923
+ end
924
+
925
+ result
926
+ end
927
+
928
+ promise.execute
929
+ end
930
+
931
+ #
932
+ # Get a list of container groups in the specified subscription.
933
+ #
934
+ # Get a list of container groups in the specified subscription. This operation
935
+ # returns properties of each container group including containers, image
936
+ # registry credentials, restart policy, IP address type, OS type, state, and
937
+ # volumes.
938
+ #
939
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
940
+ # will be added to the HTTP request.
941
+ #
942
+ # @return [ContainerGroupListResult] which provide lazy access to pages of the
943
+ # response.
944
+ #
945
+ def list_as_lazy(custom_headers:nil)
946
+ response = list_async(custom_headers:custom_headers).value!
947
+ unless response.nil?
948
+ page = response.body
949
+ page.next_method = Proc.new do |next_page_link|
950
+ list_next_async(next_page_link, custom_headers:custom_headers)
951
+ end
952
+ page
953
+ end
954
+ end
955
+
956
+ #
957
+ # Get a list of container groups in the specified subscription and resource
958
+ # group.
959
+ #
960
+ # Get a list of container groups in a specified subscription and resource
961
+ # group. This operation returns properties of each container group including
962
+ # containers, image registry credentials, restart policy, IP address type, OS
963
+ # type, state, and volumes.
964
+ #
965
+ # @param resource_group_name [String] The name of the resource group.
966
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
967
+ # will be added to the HTTP request.
968
+ #
969
+ # @return [ContainerGroupListResult] which provide lazy access to pages of the
970
+ # response.
971
+ #
972
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
973
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
974
+ unless response.nil?
975
+ page = response.body
976
+ page.next_method = Proc.new do |next_page_link|
977
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
978
+ end
979
+ page
980
+ end
981
+ end
982
+
983
+ end
984
+ end