azure_mgmt_batch 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,18 +35,17 @@ module Azure::ARM::Batch
35
35
  # is generated and included in each request. Default is true.
36
36
  attr_accessor :generate_client_request_id
37
37
 
38
- # @return Subscription credentials which uniquely identify client
39
- # subscription.
40
- attr_accessor :credentials
38
+ # @return [BatchAccountOperations] batch_account_operations
39
+ attr_reader :batch_account_operations
41
40
 
42
- # @return [Account] account
43
- attr_reader :account
41
+ # @return [ApplicationPackageOperations] application_package_operations
42
+ attr_reader :application_package_operations
44
43
 
45
44
  # @return [ApplicationOperations] application_operations
46
45
  attr_reader :application_operations
47
46
 
48
- # @return [Subscription] subscription
49
- attr_reader :subscription
47
+ # @return [Location] location
48
+ attr_reader :location
50
49
 
51
50
  #
52
51
  # Creates initializes a new instance of the BatchManagementClient class.
@@ -62,14 +61,70 @@ module Azure::ARM::Batch
62
61
  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
63
62
  @credentials = credentials
64
63
 
65
- @account = Account.new(self)
64
+ @batch_account_operations = BatchAccountOperations.new(self)
65
+ @application_package_operations = ApplicationPackageOperations.new(self)
66
66
  @application_operations = ApplicationOperations.new(self)
67
- @subscription = Subscription.new(self)
67
+ @location = Location.new(self)
68
68
  @api_version = '2015-12-01'
69
69
  @accept_language = 'en-US'
70
70
  @long_running_operation_retry_timeout = 30
71
71
  @generate_client_request_id = true
72
72
  end
73
73
 
74
+ #
75
+ # Makes a request and returns the body of the response.
76
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
77
+ # @param path [String] the path, relative to {base_url}.
78
+ # @param options [Hash{String=>String}] specifying any request options like :body.
79
+ # @return [Hash{String=>String}] containing the body of the response.
80
+ # Example:
81
+ #
82
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
83
+ # path = "/path"
84
+ # options = {
85
+ # body: request_content,
86
+ # query_params: {'api-version' => '2016-02-01'}
87
+ # }
88
+ # result = @client.make_request(:put, path, options)
89
+ #
90
+ def make_request(method, path, options = {})
91
+ result = make_request_with_http_info(method, path, options)
92
+ result.body unless result.nil?
93
+ end
94
+
95
+ #
96
+ # Makes a request and returns the operation response.
97
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
98
+ # @param path [String] the path, relative to {base_url}.
99
+ # @param options [Hash{String=>String}] specifying any request options like :body.
100
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
101
+ #
102
+ def make_request_with_http_info(method, path, options = {})
103
+ result = make_request_async(method, path, options).value!
104
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
105
+ result
106
+ end
107
+
108
+ #
109
+ # Makes a request asynchronously.
110
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
111
+ # @param path [String] the path, relative to {base_url}.
112
+ # @param options [Hash{String=>String}] specifying any request options like :body.
113
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
114
+ #
115
+ def make_request_async(method, path, options = {})
116
+ fail ArgumentError, 'method is nil' if method.nil?
117
+ fail ArgumentError, 'path is nil' if path.nil?
118
+
119
+ request_url = options[:base_url] || @base_url
120
+
121
+ request_headers = @request_headers
122
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
123
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
124
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
125
+
126
+ super(request_url, method, path, options)
127
+ end
128
+
74
129
  end
75
130
  end
@@ -5,14 +5,14 @@
5
5
 
6
6
  module Azure::ARM::Batch
7
7
  #
8
- # Subscription
8
+ # Location
9
9
  #
10
- class Subscription
10
+ class Location
11
11
  include Azure::ARM::Batch::Models
12
12
  include MsRestAzure
13
13
 
14
14
  #
15
- # Creates and initializes a new instance of the Subscription class.
15
+ # Creates and initializes a new instance of the Location class.
16
16
  # @param client service class for accessing basic functionality.
17
17
  #
18
18
  def initialize(client)
@@ -23,21 +23,23 @@ module Azure::ARM::Batch
23
23
  attr_reader :client
24
24
 
25
25
  #
26
- # Gets the Batch service quotas for the specified suscription.
26
+ # Gets the Batch service quotas for the specified subscription at the given
27
+ # location.
27
28
  #
28
29
  # @param location_name [String] The desired region for the quotas.
29
30
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
31
  # will be added to the HTTP request.
31
32
  #
32
- # @return [SubscriptionQuotasGetResult] operation results.
33
+ # @return [BatchLocationQuota] operation results.
33
34
  #
34
- def get_subscription_quotas(location_name, custom_headers = nil)
35
- response = get_subscription_quotas_async(location_name, custom_headers).value!
35
+ def get_quotas(location_name, custom_headers = nil)
36
+ response = get_quotas_async(location_name, custom_headers).value!
36
37
  response.body unless response.nil?
37
38
  end
38
39
 
39
40
  #
40
- # Gets the Batch service quotas for the specified suscription.
41
+ # Gets the Batch service quotas for the specified subscription at the given
42
+ # location.
41
43
  #
42
44
  # @param location_name [String] The desired region for the quotas.
43
45
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
@@ -45,12 +47,13 @@ module Azure::ARM::Batch
45
47
  #
46
48
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
49
  #
48
- def get_subscription_quotas_with_http_info(location_name, custom_headers = nil)
49
- get_subscription_quotas_async(location_name, custom_headers).value!
50
+ def get_quotas_with_http_info(location_name, custom_headers = nil)
51
+ get_quotas_async(location_name, custom_headers).value!
50
52
  end
51
53
 
52
54
  #
53
- # Gets the Batch service quotas for the specified suscription.
55
+ # Gets the Batch service quotas for the specified subscription at the given
56
+ # location.
54
57
  #
55
58
  # @param location_name [String] The desired region for the quotas.
56
59
  # @param [Hash{String => String}] A hash of custom headers that will be added
@@ -58,7 +61,7 @@ module Azure::ARM::Batch
58
61
  #
59
62
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
60
63
  #
61
- def get_subscription_quotas_async(location_name, custom_headers = nil)
64
+ def get_quotas_async(location_name, custom_headers = nil)
62
65
  fail ArgumentError, 'location_name is nil' if location_name.nil?
63
66
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
67
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -70,36 +73,33 @@ module Azure::ARM::Batch
70
73
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
74
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
75
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas'
76
+
77
+ request_url = @base_url || @client.base_url
78
+
73
79
  options = {
74
80
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
75
81
  path_params: {'locationName' => location_name,'subscriptionId' => @client.subscription_id},
76
82
  query_params: {'api-version' => @client.api_version},
77
- headers: request_headers.merge(custom_headers || {})
83
+ headers: request_headers.merge(custom_headers || {}),
84
+ base_url: request_url
78
85
  }
86
+ promise = @client.make_request_async(:get, path_template, options)
79
87
 
80
- request_url = @base_url || @client.base_url
81
-
82
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
83
- promise = request.run_promise do |req|
84
- @client.credentials.sign_request(req) unless @client.credentials.nil?
85
- end
86
-
87
- promise = promise.then do |http_response|
88
+ promise = promise.then do |result|
89
+ http_response = result.response
88
90
  status_code = http_response.status
89
91
  response_content = http_response.body
90
92
  unless status_code == 200
91
93
  error_model = JSON.load(response_content)
92
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
94
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
93
95
  end
94
96
 
95
- # Create Result
96
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
97
97
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
98
98
  # Deserialize Response
99
99
  if status_code == 200
100
100
  begin
101
101
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
102
- result_mapper = SubscriptionQuotasGetResult.mapper()
102
+ result_mapper = BatchLocationQuota.mapper()
103
103
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
104
104
  rescue Exception => e
105
105
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -6,12 +6,16 @@
6
6
  module Azure::ARM::Batch
7
7
  module Models
8
8
  #
9
- # Contains information about an application package.
9
+ # An application package which represents a particular version of an
10
+ # application.
10
11
  #
11
12
  class ApplicationPackage
12
13
 
13
14
  include MsRestAzure
14
15
 
16
+ # @return [String] The id of the application.
17
+ attr_accessor :id
18
+
15
19
  # @return [String] The version of the application package.
16
20
  attr_accessor :version
17
21
 
@@ -20,9 +24,16 @@ module Azure::ARM::Batch
20
24
  attr_accessor :state
21
25
 
22
26
  # @return [String] The format of the application package, if the package
23
- # has been activated.
27
+ # is active.
24
28
  attr_accessor :format
25
29
 
30
+ # @return [String] The storage URL at which the application package is
31
+ # stored.
32
+ attr_accessor :storage_url
33
+
34
+ # @return [DateTime] The UTC time at which the storage URL will expire.
35
+ attr_accessor :storage_url_expiry
36
+
26
37
  # @return [DateTime] The time at which the package was last activated,
27
38
  # if the package is active.
28
39
  attr_accessor :last_activation_time
@@ -40,6 +51,13 @@ module Azure::ARM::Batch
40
51
  name: 'Composite',
41
52
  class_name: 'ApplicationPackage',
42
53
  model_properties: {
54
+ id: {
55
+ required: false,
56
+ serialized_name: 'id',
57
+ type: {
58
+ name: 'String'
59
+ }
60
+ },
43
61
  version: {
44
62
  required: false,
45
63
  serialized_name: 'version',
@@ -62,6 +80,20 @@ module Azure::ARM::Batch
62
80
  name: 'String'
63
81
  }
64
82
  },
83
+ storage_url: {
84
+ required: false,
85
+ serialized_name: 'storageUrl',
86
+ type: {
87
+ name: 'String'
88
+ }
89
+ },
90
+ storage_url_expiry: {
91
+ required: false,
92
+ serialized_name: 'storageUrlExpiry',
93
+ type: {
94
+ name: 'DateTime'
95
+ }
96
+ },
65
97
  last_activation_time: {
66
98
  required: false,
67
99
  serialized_name: 'lastActivationTime',
@@ -8,7 +8,7 @@ module Azure::ARM::Batch
8
8
  #
9
9
  # Contains information about an Azure Batch account.
10
10
  #
11
- class AccountResource < MsRestAzure::Resource
11
+ class BatchAccount < MsRestAzure::Resource
12
12
 
13
13
  include MsRestAzure
14
14
 
@@ -16,8 +16,8 @@ module Azure::ARM::Batch
16
16
  # the Batch services.
17
17
  attr_accessor :account_endpoint
18
18
 
19
- # @return [AccountProvisioningState] The provisioned state of the
20
- # resource. Possible values include: 'Invalid', 'Creating', 'Deleting',
19
+ # @return [ProvisioningState] The provisioned state of the resource.
20
+ # Possible values include: 'Invalid', 'Creating', 'Deleting',
21
21
  # 'Succeeded', 'Failed', 'Cancelled'
22
22
  attr_accessor :provisioning_state
23
23
 
@@ -37,16 +37,16 @@ module Azure::ARM::Batch
37
37
 
38
38
 
39
39
  #
40
- # Mapper for AccountResource class as Ruby Hash.
40
+ # Mapper for BatchAccount class as Ruby Hash.
41
41
  # This will be used for serialization/deserialization.
42
42
  #
43
43
  def self.mapper()
44
44
  {
45
45
  required: false,
46
- serialized_name: 'AccountResource',
46
+ serialized_name: 'BatchAccount',
47
47
  type: {
48
48
  name: 'Composite',
49
- class_name: 'AccountResource',
49
+ class_name: 'BatchAccount',
50
50
  model_properties: {
51
51
  id: {
52
52
  required: false,
@@ -95,6 +95,7 @@ module Azure::ARM::Batch
95
95
  },
96
96
  account_endpoint: {
97
97
  required: false,
98
+ read_only: true,
98
99
  serialized_name: 'properties.accountEndpoint',
99
100
  type: {
100
101
  name: 'String'
@@ -105,7 +106,7 @@ module Azure::ARM::Batch
105
106
  serialized_name: 'properties.provisioningState',
106
107
  type: {
107
108
  name: 'Enum',
108
- module: 'AccountProvisioningState'
109
+ module: 'ProvisioningState'
109
110
  }
110
111
  },
111
112
  auto_storage: {
@@ -12,7 +12,7 @@ module Azure::ARM::Batch
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] The region in which the account is created.
15
+ # @return [String] The region in which to create the account.
16
16
  attr_accessor :location
17
17
 
18
18
  # @return [Hash{String => String}] The user specified tags associated
@@ -37,7 +37,7 @@ module Azure::ARM::Batch
37
37
  class_name: 'BatchAccountCreateParameters',
38
38
  model_properties: {
39
39
  location: {
40
- required: false,
40
+ required: true,
41
41
  serialized_name: 'location',
42
42
  type: {
43
43
  name: 'String'
@@ -6,9 +6,9 @@
6
6
  module Azure::ARM::Batch
7
7
  module Models
8
8
  #
9
- # Values returned by the GetKeys operation.
9
+ # A set of Azure Batch account keys.
10
10
  #
11
- class BatchAccountListKeyResult
11
+ class BatchAccountKeys
12
12
 
13
13
  include MsRestAzure
14
14
 
@@ -20,16 +20,16 @@ module Azure::ARM::Batch
20
20
 
21
21
 
22
22
  #
23
- # Mapper for BatchAccountListKeyResult class as Ruby Hash.
23
+ # Mapper for BatchAccountKeys class as Ruby Hash.
24
24
  # This will be used for serialization/deserialization.
25
25
  #
26
26
  def self.mapper()
27
27
  {
28
28
  required: false,
29
- serialized_name: 'BatchAccountListKeyResult',
29
+ serialized_name: 'BatchAccountKeys',
30
30
  type: {
31
31
  name: 'Composite',
32
- class_name: 'BatchAccountListKeyResult',
32
+ class_name: 'BatchAccountKeys',
33
33
  model_properties: {
34
34
  primary: {
35
35
  required: false,
@@ -12,8 +12,8 @@ module Azure::ARM::Batch
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Array<AccountResource>] The collection of returned account
16
- # resources.
15
+ # @return [Array<BatchAccount>] The collection of returned Batch
16
+ # accounts.
17
17
  attr_accessor :value
18
18
 
19
19
  # @return [String] The continuation token.
@@ -25,7 +25,7 @@ module Azure::ARM::Batch
25
25
  #
26
26
  # Gets the rest of the items for the request, enabling auto-pagination.
27
27
  #
28
- # @return [Array<AccountResource>] operation results.
28
+ # @return [Array<BatchAccount>] operation results.
29
29
  #
30
30
  def get_all_items
31
31
  items = @value
@@ -70,10 +70,10 @@ module Azure::ARM::Batch
70
70
  name: 'Sequence',
71
71
  element: {
72
72
  required: false,
73
- serialized_name: 'AccountResourceElementType',
73
+ serialized_name: 'BatchAccountElementType',
74
74
  type: {
75
75
  name: 'Composite',
76
- class_name: 'AccountResource'
76
+ class_name: 'BatchAccount'
77
77
  }
78
78
  }
79
79
  }
@@ -6,9 +6,9 @@
6
6
  module Azure::ARM::Batch
7
7
  module Models
8
8
  #
9
- # Values returned by the Get Subscription Quotas operation.
9
+ # Quotas associated with a Batch region for a particular subscription.
10
10
  #
11
- class SubscriptionQuotasGetResult
11
+ class BatchLocationQuota
12
12
 
13
13
  include MsRestAzure
14
14
 
@@ -18,16 +18,16 @@ module Azure::ARM::Batch
18
18
 
19
19
 
20
20
  #
21
- # Mapper for SubscriptionQuotasGetResult class as Ruby Hash.
21
+ # Mapper for BatchLocationQuota class as Ruby Hash.
22
22
  # This will be used for serialization/deserialization.
23
23
  #
24
24
  def self.mapper()
25
25
  {
26
26
  required: false,
27
- serialized_name: 'SubscriptionQuotasGetResult',
27
+ serialized_name: 'BatchLocationQuota',
28
28
  type: {
29
29
  name: 'Composite',
30
- class_name: 'SubscriptionQuotasGetResult',
30
+ class_name: 'BatchLocationQuota',
31
31
  model_properties: {
32
32
  account_quota: {
33
33
  required: false,