azure_mgmt_container_instance 0.14.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 (32) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_container_instance.rb +6 -0
  4. data/lib/generated/azure_mgmt_container_instance.rb +51 -0
  5. data/lib/generated/azure_mgmt_container_instance/container_groups.rb +838 -0
  6. data/lib/generated/azure_mgmt_container_instance/container_instance_management_client.rb +135 -0
  7. data/lib/generated/azure_mgmt_container_instance/container_logs.rb +144 -0
  8. data/lib/generated/azure_mgmt_container_instance/models/azure_file_volume.rb +79 -0
  9. data/lib/generated/azure_mgmt_container_instance/models/container.rb +155 -0
  10. data/lib/generated/azure_mgmt_container_instance/models/container_event.rb +84 -0
  11. data/lib/generated/azure_mgmt_container_instance/models/container_group.rb +194 -0
  12. data/lib/generated/azure_mgmt_container_instance/models/container_group_list_result.rb +95 -0
  13. data/lib/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb +16 -0
  14. data/lib/generated/azure_mgmt_container_instance/models/container_port.rb +44 -0
  15. data/lib/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb +85 -0
  16. data/lib/generated/azure_mgmt_container_instance/models/container_restart_policy.rb +15 -0
  17. data/lib/generated/azure_mgmt_container_instance/models/container_state.rb +88 -0
  18. data/lib/generated/azure_mgmt_container_instance/models/environment_variable.rb +54 -0
  19. data/lib/generated/azure_mgmt_container_instance/models/image_registry_credential.rb +65 -0
  20. data/lib/generated/azure_mgmt_container_instance/models/ip_address.rb +75 -0
  21. data/lib/generated/azure_mgmt_container_instance/models/logs.rb +44 -0
  22. data/lib/generated/azure_mgmt_container_instance/models/operating_system_types.rb +16 -0
  23. data/lib/generated/azure_mgmt_container_instance/models/port.rb +55 -0
  24. data/lib/generated/azure_mgmt_container_instance/models/resource.rb +94 -0
  25. data/lib/generated/azure_mgmt_container_instance/models/resource_limits.rb +54 -0
  26. data/lib/generated/azure_mgmt_container_instance/models/resource_requests.rb +54 -0
  27. data/lib/generated/azure_mgmt_container_instance/models/resource_requirements.rb +58 -0
  28. data/lib/generated/azure_mgmt_container_instance/models/volume.rb +55 -0
  29. data/lib/generated/azure_mgmt_container_instance/models/volume_mount.rb +66 -0
  30. data/lib/generated/azure_mgmt_container_instance/module_definition.rb +8 -0
  31. data/lib/generated/azure_mgmt_container_instance/version.rb +8 -0
  32. metadata +143 -0
@@ -0,0 +1,135 @@
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::ARM::ContainerInstance
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] Gets or sets the preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
32
+ # Running Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
36
+ # is generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [ContainerGroups] container_groups
40
+ attr_reader :container_groups
41
+
42
+ # @return [ContainerLogs] container_logs
43
+ attr_reader :container_logs
44
+
45
+ #
46
+ # Creates initializes a new instance of the ContainerInstanceManagementClient class.
47
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
48
+ # @param base_url [String] the base URI of the service.
49
+ # @param options [Array] filters to be applied to the HTTP requests.
50
+ #
51
+ def initialize(credentials = nil, base_url = nil, options = nil)
52
+ super(credentials, options)
53
+ @base_url = base_url || 'https://management.azure.com'
54
+
55
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
56
+ @credentials = credentials
57
+
58
+ @container_groups = ContainerGroups.new(self)
59
+ @container_logs = ContainerLogs.new(self)
60
+ @api_version = '2017-08-01-preview'
61
+ @accept_language = 'en-US'
62
+ @long_running_operation_retry_timeout = 30
63
+ @generate_client_request_id = true
64
+ add_telemetry
65
+ end
66
+
67
+ #
68
+ # Makes a request and returns the body of the response.
69
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
70
+ # @param path [String] the path, relative to {base_url}.
71
+ # @param options [Hash{String=>String}] specifying any request options like :body.
72
+ # @return [Hash{String=>String}] containing the body of the response.
73
+ # Example:
74
+ #
75
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
76
+ # path = "/path"
77
+ # options = {
78
+ # body: request_content,
79
+ # query_params: {'api-version' => '2016-02-01'}
80
+ # }
81
+ # result = @client.make_request(:put, path, options)
82
+ #
83
+ def make_request(method, path, options = {})
84
+ result = make_request_with_http_info(method, path, options)
85
+ result.body unless result.nil?
86
+ end
87
+
88
+ #
89
+ # Makes a request and returns the operation response.
90
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
91
+ # @param path [String] the path, relative to {base_url}.
92
+ # @param options [Hash{String=>String}] specifying any request options like :body.
93
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
94
+ #
95
+ def make_request_with_http_info(method, path, options = {})
96
+ result = make_request_async(method, path, options).value!
97
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
98
+ result
99
+ end
100
+
101
+ #
102
+ # Makes a request asynchronously.
103
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
104
+ # @param path [String] the path, relative to {base_url}.
105
+ # @param options [Hash{String=>String}] specifying any request options like :body.
106
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
107
+ #
108
+ def make_request_async(method, path, options = {})
109
+ fail ArgumentError, 'method is nil' if method.nil?
110
+ fail ArgumentError, 'path is nil' if path.nil?
111
+
112
+ request_url = options[:base_url] || @base_url
113
+
114
+ request_headers = @request_headers
115
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
116
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
117
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
118
+
119
+ super(request_url, method, path, options)
120
+ end
121
+
122
+
123
+ private
124
+ #
125
+ # Adds telemetry information.
126
+ #
127
+ def add_telemetry
128
+ sdk_information = 'azure_mgmt_container_instance'
129
+ if defined? Azure::ARM::ContainerInstance::VERSION
130
+ sdk_information = "#{sdk_information}/#{Azure::ARM::ContainerInstance::VERSION}"
131
+ end
132
+ add_user_agent_information(sdk_information)
133
+ end
134
+ end
135
+ end
@@ -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::ARM::ContainerInstance
7
+ #
8
+ # ContainerLogs
9
+ #
10
+ class ContainerLogs
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ContainerLogs 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 that
31
+ # contains the container instance.
32
+ # @param container_name [String] The name of the container instance.
33
+ # @param container_group_name [String] The name of the container group the
34
+ # container instance belongs to.
35
+ # @param tail [Integer] The number of lines to show from the tail of the
36
+ # container instance log. If not provided, all available logs are shown up to
37
+ # 4mb.
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(resource_group_name, container_name, container_group_name, tail = nil, custom_headers = nil)
44
+ response = list_async(resource_group_name, container_name, container_group_name, tail, 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 that
55
+ # contains the container instance.
56
+ # @param container_name [String] The name of the container instance.
57
+ # @param container_group_name [String] The name of the container group the
58
+ # container instance belongs to.
59
+ # @param tail [Integer] The number of lines to show from the tail of the
60
+ # container instance log. If not provided, all available logs are shown up to
61
+ # 4mb.
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_with_http_info(resource_group_name, container_name, container_group_name, tail = nil, custom_headers = nil)
68
+ list_async(resource_group_name, container_name, container_group_name, tail, 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 that
78
+ # contains the container instance.
79
+ # @param container_name [String] The name of the container instance.
80
+ # @param container_group_name [String] The name of the container group the
81
+ # container instance belongs to.
82
+ # @param tail [Integer] The number of lines to show from the tail of the
83
+ # container instance log. If not provided, all available logs are shown up to
84
+ # 4mb.
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_async(resource_group_name, container_name, container_group_name, tail = 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_name is nil' if container_name.nil?
95
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
96
+
97
+
98
+ request_headers = {}
99
+
100
+ # Set Headers
101
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
102
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
103
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs'
104
+
105
+ request_url = @base_url || @client.base_url
106
+
107
+ options = {
108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
109
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerName' => container_name,'containerGroupName' => container_group_name},
110
+ query_params: {'api-version' => @client.api_version,'tail' => tail},
111
+ headers: request_headers.merge(custom_headers || {}),
112
+ base_url: request_url
113
+ }
114
+ promise = @client.make_request_async(:get, 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::ARM::ContainerInstance::Models::Logs.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,79 @@
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::ARM::ContainerInstance
7
+ module Models
8
+ #
9
+ # The properties of the Azure File volume. Azure File shares are mounted as
10
+ # volumes.
11
+ #
12
+ class AzureFileVolume
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] The name of the Azure File share to be mounted as a
17
+ # volume.
18
+ attr_accessor :share_name
19
+
20
+ # @return [Boolean] The flag indicating whether the Azure File shared
21
+ # mounted as a volume is read-only.
22
+ attr_accessor :read_only
23
+
24
+ # @return [String] The name of the storage account that contains the
25
+ # Azure File share.
26
+ attr_accessor :storage_account_name
27
+
28
+ # @return [String] The storage account access key used to access the
29
+ # Azure File share.
30
+ attr_accessor :storage_account_key
31
+
32
+
33
+ #
34
+ # Mapper for AzureFileVolume class as Ruby Hash.
35
+ # This will be used for serialization/deserialization.
36
+ #
37
+ def self.mapper()
38
+ {
39
+ required: false,
40
+ serialized_name: 'AzureFileVolume',
41
+ type: {
42
+ name: 'Composite',
43
+ class_name: 'AzureFileVolume',
44
+ model_properties: {
45
+ share_name: {
46
+ required: true,
47
+ serialized_name: 'shareName',
48
+ type: {
49
+ name: 'String'
50
+ }
51
+ },
52
+ read_only: {
53
+ required: false,
54
+ serialized_name: 'readOnly',
55
+ type: {
56
+ name: 'Boolean'
57
+ }
58
+ },
59
+ storage_account_name: {
60
+ required: true,
61
+ serialized_name: 'storageAccountName',
62
+ type: {
63
+ name: 'String'
64
+ }
65
+ },
66
+ storage_account_key: {
67
+ required: false,
68
+ serialized_name: 'storageAccountKey',
69
+ type: {
70
+ name: 'String'
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,155 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::ContainerInstance
7
+ module Models
8
+ #
9
+ # A container instance.
10
+ #
11
+ class Container
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The user-provided name of the container instance.
16
+ attr_accessor :name
17
+
18
+ # @return [String] The name of the image used to create the container
19
+ # instance.
20
+ attr_accessor :image
21
+
22
+ # @return [Array<String>] The commands to execute within the container
23
+ # instance in exec form.
24
+ attr_accessor :command
25
+
26
+ # @return [Array<ContainerPort>] The exposed ports on the container
27
+ # instance.
28
+ attr_accessor :ports
29
+
30
+ # @return [Array<EnvironmentVariable>] The environment variables to set
31
+ # in the container instance.
32
+ attr_accessor :environment_variables
33
+
34
+ # @return [ContainerPropertiesInstanceView] The instance view of the
35
+ # container instance. Only valid in response.
36
+ attr_accessor :instance_view
37
+
38
+ # @return [ResourceRequirements] The resource requirements of the
39
+ # container instance.
40
+ attr_accessor :resources
41
+
42
+ # @return [Array<VolumeMount>] The volume mounts available to the
43
+ # container instance.
44
+ attr_accessor :volume_mounts
45
+
46
+
47
+ #
48
+ # Mapper for Container class as Ruby Hash.
49
+ # This will be used for serialization/deserialization.
50
+ #
51
+ def self.mapper()
52
+ {
53
+ required: false,
54
+ serialized_name: 'Container',
55
+ type: {
56
+ name: 'Composite',
57
+ class_name: 'Container',
58
+ model_properties: {
59
+ name: {
60
+ required: true,
61
+ serialized_name: 'name',
62
+ type: {
63
+ name: 'String'
64
+ }
65
+ },
66
+ image: {
67
+ required: true,
68
+ serialized_name: 'properties.image',
69
+ type: {
70
+ name: 'String'
71
+ }
72
+ },
73
+ command: {
74
+ required: false,
75
+ serialized_name: 'properties.command',
76
+ type: {
77
+ name: 'Sequence',
78
+ element: {
79
+ required: false,
80
+ serialized_name: 'StringElementType',
81
+ type: {
82
+ name: 'String'
83
+ }
84
+ }
85
+ }
86
+ },
87
+ ports: {
88
+ required: false,
89
+ serialized_name: 'properties.ports',
90
+ type: {
91
+ name: 'Sequence',
92
+ element: {
93
+ required: false,
94
+ serialized_name: 'ContainerPortElementType',
95
+ type: {
96
+ name: 'Composite',
97
+ class_name: 'ContainerPort'
98
+ }
99
+ }
100
+ }
101
+ },
102
+ environment_variables: {
103
+ required: false,
104
+ serialized_name: 'properties.environmentVariables',
105
+ type: {
106
+ name: 'Sequence',
107
+ element: {
108
+ required: false,
109
+ serialized_name: 'EnvironmentVariableElementType',
110
+ type: {
111
+ name: 'Composite',
112
+ class_name: 'EnvironmentVariable'
113
+ }
114
+ }
115
+ }
116
+ },
117
+ instance_view: {
118
+ required: false,
119
+ read_only: true,
120
+ serialized_name: 'properties.instanceView',
121
+ type: {
122
+ name: 'Composite',
123
+ class_name: 'ContainerPropertiesInstanceView'
124
+ }
125
+ },
126
+ resources: {
127
+ required: true,
128
+ serialized_name: 'properties.resources',
129
+ type: {
130
+ name: 'Composite',
131
+ class_name: 'ResourceRequirements'
132
+ }
133
+ },
134
+ volume_mounts: {
135
+ required: false,
136
+ serialized_name: 'properties.volumeMounts',
137
+ type: {
138
+ name: 'Sequence',
139
+ element: {
140
+ required: false,
141
+ serialized_name: 'VolumeMountElementType',
142
+ type: {
143
+ name: 'Composite',
144
+ class_name: 'VolumeMount'
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ end
153
+ end
154
+ end
155
+ end