Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[AutoPR containerinstance/resource-manager] Container Instance: Adding September Update #1620

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

require 'uri'
require 'cgi'
require 'date'
require 'json'
require 'base64'
require 'erb'
require 'securerandom'
require 'time'
require 'timeliness'
require 'faraday'
require 'faraday-cookie_jar'
require 'concurrent'
require 'ms_rest'
require '2018-04-01/generated/azure_mgmt_container_instance/module_definition'
require 'ms_rest_azure'

module Azure::ContainerInstance::Mgmt::V2018_02_01_preview
autoload :ContainerGroups, '2018-04-01/generated/azure_mgmt_container_instance/container_groups.rb'
autoload :Operations, '2018-04-01/generated/azure_mgmt_container_instance/operations.rb'
autoload :ContainerGroupUsage, '2018-04-01/generated/azure_mgmt_container_instance/container_group_usage.rb'
autoload :ContainerLogs, '2018-04-01/generated/azure_mgmt_container_instance/container_logs.rb'
autoload :StartContainer, '2018-04-01/generated/azure_mgmt_container_instance/start_container.rb'
autoload :ContainerInstanceManagementClient, '2018-04-01/generated/azure_mgmt_container_instance/container_instance_management_client.rb'

module Models
autoload :IpAddress, '2018-04-01/generated/azure_mgmt_container_instance/models/ip_address.rb'
autoload :ContainerPort, '2018-04-01/generated/azure_mgmt_container_instance/models/container_port.rb'
autoload :ContainerGroupPropertiesInstanceView, '2018-04-01/generated/azure_mgmt_container_instance/models/container_group_properties_instance_view.rb'
autoload :ContainerState, '2018-04-01/generated/azure_mgmt_container_instance/models/container_state.rb'
autoload :Event, '2018-04-01/generated/azure_mgmt_container_instance/models/event.rb'
autoload :ResourceRequests, '2018-04-01/generated/azure_mgmt_container_instance/models/resource_requests.rb'
autoload :OperationDisplay, '2018-04-01/generated/azure_mgmt_container_instance/models/operation_display.rb'
autoload :ResourceRequirements, '2018-04-01/generated/azure_mgmt_container_instance/models/resource_requirements.rb'
autoload :Operation, '2018-04-01/generated/azure_mgmt_container_instance/models/operation.rb'
autoload :Container, '2018-04-01/generated/azure_mgmt_container_instance/models/container.rb'
autoload :OperationListResult, '2018-04-01/generated/azure_mgmt_container_instance/models/operation_list_result.rb'
autoload :GitRepoVolume, '2018-04-01/generated/azure_mgmt_container_instance/models/git_repo_volume.rb'
autoload :UsageName, '2018-04-01/generated/azure_mgmt_container_instance/models/usage_name.rb'
autoload :ImageRegistryCredential, '2018-04-01/generated/azure_mgmt_container_instance/models/image_registry_credential.rb'
autoload :Usage, '2018-04-01/generated/azure_mgmt_container_instance/models/usage.rb'
autoload :EnvironmentVariable, '2018-04-01/generated/azure_mgmt_container_instance/models/environment_variable.rb'
autoload :UsageListResult, '2018-04-01/generated/azure_mgmt_container_instance/models/usage_list_result.rb'
autoload :ResourceLimits, '2018-04-01/generated/azure_mgmt_container_instance/models/resource_limits.rb'
autoload :ContainerGroupListResult, '2018-04-01/generated/azure_mgmt_container_instance/models/container_group_list_result.rb'
autoload :AzureFileVolume, '2018-04-01/generated/azure_mgmt_container_instance/models/azure_file_volume.rb'
autoload :Logs, '2018-04-01/generated/azure_mgmt_container_instance/models/logs.rb'
autoload :Port, '2018-04-01/generated/azure_mgmt_container_instance/models/port.rb'
autoload :ContainerExecRequestTerminalSize, '2018-04-01/generated/azure_mgmt_container_instance/models/container_exec_request_terminal_size.rb'
autoload :VolumeMount, '2018-04-01/generated/azure_mgmt_container_instance/models/volume_mount.rb'
autoload :ContainerExecRequest, '2018-04-01/generated/azure_mgmt_container_instance/models/container_exec_request.rb'
autoload :ContainerPropertiesInstanceView, '2018-04-01/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb'
autoload :ContainerExecResponse, '2018-04-01/generated/azure_mgmt_container_instance/models/container_exec_response.rb'
autoload :Volume, '2018-04-01/generated/azure_mgmt_container_instance/models/volume.rb'
autoload :Resource, '2018-04-01/generated/azure_mgmt_container_instance/models/resource.rb'
autoload :ContainerGroup, '2018-04-01/generated/azure_mgmt_container_instance/models/container_group.rb'
autoload :ContainerNetworkProtocol, '2018-04-01/generated/azure_mgmt_container_instance/models/container_network_protocol.rb'
autoload :ContainerGroupRestartPolicy, '2018-04-01/generated/azure_mgmt_container_instance/models/container_group_restart_policy.rb'
autoload :ContainerGroupNetworkProtocol, '2018-04-01/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb'
autoload :OperatingSystemTypes, '2018-04-01/generated/azure_mgmt_container_instance/models/operating_system_types.rb'
autoload :ContainerInstanceOperationsOrigin, '2018-04-01/generated/azure_mgmt_container_instance/models/container_instance_operations_origin.rb'
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::ContainerInstance::Mgmt::V2018_02_01_preview
#
# ContainerGroupUsage
#
class ContainerGroupUsage
include MsRestAzure

#
# Creates and initializes a new instance of the ContainerGroupUsage class.
# @param client service class for accessing basic functionality.
#
def initialize(client)
@client = client
end

# @return [ContainerInstanceManagementClient] reference to the ContainerInstanceManagementClient
attr_reader :client

#
# Get the usage for a subscription
#
# @param location [String] The identifier for the physical azure location.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [UsageListResult] operation results.
#
def list(location, custom_headers = nil)
response = list_async(location, custom_headers).value!
response.body unless response.nil?
end

#
# Get the usage for a subscription
#
# @param location [String] The identifier for the physical azure location.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_with_http_info(location, custom_headers = nil)
list_async(location, custom_headers).value!
end

#
# Get the usage for a subscription
#
# @param location [String] The identifier for the physical azure location.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_async(location, custom_headers = nil)
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, 'location is nil' if location.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


request_headers = {}

# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages'

request_url = @base_url || @client.base_url

options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)

promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end

result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::ContainerInstance::Mgmt::V2018_02_01_preview::Models::UsageListResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end

result
end

promise.execute
end

end
end
Loading