haipa_compute 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/1.0/generated/haipa_compute.rb +53 -53
- data/lib/1.0/generated/haipa_compute/haipa_compute.rb +136 -136
- data/lib/1.0/generated/haipa_compute/machines.rb +578 -578
- data/lib/1.0/generated/haipa_compute/models/agent.rb +87 -87
- data/lib/1.0/generated/haipa_compute/models/agent_network.rb +93 -93
- data/lib/1.0/generated/haipa_compute/models/machine.rb +125 -125
- data/lib/1.0/generated/haipa_compute/models/machine_config.rb +91 -91
- data/lib/1.0/generated/haipa_compute/models/machine_network.rb +187 -187
- data/lib/1.0/generated/haipa_compute/models/machine_network_config.rb +67 -67
- data/lib/1.0/generated/haipa_compute/models/machine_subnet_config.rb +47 -47
- data/lib/1.0/generated/haipa_compute/models/network.rb +109 -109
- data/lib/1.0/generated/haipa_compute/models/odata_value_ienumerable_machine.rb +56 -56
- data/lib/1.0/generated/haipa_compute/models/odata_value_ienumerable_operation.rb +56 -56
- data/lib/1.0/generated/haipa_compute/models/odata_value_ienumerable_operation_log.rb +56 -56
- data/lib/1.0/generated/haipa_compute/models/operation.rb +123 -123
- data/lib/1.0/generated/haipa_compute/models/operation_log.rb +81 -81
- data/lib/1.0/generated/haipa_compute/models/subnet.rb +144 -144
- data/lib/1.0/generated/haipa_compute/models/virtual_machine.rb +90 -90
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_config.rb +111 -111
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_cpu_config.rb +47 -47
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_disk_config.rb +80 -80
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_memory_config.rb +69 -69
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_network_adapter.rb +92 -92
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_network_adapter_config.rb +69 -69
- data/lib/1.0/generated/haipa_compute/models/virtual_machine_provisioning_config.rb +58 -58
- data/lib/1.0/generated/haipa_compute/module_definition.rb +9 -9
- data/lib/1.0/generated/haipa_compute/networks.rb +415 -415
- data/lib/1.0/generated/haipa_compute/operations.rb +347 -347
- data/lib/1.0/generated/haipa_compute/subnets.rb +100 -100
- data/lib/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff81bd40ff30db857a8c77436f818c21636e84978255168b4b5e1925a8e58cbe
|
4
|
+
data.tar.gz: 37b4937c6f6dca0ab0dbcf814387d2e0432e9f0f9e399ba138a6945db8d88031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb7fe47704646a1cc2bc60c6e6582624af9962c92dba1d81acfc572422fea9fc105c72a4fbd21a2e1d98e0b65886fa3552edeff972e80ed0bba320ad7fcb152b
|
7
|
+
data.tar.gz: d0cc29320d14a2197cdac0634dfc257eb653570623aef2984e81fcba4554846f43a9614182af4d7c1cc87ff6e04426a994d7a1c5fe42db420ced069ccb3362bf
|
@@ -1,53 +1,53 @@
|
|
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 '1.0/generated/haipa_compute/module_definition'
|
20
|
-
require 'haipa_rest'
|
21
|
-
|
22
|
-
module Haipa::Client::Compute::V1_0
|
23
|
-
autoload :Machines, '1.0/generated/haipa_compute/machines.rb'
|
24
|
-
autoload :Networks, '1.0/generated/haipa_compute/networks.rb'
|
25
|
-
autoload :Operations, '1.0/generated/haipa_compute/operations.rb'
|
26
|
-
autoload :Subnets, '1.0/generated/haipa_compute/subnets.rb'
|
27
|
-
autoload :HaipaCompute, '1.0/generated/haipa_compute/haipa_compute.rb'
|
28
|
-
|
29
|
-
module Models
|
30
|
-
autoload :VirtualMachineDiskConfig, '1.0/generated/haipa_compute/models/virtual_machine_disk_config.rb'
|
31
|
-
autoload :Subnet, '1.0/generated/haipa_compute/models/subnet.rb'
|
32
|
-
autoload :VirtualMachineNetworkAdapterConfig, '1.0/generated/haipa_compute/models/virtual_machine_network_adapter_config.rb'
|
33
|
-
autoload :AgentNetwork, '1.0/generated/haipa_compute/models/agent_network.rb'
|
34
|
-
autoload :VirtualMachineConfig, '1.0/generated/haipa_compute/models/virtual_machine_config.rb'
|
35
|
-
autoload :VirtualMachineNetworkAdapter, '1.0/generated/haipa_compute/models/virtual_machine_network_adapter.rb'
|
36
|
-
autoload :MachineSubnetConfig, '1.0/generated/haipa_compute/models/machine_subnet_config.rb'
|
37
|
-
autoload :MachineNetwork, '1.0/generated/haipa_compute/models/machine_network.rb'
|
38
|
-
autoload :MachineNetworkConfig, '1.0/generated/haipa_compute/models/machine_network_config.rb'
|
39
|
-
autoload :ODataValueIEnumerableMachine, '1.0/generated/haipa_compute/models/odata_value_ienumerable_machine.rb'
|
40
|
-
autoload :VirtualMachineProvisioningConfig, '1.0/generated/haipa_compute/models/virtual_machine_provisioning_config.rb'
|
41
|
-
autoload :VirtualMachineMemoryConfig, '1.0/generated/haipa_compute/models/virtual_machine_memory_config.rb'
|
42
|
-
autoload :MachineConfig, '1.0/generated/haipa_compute/models/machine_config.rb'
|
43
|
-
autoload :Agent, '1.0/generated/haipa_compute/models/agent.rb'
|
44
|
-
autoload :OperationLog, '1.0/generated/haipa_compute/models/operation_log.rb'
|
45
|
-
autoload :Machine, '1.0/generated/haipa_compute/models/machine.rb'
|
46
|
-
autoload :Operation, '1.0/generated/haipa_compute/models/operation.rb'
|
47
|
-
autoload :Network, '1.0/generated/haipa_compute/models/network.rb'
|
48
|
-
autoload :ODataValueIEnumerableOperation, '1.0/generated/haipa_compute/models/odata_value_ienumerable_operation.rb'
|
49
|
-
autoload :VirtualMachineCpuConfig, '1.0/generated/haipa_compute/models/virtual_machine_cpu_config.rb'
|
50
|
-
autoload :ODataValueIEnumerableOperationLog, '1.0/generated/haipa_compute/models/odata_value_ienumerable_operation_log.rb'
|
51
|
-
autoload :VirtualMachine, '1.0/generated/haipa_compute/models/virtual_machine.rb'
|
52
|
-
end
|
53
|
-
end
|
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 '1.0/generated/haipa_compute/module_definition'
|
20
|
+
require 'haipa_rest'
|
21
|
+
|
22
|
+
module Haipa::Client::Compute::V1_0
|
23
|
+
autoload :Machines, '1.0/generated/haipa_compute/machines.rb'
|
24
|
+
autoload :Networks, '1.0/generated/haipa_compute/networks.rb'
|
25
|
+
autoload :Operations, '1.0/generated/haipa_compute/operations.rb'
|
26
|
+
autoload :Subnets, '1.0/generated/haipa_compute/subnets.rb'
|
27
|
+
autoload :HaipaCompute, '1.0/generated/haipa_compute/haipa_compute.rb'
|
28
|
+
|
29
|
+
module Models
|
30
|
+
autoload :VirtualMachineDiskConfig, '1.0/generated/haipa_compute/models/virtual_machine_disk_config.rb'
|
31
|
+
autoload :Subnet, '1.0/generated/haipa_compute/models/subnet.rb'
|
32
|
+
autoload :VirtualMachineNetworkAdapterConfig, '1.0/generated/haipa_compute/models/virtual_machine_network_adapter_config.rb'
|
33
|
+
autoload :AgentNetwork, '1.0/generated/haipa_compute/models/agent_network.rb'
|
34
|
+
autoload :VirtualMachineConfig, '1.0/generated/haipa_compute/models/virtual_machine_config.rb'
|
35
|
+
autoload :VirtualMachineNetworkAdapter, '1.0/generated/haipa_compute/models/virtual_machine_network_adapter.rb'
|
36
|
+
autoload :MachineSubnetConfig, '1.0/generated/haipa_compute/models/machine_subnet_config.rb'
|
37
|
+
autoload :MachineNetwork, '1.0/generated/haipa_compute/models/machine_network.rb'
|
38
|
+
autoload :MachineNetworkConfig, '1.0/generated/haipa_compute/models/machine_network_config.rb'
|
39
|
+
autoload :ODataValueIEnumerableMachine, '1.0/generated/haipa_compute/models/odata_value_ienumerable_machine.rb'
|
40
|
+
autoload :VirtualMachineProvisioningConfig, '1.0/generated/haipa_compute/models/virtual_machine_provisioning_config.rb'
|
41
|
+
autoload :VirtualMachineMemoryConfig, '1.0/generated/haipa_compute/models/virtual_machine_memory_config.rb'
|
42
|
+
autoload :MachineConfig, '1.0/generated/haipa_compute/models/machine_config.rb'
|
43
|
+
autoload :Agent, '1.0/generated/haipa_compute/models/agent.rb'
|
44
|
+
autoload :OperationLog, '1.0/generated/haipa_compute/models/operation_log.rb'
|
45
|
+
autoload :Machine, '1.0/generated/haipa_compute/models/machine.rb'
|
46
|
+
autoload :Operation, '1.0/generated/haipa_compute/models/operation.rb'
|
47
|
+
autoload :Network, '1.0/generated/haipa_compute/models/network.rb'
|
48
|
+
autoload :ODataValueIEnumerableOperation, '1.0/generated/haipa_compute/models/odata_value_ienumerable_operation.rb'
|
49
|
+
autoload :VirtualMachineCpuConfig, '1.0/generated/haipa_compute/models/virtual_machine_cpu_config.rb'
|
50
|
+
autoload :ODataValueIEnumerableOperationLog, '1.0/generated/haipa_compute/models/odata_value_ienumerable_operation_log.rb'
|
51
|
+
autoload :VirtualMachine, '1.0/generated/haipa_compute/models/virtual_machine.rb'
|
52
|
+
end
|
53
|
+
end
|
@@ -1,136 +1,136 @@
|
|
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 Haipa::Client::Compute::V1_0
|
7
|
-
#
|
8
|
-
# A service client - single point of access to the REST API.
|
9
|
-
#
|
10
|
-
class HaipaCompute < Haipa::Client::HaipaServiceClient
|
11
|
-
include Haipa::Client
|
12
|
-
include Haipa::Client::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] The preferred language for the response.
|
21
|
-
attr_accessor :accept_language
|
22
|
-
|
23
|
-
# @return [Integer] The retry timeout in seconds for Long Running
|
24
|
-
# Operations. Default value is 30.
|
25
|
-
attr_accessor :long_running_operation_retry_timeout
|
26
|
-
|
27
|
-
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
28
|
-
# generated. When set to true a unique x-ms-client-request-id value is
|
29
|
-
# generated and included in each request. Default is true.
|
30
|
-
attr_accessor :generate_client_request_id
|
31
|
-
|
32
|
-
# @return [Machines] machines
|
33
|
-
attr_reader :machines
|
34
|
-
|
35
|
-
# @return [Networks] networks
|
36
|
-
attr_reader :networks
|
37
|
-
|
38
|
-
# @return [Operations] operations
|
39
|
-
attr_reader :operations
|
40
|
-
|
41
|
-
# @return [Subnets] subnets
|
42
|
-
attr_reader :subnets
|
43
|
-
|
44
|
-
#
|
45
|
-
# Creates initializes a new instance of the HaipaCompute class.
|
46
|
-
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
47
|
-
# @param base_url [String] the base URI of the service.
|
48
|
-
# @param options [Array] filters to be applied to the HTTP requests.
|
49
|
-
#
|
50
|
-
def initialize(credentials = nil, base_url = nil, options = nil)
|
51
|
-
super(credentials, options)
|
52
|
-
@base_url = base_url || 'http://localhost/api'
|
53
|
-
|
54
|
-
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
55
|
-
@credentials = credentials
|
56
|
-
|
57
|
-
@machines = Machines.new(self)
|
58
|
-
@networks = Networks.new(self)
|
59
|
-
@operations = Operations.new(self)
|
60
|
-
@subnets = Subnets.new(self)
|
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 [Haipa::Client::HaipaOperationResponse] 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
|
-
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
114
|
-
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
115
|
-
end
|
116
|
-
|
117
|
-
request_headers = @request_headers
|
118
|
-
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
119
|
-
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
120
|
-
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
121
|
-
|
122
|
-
super(request_url, method, path, options)
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
private
|
127
|
-
#
|
128
|
-
# Adds telemetry information.
|
129
|
-
#
|
130
|
-
def add_telemetry
|
131
|
-
sdk_information = 'haipa_compute'
|
132
|
-
sdk_information = "#{sdk_information}/0.0.1"
|
133
|
-
add_user_agent_information(sdk_information)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
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 Haipa::Client::Compute::V1_0
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class HaipaCompute < Haipa::Client::HaipaServiceClient
|
11
|
+
include Haipa::Client
|
12
|
+
include Haipa::Client::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] The preferred language for the response.
|
21
|
+
attr_accessor :accept_language
|
22
|
+
|
23
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
24
|
+
# Operations. Default value is 30.
|
25
|
+
attr_accessor :long_running_operation_retry_timeout
|
26
|
+
|
27
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
28
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
29
|
+
# generated and included in each request. Default is true.
|
30
|
+
attr_accessor :generate_client_request_id
|
31
|
+
|
32
|
+
# @return [Machines] machines
|
33
|
+
attr_reader :machines
|
34
|
+
|
35
|
+
# @return [Networks] networks
|
36
|
+
attr_reader :networks
|
37
|
+
|
38
|
+
# @return [Operations] operations
|
39
|
+
attr_reader :operations
|
40
|
+
|
41
|
+
# @return [Subnets] subnets
|
42
|
+
attr_reader :subnets
|
43
|
+
|
44
|
+
#
|
45
|
+
# Creates initializes a new instance of the HaipaCompute class.
|
46
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
47
|
+
# @param base_url [String] the base URI of the service.
|
48
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
49
|
+
#
|
50
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
51
|
+
super(credentials, options)
|
52
|
+
@base_url = base_url || 'http://localhost/api'
|
53
|
+
|
54
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
55
|
+
@credentials = credentials
|
56
|
+
|
57
|
+
@machines = Machines.new(self)
|
58
|
+
@networks = Networks.new(self)
|
59
|
+
@operations = Operations.new(self)
|
60
|
+
@subnets = Subnets.new(self)
|
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 [Haipa::Client::HaipaOperationResponse] 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
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
114
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
115
|
+
end
|
116
|
+
|
117
|
+
request_headers = @request_headers
|
118
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
119
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
120
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
121
|
+
|
122
|
+
super(request_url, method, path, options)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
private
|
127
|
+
#
|
128
|
+
# Adds telemetry information.
|
129
|
+
#
|
130
|
+
def add_telemetry
|
131
|
+
sdk_information = 'haipa_compute'
|
132
|
+
sdk_information = "#{sdk_information}/0.0.1"
|
133
|
+
add_user_agent_information(sdk_information)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -1,578 +1,578 @@
|
|
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 Haipa::Client::Compute::V1_0
|
7
|
-
#
|
8
|
-
# Haipa management API
|
9
|
-
#
|
10
|
-
class Machines
|
11
|
-
include Haipa::Client
|
12
|
-
|
13
|
-
#
|
14
|
-
# Creates and initializes a new instance of the Machines class.
|
15
|
-
# @param client service class for accessing basic functionality.
|
16
|
-
#
|
17
|
-
def initialize(client)
|
18
|
-
@client = client
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [HaipaCompute] reference to the HaipaCompute
|
22
|
-
attr_reader :client
|
23
|
-
|
24
|
-
#
|
25
|
-
# @param select [String] Limits the properties returned in the result.
|
26
|
-
# @param expand [String] Indicates the related entities to be represented
|
27
|
-
# inline. The maximum depth is 2.
|
28
|
-
# @param filter [String] Restricts the set of items returned. The maximum
|
29
|
-
# number of expressions is 100. The allowed functions are: allfunctions.
|
30
|
-
# @param orderby [String] Specifies the order in which items are returned. The
|
31
|
-
# maximum number of expressions is 5.
|
32
|
-
# @param top [Integer] Limits the number of items returned from a collection.
|
33
|
-
# @param skip [Integer] Excludes the specified number of items of the queried
|
34
|
-
# collection from the result.
|
35
|
-
# @param count [Boolean] Indicates whether the total count of items within a
|
36
|
-
# collection are returned in the result.
|
37
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
38
|
-
# will be added to the HTTP request.
|
39
|
-
#
|
40
|
-
# @return [ODataValueIEnumerableMachine] operation results.
|
41
|
-
#
|
42
|
-
def list(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
|
43
|
-
response = list_async(select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
|
44
|
-
response.body unless response.nil?
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
# @param select [String] Limits the properties returned in the result.
|
49
|
-
# @param expand [String] Indicates the related entities to be represented
|
50
|
-
# inline. The maximum depth is 2.
|
51
|
-
# @param filter [String] Restricts the set of items returned. The maximum
|
52
|
-
# number of expressions is 100. The allowed functions are: allfunctions.
|
53
|
-
# @param orderby [String] Specifies the order in which items are returned. The
|
54
|
-
# maximum number of expressions is 5.
|
55
|
-
# @param top [Integer] Limits the number of items returned from a collection.
|
56
|
-
# @param skip [Integer] Excludes the specified number of items of the queried
|
57
|
-
# collection from the result.
|
58
|
-
# @param count [Boolean] Indicates whether the total count of items within a
|
59
|
-
# collection are returned in the result.
|
60
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
61
|
-
# will be added to the HTTP request.
|
62
|
-
#
|
63
|
-
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
64
|
-
#
|
65
|
-
def list_with_http_info(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
|
66
|
-
list_async(select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
|
67
|
-
end
|
68
|
-
|
69
|
-
#
|
70
|
-
# @param select [String] Limits the properties returned in the result.
|
71
|
-
# @param expand [String] Indicates the related entities to be represented
|
72
|
-
# inline. The maximum depth is 2.
|
73
|
-
# @param filter [String] Restricts the set of items returned. The maximum
|
74
|
-
# number of expressions is 100. The allowed functions are: allfunctions.
|
75
|
-
# @param orderby [String] Specifies the order in which items are returned. The
|
76
|
-
# maximum number of expressions is 5.
|
77
|
-
# @param top [Integer] Limits the number of items returned from a collection.
|
78
|
-
# @param skip [Integer] Excludes the specified number of items of the queried
|
79
|
-
# collection from the result.
|
80
|
-
# @param count [Boolean] Indicates whether the total count of items within a
|
81
|
-
# collection are returned in the result.
|
82
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
83
|
-
# to the HTTP request.
|
84
|
-
#
|
85
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
86
|
-
#
|
87
|
-
def list_async(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers: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
|
-
path_template = 'odata/v1/Machines'
|
97
|
-
|
98
|
-
request_url = @base_url || @client.base_url
|
99
|
-
|
100
|
-
options = {
|
101
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
102
|
-
query_params: {'$select' => select,'$expand' => expand,'$filter' => filter,'$orderby' => orderby,'$top' => top,'$skip' => skip,'$count' => count},
|
103
|
-
headers: request_headers.merge(custom_headers || {}),
|
104
|
-
base_url: request_url
|
105
|
-
}
|
106
|
-
promise = @client.make_request_async(:get, path_template, options)
|
107
|
-
|
108
|
-
promise = promise.then do |result|
|
109
|
-
http_response = result.response
|
110
|
-
status_code = http_response.status
|
111
|
-
response_content = http_response.body
|
112
|
-
unless status_code == 200 || status_code == 404
|
113
|
-
error_model = JSON.load(response_content)
|
114
|
-
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
115
|
-
end
|
116
|
-
|
117
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
118
|
-
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
119
|
-
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
120
|
-
# Deserialize Response
|
121
|
-
if status_code == 200
|
122
|
-
begin
|
123
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
124
|
-
result_mapper = Haipa::Client::Compute::V1_0::Models::ODataValueIEnumerableMachine.mapper()
|
125
|
-
result.body = @client.deserialize(result_mapper, parsed_response)
|
126
|
-
rescue Exception => e
|
127
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
result
|
132
|
-
end
|
133
|
-
|
134
|
-
promise.execute
|
135
|
-
end
|
136
|
-
|
137
|
-
#
|
138
|
-
# @param config [MachineConfig]
|
139
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
140
|
-
# will be added to the HTTP request.
|
141
|
-
#
|
142
|
-
# @return [Operation] operation results.
|
143
|
-
#
|
144
|
-
def update_or_create(config:nil, custom_headers:nil)
|
145
|
-
response = update_or_create_async(config:config, custom_headers:custom_headers).value!
|
146
|
-
response.body unless response.nil?
|
147
|
-
end
|
148
|
-
|
149
|
-
#
|
150
|
-
# @param config [MachineConfig]
|
151
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
152
|
-
# will be added to the HTTP request.
|
153
|
-
#
|
154
|
-
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
155
|
-
#
|
156
|
-
def update_or_create_with_http_info(config:nil, custom_headers:nil)
|
157
|
-
update_or_create_async(config:config, custom_headers:custom_headers).value!
|
158
|
-
end
|
159
|
-
|
160
|
-
#
|
161
|
-
# @param config [MachineConfig]
|
162
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
163
|
-
# to the HTTP request.
|
164
|
-
#
|
165
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
166
|
-
#
|
167
|
-
def update_or_create_async(config:nil, custom_headers:nil)
|
168
|
-
|
169
|
-
|
170
|
-
request_headers = {}
|
171
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
172
|
-
|
173
|
-
# Set Headers
|
174
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
175
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
176
|
-
|
177
|
-
# Serialize Request
|
178
|
-
request_mapper = Haipa::Client::Compute::V1_0::Models::MachineConfig.mapper()
|
179
|
-
request_content = @client.serialize(request_mapper, config)
|
180
|
-
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
181
|
-
|
182
|
-
path_template = 'odata/v1/Machines'
|
183
|
-
|
184
|
-
request_url = @base_url || @client.base_url
|
185
|
-
|
186
|
-
options = {
|
187
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
188
|
-
body: request_content,
|
189
|
-
headers: request_headers.merge(custom_headers || {}),
|
190
|
-
base_url: request_url
|
191
|
-
}
|
192
|
-
promise = @client.make_request_async(:post, path_template, options)
|
193
|
-
|
194
|
-
promise = promise.then do |result|
|
195
|
-
http_response = result.response
|
196
|
-
status_code = http_response.status
|
197
|
-
response_content = http_response.body
|
198
|
-
unless status_code == 200
|
199
|
-
error_model = JSON.load(response_content)
|
200
|
-
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
201
|
-
end
|
202
|
-
|
203
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
204
|
-
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
205
|
-
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
206
|
-
# Deserialize Response
|
207
|
-
if status_code == 200
|
208
|
-
begin
|
209
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
210
|
-
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
211
|
-
result.body = @client.deserialize(result_mapper, parsed_response)
|
212
|
-
rescue Exception => e
|
213
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
result
|
218
|
-
end
|
219
|
-
|
220
|
-
promise.execute
|
221
|
-
end
|
222
|
-
|
223
|
-
#
|
224
|
-
# @param key
|
225
|
-
# @param select [String] Limits the properties returned in the result.
|
226
|
-
# @param expand [String] Indicates the related entities to be represented
|
227
|
-
# inline. The maximum depth is 2.
|
228
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
229
|
-
# will be added to the HTTP request.
|
230
|
-
#
|
231
|
-
# @return [Machine] operation results.
|
232
|
-
#
|
233
|
-
def get(key, select:nil, expand:nil, custom_headers:nil)
|
234
|
-
response = get_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
235
|
-
response.body unless response.nil?
|
236
|
-
end
|
237
|
-
|
238
|
-
#
|
239
|
-
# @param key
|
240
|
-
# @param select [String] Limits the properties returned in the result.
|
241
|
-
# @param expand [String] Indicates the related entities to be represented
|
242
|
-
# inline. The maximum depth is 2.
|
243
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
244
|
-
# will be added to the HTTP request.
|
245
|
-
#
|
246
|
-
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
247
|
-
#
|
248
|
-
def get_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
|
249
|
-
get_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
250
|
-
end
|
251
|
-
|
252
|
-
#
|
253
|
-
# @param key
|
254
|
-
# @param select [String] Limits the properties returned in the result.
|
255
|
-
# @param expand [String] Indicates the related entities to be represented
|
256
|
-
# inline. The maximum depth is 2.
|
257
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
258
|
-
# to the HTTP request.
|
259
|
-
#
|
260
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
261
|
-
#
|
262
|
-
def get_async(key, select:nil, expand:nil, custom_headers:nil)
|
263
|
-
fail ArgumentError, 'key is nil' if key.nil?
|
264
|
-
|
265
|
-
|
266
|
-
request_headers = {}
|
267
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
268
|
-
|
269
|
-
# Set Headers
|
270
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
271
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
272
|
-
path_template = 'odata/v1/Machines({key})'
|
273
|
-
|
274
|
-
request_url = @base_url || @client.base_url
|
275
|
-
|
276
|
-
options = {
|
277
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
278
|
-
path_params: {'key' => key},
|
279
|
-
query_params: {'$select' => select,'$expand' => expand},
|
280
|
-
headers: request_headers.merge(custom_headers || {}),
|
281
|
-
base_url: request_url
|
282
|
-
}
|
283
|
-
promise = @client.make_request_async(:get, path_template, options)
|
284
|
-
|
285
|
-
promise = promise.then do |result|
|
286
|
-
http_response = result.response
|
287
|
-
status_code = http_response.status
|
288
|
-
response_content = http_response.body
|
289
|
-
unless status_code == 200 || status_code == 404
|
290
|
-
error_model = JSON.load(response_content)
|
291
|
-
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
292
|
-
end
|
293
|
-
|
294
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
295
|
-
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
296
|
-
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
297
|
-
# Deserialize Response
|
298
|
-
if status_code == 200
|
299
|
-
begin
|
300
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
301
|
-
result_mapper = Haipa::Client::Compute::V1_0::Models::Machine.mapper()
|
302
|
-
result.body = @client.deserialize(result_mapper, parsed_response)
|
303
|
-
rescue Exception => e
|
304
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
result
|
309
|
-
end
|
310
|
-
|
311
|
-
promise.execute
|
312
|
-
end
|
313
|
-
|
314
|
-
#
|
315
|
-
# @param key
|
316
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
317
|
-
# will be added to the HTTP request.
|
318
|
-
#
|
319
|
-
# @return [Operation] operation results.
|
320
|
-
#
|
321
|
-
def delete(key, custom_headers:nil)
|
322
|
-
response = delete_async(key, custom_headers:custom_headers).value!
|
323
|
-
response.body unless response.nil?
|
324
|
-
end
|
325
|
-
|
326
|
-
#
|
327
|
-
# @param key
|
328
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
329
|
-
# will be added to the HTTP request.
|
330
|
-
#
|
331
|
-
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
332
|
-
#
|
333
|
-
def delete_with_http_info(key, custom_headers:nil)
|
334
|
-
delete_async(key, custom_headers:custom_headers).value!
|
335
|
-
end
|
336
|
-
|
337
|
-
#
|
338
|
-
# @param key
|
339
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
340
|
-
# to the HTTP request.
|
341
|
-
#
|
342
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
343
|
-
#
|
344
|
-
def delete_async(key, custom_headers:nil)
|
345
|
-
fail ArgumentError, 'key is nil' if key.nil?
|
346
|
-
|
347
|
-
|
348
|
-
request_headers = {}
|
349
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
350
|
-
|
351
|
-
# Set Headers
|
352
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
353
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
354
|
-
path_template = 'odata/v1/Machines({key})'
|
355
|
-
|
356
|
-
request_url = @base_url || @client.base_url
|
357
|
-
|
358
|
-
options = {
|
359
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
360
|
-
path_params: {'key' => key},
|
361
|
-
headers: request_headers.merge(custom_headers || {}),
|
362
|
-
base_url: request_url
|
363
|
-
}
|
364
|
-
promise = @client.make_request_async(:delete, path_template, options)
|
365
|
-
|
366
|
-
promise = promise.then do |result|
|
367
|
-
http_response = result.response
|
368
|
-
status_code = http_response.status
|
369
|
-
response_content = http_response.body
|
370
|
-
unless status_code == 200
|
371
|
-
error_model = JSON.load(response_content)
|
372
|
-
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
373
|
-
end
|
374
|
-
|
375
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
376
|
-
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
377
|
-
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
378
|
-
# Deserialize Response
|
379
|
-
if status_code == 200
|
380
|
-
begin
|
381
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
382
|
-
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
383
|
-
result.body = @client.deserialize(result_mapper, parsed_response)
|
384
|
-
rescue Exception => e
|
385
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
386
|
-
end
|
387
|
-
end
|
388
|
-
|
389
|
-
result
|
390
|
-
end
|
391
|
-
|
392
|
-
promise.execute
|
393
|
-
end
|
394
|
-
|
395
|
-
#
|
396
|
-
# @param key
|
397
|
-
# @param select [String] Limits the properties returned in the result.
|
398
|
-
# @param expand [String] Indicates the related entities to be represented
|
399
|
-
# inline. The maximum depth is 2.
|
400
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
401
|
-
# will be added to the HTTP request.
|
402
|
-
#
|
403
|
-
# @return [Operation] operation results.
|
404
|
-
#
|
405
|
-
def start(key, select:nil, expand:nil, custom_headers:nil)
|
406
|
-
response = start_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
407
|
-
response.body unless response.nil?
|
408
|
-
end
|
409
|
-
|
410
|
-
#
|
411
|
-
# @param key
|
412
|
-
# @param select [String] Limits the properties returned in the result.
|
413
|
-
# @param expand [String] Indicates the related entities to be represented
|
414
|
-
# inline. The maximum depth is 2.
|
415
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
416
|
-
# will be added to the HTTP request.
|
417
|
-
#
|
418
|
-
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
419
|
-
#
|
420
|
-
def start_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
|
421
|
-
start_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
422
|
-
end
|
423
|
-
|
424
|
-
#
|
425
|
-
# @param key
|
426
|
-
# @param select [String] Limits the properties returned in the result.
|
427
|
-
# @param expand [String] Indicates the related entities to be represented
|
428
|
-
# inline. The maximum depth is 2.
|
429
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
430
|
-
# to the HTTP request.
|
431
|
-
#
|
432
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
433
|
-
#
|
434
|
-
def start_async(key, select:nil, expand:nil, custom_headers:nil)
|
435
|
-
fail ArgumentError, 'key is nil' if key.nil?
|
436
|
-
|
437
|
-
|
438
|
-
request_headers = {}
|
439
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
440
|
-
|
441
|
-
# Set Headers
|
442
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
443
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
444
|
-
path_template = 'odata/v1/Machines({key})/Start'
|
445
|
-
|
446
|
-
request_url = @base_url || @client.base_url
|
447
|
-
|
448
|
-
options = {
|
449
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
450
|
-
path_params: {'key' => key},
|
451
|
-
query_params: {'$select' => select,'$expand' => expand},
|
452
|
-
headers: request_headers.merge(custom_headers || {}),
|
453
|
-
base_url: request_url
|
454
|
-
}
|
455
|
-
promise = @client.make_request_async(:post, path_template, options)
|
456
|
-
|
457
|
-
promise = promise.then do |result|
|
458
|
-
http_response = result.response
|
459
|
-
status_code = http_response.status
|
460
|
-
response_content = http_response.body
|
461
|
-
unless status_code == 200
|
462
|
-
error_model = JSON.load(response_content)
|
463
|
-
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
464
|
-
end
|
465
|
-
|
466
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
467
|
-
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
468
|
-
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
469
|
-
# Deserialize Response
|
470
|
-
if status_code == 200
|
471
|
-
begin
|
472
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
473
|
-
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
474
|
-
result.body = @client.deserialize(result_mapper, parsed_response)
|
475
|
-
rescue Exception => e
|
476
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
477
|
-
end
|
478
|
-
end
|
479
|
-
|
480
|
-
result
|
481
|
-
end
|
482
|
-
|
483
|
-
promise.execute
|
484
|
-
end
|
485
|
-
|
486
|
-
#
|
487
|
-
# @param key
|
488
|
-
# @param select [String] Limits the properties returned in the result.
|
489
|
-
# @param expand [String] Indicates the related entities to be represented
|
490
|
-
# inline. The maximum depth is 2.
|
491
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
492
|
-
# will be added to the HTTP request.
|
493
|
-
#
|
494
|
-
# @return [Operation] operation results.
|
495
|
-
#
|
496
|
-
def stop(key, select:nil, expand:nil, custom_headers:nil)
|
497
|
-
response = stop_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
498
|
-
response.body unless response.nil?
|
499
|
-
end
|
500
|
-
|
501
|
-
#
|
502
|
-
# @param key
|
503
|
-
# @param select [String] Limits the properties returned in the result.
|
504
|
-
# @param expand [String] Indicates the related entities to be represented
|
505
|
-
# inline. The maximum depth is 2.
|
506
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
507
|
-
# will be added to the HTTP request.
|
508
|
-
#
|
509
|
-
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
510
|
-
#
|
511
|
-
def stop_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
|
512
|
-
stop_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
513
|
-
end
|
514
|
-
|
515
|
-
#
|
516
|
-
# @param key
|
517
|
-
# @param select [String] Limits the properties returned in the result.
|
518
|
-
# @param expand [String] Indicates the related entities to be represented
|
519
|
-
# inline. The maximum depth is 2.
|
520
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
521
|
-
# to the HTTP request.
|
522
|
-
#
|
523
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
524
|
-
#
|
525
|
-
def stop_async(key, select:nil, expand:nil, custom_headers:nil)
|
526
|
-
fail ArgumentError, 'key is nil' if key.nil?
|
527
|
-
|
528
|
-
|
529
|
-
request_headers = {}
|
530
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
531
|
-
|
532
|
-
# Set Headers
|
533
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
534
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
535
|
-
path_template = 'odata/v1/Machines({key})/Stop'
|
536
|
-
|
537
|
-
request_url = @base_url || @client.base_url
|
538
|
-
|
539
|
-
options = {
|
540
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
541
|
-
path_params: {'key' => key},
|
542
|
-
query_params: {'$select' => select,'$expand' => expand},
|
543
|
-
headers: request_headers.merge(custom_headers || {}),
|
544
|
-
base_url: request_url
|
545
|
-
}
|
546
|
-
promise = @client.make_request_async(:post, path_template, options)
|
547
|
-
|
548
|
-
promise = promise.then do |result|
|
549
|
-
http_response = result.response
|
550
|
-
status_code = http_response.status
|
551
|
-
response_content = http_response.body
|
552
|
-
unless status_code == 200
|
553
|
-
error_model = JSON.load(response_content)
|
554
|
-
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
555
|
-
end
|
556
|
-
|
557
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
558
|
-
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
559
|
-
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
560
|
-
# Deserialize Response
|
561
|
-
if status_code == 200
|
562
|
-
begin
|
563
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
564
|
-
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
565
|
-
result.body = @client.deserialize(result_mapper, parsed_response)
|
566
|
-
rescue Exception => e
|
567
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
|
-
result
|
572
|
-
end
|
573
|
-
|
574
|
-
promise.execute
|
575
|
-
end
|
576
|
-
|
577
|
-
end
|
578
|
-
end
|
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 Haipa::Client::Compute::V1_0
|
7
|
+
#
|
8
|
+
# Haipa management API
|
9
|
+
#
|
10
|
+
class Machines
|
11
|
+
include Haipa::Client
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Machines class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [HaipaCompute] reference to the HaipaCompute
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# @param select [String] Limits the properties returned in the result.
|
26
|
+
# @param expand [String] Indicates the related entities to be represented
|
27
|
+
# inline. The maximum depth is 2.
|
28
|
+
# @param filter [String] Restricts the set of items returned. The maximum
|
29
|
+
# number of expressions is 100. The allowed functions are: allfunctions.
|
30
|
+
# @param orderby [String] Specifies the order in which items are returned. The
|
31
|
+
# maximum number of expressions is 5.
|
32
|
+
# @param top [Integer] Limits the number of items returned from a collection.
|
33
|
+
# @param skip [Integer] Excludes the specified number of items of the queried
|
34
|
+
# collection from the result.
|
35
|
+
# @param count [Boolean] Indicates whether the total count of items within a
|
36
|
+
# collection are returned in the result.
|
37
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
38
|
+
# will be added to the HTTP request.
|
39
|
+
#
|
40
|
+
# @return [ODataValueIEnumerableMachine] operation results.
|
41
|
+
#
|
42
|
+
def list(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
|
43
|
+
response = list_async(select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
|
44
|
+
response.body unless response.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# @param select [String] Limits the properties returned in the result.
|
49
|
+
# @param expand [String] Indicates the related entities to be represented
|
50
|
+
# inline. The maximum depth is 2.
|
51
|
+
# @param filter [String] Restricts the set of items returned. The maximum
|
52
|
+
# number of expressions is 100. The allowed functions are: allfunctions.
|
53
|
+
# @param orderby [String] Specifies the order in which items are returned. The
|
54
|
+
# maximum number of expressions is 5.
|
55
|
+
# @param top [Integer] Limits the number of items returned from a collection.
|
56
|
+
# @param skip [Integer] Excludes the specified number of items of the queried
|
57
|
+
# collection from the result.
|
58
|
+
# @param count [Boolean] Indicates whether the total count of items within a
|
59
|
+
# collection are returned in the result.
|
60
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
61
|
+
# will be added to the HTTP request.
|
62
|
+
#
|
63
|
+
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
64
|
+
#
|
65
|
+
def list_with_http_info(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers:nil)
|
66
|
+
list_async(select:select, expand:expand, filter:filter, orderby:orderby, top:top, skip:skip, count:count, custom_headers:custom_headers).value!
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
# @param select [String] Limits the properties returned in the result.
|
71
|
+
# @param expand [String] Indicates the related entities to be represented
|
72
|
+
# inline. The maximum depth is 2.
|
73
|
+
# @param filter [String] Restricts the set of items returned. The maximum
|
74
|
+
# number of expressions is 100. The allowed functions are: allfunctions.
|
75
|
+
# @param orderby [String] Specifies the order in which items are returned. The
|
76
|
+
# maximum number of expressions is 5.
|
77
|
+
# @param top [Integer] Limits the number of items returned from a collection.
|
78
|
+
# @param skip [Integer] Excludes the specified number of items of the queried
|
79
|
+
# collection from the result.
|
80
|
+
# @param count [Boolean] Indicates whether the total count of items within a
|
81
|
+
# collection are returned in the result.
|
82
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
83
|
+
# to the HTTP request.
|
84
|
+
#
|
85
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
86
|
+
#
|
87
|
+
def list_async(select:nil, expand:nil, filter:nil, orderby:nil, top:nil, skip:nil, count:false, custom_headers: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
|
+
path_template = 'odata/v1/Machines'
|
97
|
+
|
98
|
+
request_url = @base_url || @client.base_url
|
99
|
+
|
100
|
+
options = {
|
101
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
102
|
+
query_params: {'$select' => select,'$expand' => expand,'$filter' => filter,'$orderby' => orderby,'$top' => top,'$skip' => skip,'$count' => count},
|
103
|
+
headers: request_headers.merge(custom_headers || {}),
|
104
|
+
base_url: request_url
|
105
|
+
}
|
106
|
+
promise = @client.make_request_async(:get, path_template, options)
|
107
|
+
|
108
|
+
promise = promise.then do |result|
|
109
|
+
http_response = result.response
|
110
|
+
status_code = http_response.status
|
111
|
+
response_content = http_response.body
|
112
|
+
unless status_code == 200 || status_code == 404
|
113
|
+
error_model = JSON.load(response_content)
|
114
|
+
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
115
|
+
end
|
116
|
+
|
117
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
118
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
119
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
120
|
+
# Deserialize Response
|
121
|
+
if status_code == 200
|
122
|
+
begin
|
123
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
124
|
+
result_mapper = Haipa::Client::Compute::V1_0::Models::ODataValueIEnumerableMachine.mapper()
|
125
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
126
|
+
rescue Exception => e
|
127
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
result
|
132
|
+
end
|
133
|
+
|
134
|
+
promise.execute
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# @param config [MachineConfig]
|
139
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
140
|
+
# will be added to the HTTP request.
|
141
|
+
#
|
142
|
+
# @return [Operation] operation results.
|
143
|
+
#
|
144
|
+
def update_or_create(config:nil, custom_headers:nil)
|
145
|
+
response = update_or_create_async(config:config, custom_headers:custom_headers).value!
|
146
|
+
response.body unless response.nil?
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# @param config [MachineConfig]
|
151
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
152
|
+
# will be added to the HTTP request.
|
153
|
+
#
|
154
|
+
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
155
|
+
#
|
156
|
+
def update_or_create_with_http_info(config:nil, custom_headers:nil)
|
157
|
+
update_or_create_async(config:config, custom_headers:custom_headers).value!
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# @param config [MachineConfig]
|
162
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
163
|
+
# to the HTTP request.
|
164
|
+
#
|
165
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
166
|
+
#
|
167
|
+
def update_or_create_async(config:nil, custom_headers:nil)
|
168
|
+
|
169
|
+
|
170
|
+
request_headers = {}
|
171
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
172
|
+
|
173
|
+
# Set Headers
|
174
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
175
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
176
|
+
|
177
|
+
# Serialize Request
|
178
|
+
request_mapper = Haipa::Client::Compute::V1_0::Models::MachineConfig.mapper()
|
179
|
+
request_content = @client.serialize(request_mapper, config)
|
180
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
181
|
+
|
182
|
+
path_template = 'odata/v1/Machines'
|
183
|
+
|
184
|
+
request_url = @base_url || @client.base_url
|
185
|
+
|
186
|
+
options = {
|
187
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
188
|
+
body: request_content,
|
189
|
+
headers: request_headers.merge(custom_headers || {}),
|
190
|
+
base_url: request_url
|
191
|
+
}
|
192
|
+
promise = @client.make_request_async(:post, path_template, options)
|
193
|
+
|
194
|
+
promise = promise.then do |result|
|
195
|
+
http_response = result.response
|
196
|
+
status_code = http_response.status
|
197
|
+
response_content = http_response.body
|
198
|
+
unless status_code == 200
|
199
|
+
error_model = JSON.load(response_content)
|
200
|
+
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
201
|
+
end
|
202
|
+
|
203
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
204
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
205
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
206
|
+
# Deserialize Response
|
207
|
+
if status_code == 200
|
208
|
+
begin
|
209
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
210
|
+
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
211
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
212
|
+
rescue Exception => e
|
213
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
result
|
218
|
+
end
|
219
|
+
|
220
|
+
promise.execute
|
221
|
+
end
|
222
|
+
|
223
|
+
#
|
224
|
+
# @param key
|
225
|
+
# @param select [String] Limits the properties returned in the result.
|
226
|
+
# @param expand [String] Indicates the related entities to be represented
|
227
|
+
# inline. The maximum depth is 2.
|
228
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
229
|
+
# will be added to the HTTP request.
|
230
|
+
#
|
231
|
+
# @return [Machine] operation results.
|
232
|
+
#
|
233
|
+
def get(key, select:nil, expand:nil, custom_headers:nil)
|
234
|
+
response = get_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
235
|
+
response.body unless response.nil?
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# @param key
|
240
|
+
# @param select [String] Limits the properties returned in the result.
|
241
|
+
# @param expand [String] Indicates the related entities to be represented
|
242
|
+
# inline. The maximum depth is 2.
|
243
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
244
|
+
# will be added to the HTTP request.
|
245
|
+
#
|
246
|
+
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
247
|
+
#
|
248
|
+
def get_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
|
249
|
+
get_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
250
|
+
end
|
251
|
+
|
252
|
+
#
|
253
|
+
# @param key
|
254
|
+
# @param select [String] Limits the properties returned in the result.
|
255
|
+
# @param expand [String] Indicates the related entities to be represented
|
256
|
+
# inline. The maximum depth is 2.
|
257
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
258
|
+
# to the HTTP request.
|
259
|
+
#
|
260
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
261
|
+
#
|
262
|
+
def get_async(key, select:nil, expand:nil, custom_headers:nil)
|
263
|
+
fail ArgumentError, 'key is nil' if key.nil?
|
264
|
+
|
265
|
+
|
266
|
+
request_headers = {}
|
267
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
268
|
+
|
269
|
+
# Set Headers
|
270
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
271
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
272
|
+
path_template = 'odata/v1/Machines({key})'
|
273
|
+
|
274
|
+
request_url = @base_url || @client.base_url
|
275
|
+
|
276
|
+
options = {
|
277
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
278
|
+
path_params: {'key' => key},
|
279
|
+
query_params: {'$select' => select,'$expand' => expand},
|
280
|
+
headers: request_headers.merge(custom_headers || {}),
|
281
|
+
base_url: request_url
|
282
|
+
}
|
283
|
+
promise = @client.make_request_async(:get, path_template, options)
|
284
|
+
|
285
|
+
promise = promise.then do |result|
|
286
|
+
http_response = result.response
|
287
|
+
status_code = http_response.status
|
288
|
+
response_content = http_response.body
|
289
|
+
unless status_code == 200 || status_code == 404
|
290
|
+
error_model = JSON.load(response_content)
|
291
|
+
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
292
|
+
end
|
293
|
+
|
294
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
295
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
296
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
297
|
+
# Deserialize Response
|
298
|
+
if status_code == 200
|
299
|
+
begin
|
300
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
301
|
+
result_mapper = Haipa::Client::Compute::V1_0::Models::Machine.mapper()
|
302
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
303
|
+
rescue Exception => e
|
304
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
result
|
309
|
+
end
|
310
|
+
|
311
|
+
promise.execute
|
312
|
+
end
|
313
|
+
|
314
|
+
#
|
315
|
+
# @param key
|
316
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
317
|
+
# will be added to the HTTP request.
|
318
|
+
#
|
319
|
+
# @return [Operation] operation results.
|
320
|
+
#
|
321
|
+
def delete(key, custom_headers:nil)
|
322
|
+
response = delete_async(key, custom_headers:custom_headers).value!
|
323
|
+
response.body unless response.nil?
|
324
|
+
end
|
325
|
+
|
326
|
+
#
|
327
|
+
# @param key
|
328
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
329
|
+
# will be added to the HTTP request.
|
330
|
+
#
|
331
|
+
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
332
|
+
#
|
333
|
+
def delete_with_http_info(key, custom_headers:nil)
|
334
|
+
delete_async(key, custom_headers:custom_headers).value!
|
335
|
+
end
|
336
|
+
|
337
|
+
#
|
338
|
+
# @param key
|
339
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
340
|
+
# to the HTTP request.
|
341
|
+
#
|
342
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
343
|
+
#
|
344
|
+
def delete_async(key, custom_headers:nil)
|
345
|
+
fail ArgumentError, 'key is nil' if key.nil?
|
346
|
+
|
347
|
+
|
348
|
+
request_headers = {}
|
349
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
350
|
+
|
351
|
+
# Set Headers
|
352
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
353
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
354
|
+
path_template = 'odata/v1/Machines({key})'
|
355
|
+
|
356
|
+
request_url = @base_url || @client.base_url
|
357
|
+
|
358
|
+
options = {
|
359
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
360
|
+
path_params: {'key' => key},
|
361
|
+
headers: request_headers.merge(custom_headers || {}),
|
362
|
+
base_url: request_url
|
363
|
+
}
|
364
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
365
|
+
|
366
|
+
promise = promise.then do |result|
|
367
|
+
http_response = result.response
|
368
|
+
status_code = http_response.status
|
369
|
+
response_content = http_response.body
|
370
|
+
unless status_code == 200
|
371
|
+
error_model = JSON.load(response_content)
|
372
|
+
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
373
|
+
end
|
374
|
+
|
375
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
376
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
377
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
378
|
+
# Deserialize Response
|
379
|
+
if status_code == 200
|
380
|
+
begin
|
381
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
382
|
+
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
383
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
384
|
+
rescue Exception => e
|
385
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
result
|
390
|
+
end
|
391
|
+
|
392
|
+
promise.execute
|
393
|
+
end
|
394
|
+
|
395
|
+
#
|
396
|
+
# @param key
|
397
|
+
# @param select [String] Limits the properties returned in the result.
|
398
|
+
# @param expand [String] Indicates the related entities to be represented
|
399
|
+
# inline. The maximum depth is 2.
|
400
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
401
|
+
# will be added to the HTTP request.
|
402
|
+
#
|
403
|
+
# @return [Operation] operation results.
|
404
|
+
#
|
405
|
+
def start(key, select:nil, expand:nil, custom_headers:nil)
|
406
|
+
response = start_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
407
|
+
response.body unless response.nil?
|
408
|
+
end
|
409
|
+
|
410
|
+
#
|
411
|
+
# @param key
|
412
|
+
# @param select [String] Limits the properties returned in the result.
|
413
|
+
# @param expand [String] Indicates the related entities to be represented
|
414
|
+
# inline. The maximum depth is 2.
|
415
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
416
|
+
# will be added to the HTTP request.
|
417
|
+
#
|
418
|
+
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
419
|
+
#
|
420
|
+
def start_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
|
421
|
+
start_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
422
|
+
end
|
423
|
+
|
424
|
+
#
|
425
|
+
# @param key
|
426
|
+
# @param select [String] Limits the properties returned in the result.
|
427
|
+
# @param expand [String] Indicates the related entities to be represented
|
428
|
+
# inline. The maximum depth is 2.
|
429
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
430
|
+
# to the HTTP request.
|
431
|
+
#
|
432
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
433
|
+
#
|
434
|
+
def start_async(key, select:nil, expand:nil, custom_headers:nil)
|
435
|
+
fail ArgumentError, 'key is nil' if key.nil?
|
436
|
+
|
437
|
+
|
438
|
+
request_headers = {}
|
439
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
440
|
+
|
441
|
+
# Set Headers
|
442
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
443
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
444
|
+
path_template = 'odata/v1/Machines({key})/Start'
|
445
|
+
|
446
|
+
request_url = @base_url || @client.base_url
|
447
|
+
|
448
|
+
options = {
|
449
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
450
|
+
path_params: {'key' => key},
|
451
|
+
query_params: {'$select' => select,'$expand' => expand},
|
452
|
+
headers: request_headers.merge(custom_headers || {}),
|
453
|
+
base_url: request_url
|
454
|
+
}
|
455
|
+
promise = @client.make_request_async(:post, path_template, options)
|
456
|
+
|
457
|
+
promise = promise.then do |result|
|
458
|
+
http_response = result.response
|
459
|
+
status_code = http_response.status
|
460
|
+
response_content = http_response.body
|
461
|
+
unless status_code == 200
|
462
|
+
error_model = JSON.load(response_content)
|
463
|
+
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
464
|
+
end
|
465
|
+
|
466
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
467
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
468
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
469
|
+
# Deserialize Response
|
470
|
+
if status_code == 200
|
471
|
+
begin
|
472
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
473
|
+
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
474
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
475
|
+
rescue Exception => e
|
476
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
result
|
481
|
+
end
|
482
|
+
|
483
|
+
promise.execute
|
484
|
+
end
|
485
|
+
|
486
|
+
#
|
487
|
+
# @param key
|
488
|
+
# @param select [String] Limits the properties returned in the result.
|
489
|
+
# @param expand [String] Indicates the related entities to be represented
|
490
|
+
# inline. The maximum depth is 2.
|
491
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
492
|
+
# will be added to the HTTP request.
|
493
|
+
#
|
494
|
+
# @return [Operation] operation results.
|
495
|
+
#
|
496
|
+
def stop(key, select:nil, expand:nil, custom_headers:nil)
|
497
|
+
response = stop_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
498
|
+
response.body unless response.nil?
|
499
|
+
end
|
500
|
+
|
501
|
+
#
|
502
|
+
# @param key
|
503
|
+
# @param select [String] Limits the properties returned in the result.
|
504
|
+
# @param expand [String] Indicates the related entities to be represented
|
505
|
+
# inline. The maximum depth is 2.
|
506
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
507
|
+
# will be added to the HTTP request.
|
508
|
+
#
|
509
|
+
# @return [Haipa::Client::HaipaOperationResponse] HTTP response information.
|
510
|
+
#
|
511
|
+
def stop_with_http_info(key, select:nil, expand:nil, custom_headers:nil)
|
512
|
+
stop_async(key, select:select, expand:expand, custom_headers:custom_headers).value!
|
513
|
+
end
|
514
|
+
|
515
|
+
#
|
516
|
+
# @param key
|
517
|
+
# @param select [String] Limits the properties returned in the result.
|
518
|
+
# @param expand [String] Indicates the related entities to be represented
|
519
|
+
# inline. The maximum depth is 2.
|
520
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
521
|
+
# to the HTTP request.
|
522
|
+
#
|
523
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
524
|
+
#
|
525
|
+
def stop_async(key, select:nil, expand:nil, custom_headers:nil)
|
526
|
+
fail ArgumentError, 'key is nil' if key.nil?
|
527
|
+
|
528
|
+
|
529
|
+
request_headers = {}
|
530
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
531
|
+
|
532
|
+
# Set Headers
|
533
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
534
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
535
|
+
path_template = 'odata/v1/Machines({key})/Stop'
|
536
|
+
|
537
|
+
request_url = @base_url || @client.base_url
|
538
|
+
|
539
|
+
options = {
|
540
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]],
|
541
|
+
path_params: {'key' => key},
|
542
|
+
query_params: {'$select' => select,'$expand' => expand},
|
543
|
+
headers: request_headers.merge(custom_headers || {}),
|
544
|
+
base_url: request_url
|
545
|
+
}
|
546
|
+
promise = @client.make_request_async(:post, path_template, options)
|
547
|
+
|
548
|
+
promise = promise.then do |result|
|
549
|
+
http_response = result.response
|
550
|
+
status_code = http_response.status
|
551
|
+
response_content = http_response.body
|
552
|
+
unless status_code == 200
|
553
|
+
error_model = JSON.load(response_content)
|
554
|
+
fail Haipa::Client::HaipaOperationError.new(result.request, http_response, error_model)
|
555
|
+
end
|
556
|
+
|
557
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
558
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
559
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
560
|
+
# Deserialize Response
|
561
|
+
if status_code == 200
|
562
|
+
begin
|
563
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
564
|
+
result_mapper = Haipa::Client::Compute::V1_0::Models::Operation.mapper()
|
565
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
566
|
+
rescue Exception => e
|
567
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
result
|
572
|
+
end
|
573
|
+
|
574
|
+
promise.execute
|
575
|
+
end
|
576
|
+
|
577
|
+
end
|
578
|
+
end
|