azure_mgmt_import_export 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export.rb +51 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/bit_locker_keys.rb +122 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/jobs.rb +886 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/locations.rb +207 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/drive_bit_locker_key.rb +57 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/drive_state.rb +21 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/drive_status.rb +175 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/error_response.rb +100 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/error_response_error_details_item.rb +69 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/export.rb +89 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/get_bit_locker_keys_response.rb +55 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/job_details.rb +257 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/job_response.rb +105 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/list_jobs_response.rb +98 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/list_operations_response.rb +55 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/location.rb +207 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/locations_response.rb +55 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/operation.rb +92 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/package_infomation.rb +81 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/put_job_parameters.rb +70 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/return_address.rb +139 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/return_shipping.rb +57 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/shipping_information.rb +129 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/models/update_job_parameters.rb +156 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/module_definition.rb +9 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/operations.rb +112 -0
- data/lib/2016-11-01/generated/azure_mgmt_import_export/storage_import_export.rb +142 -0
- data/lib/azure_mgmt_import_export.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/importexport_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/importexport_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/importexport_profile_module.rb +147 -0
- data/lib/version.rb +7 -0
- metadata +151 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ImportExport::Mgmt::V2016_11_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Contains information about the Microsoft datacenter to which the drives
|
10
|
+
# should be shipped.
|
11
|
+
#
|
12
|
+
class ShippingInformation
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [String] The name of the recipient who will receive the hard
|
17
|
+
# drives when they are returned.
|
18
|
+
attr_accessor :recipient_name
|
19
|
+
|
20
|
+
# @return [String] The first line of the street address to use when
|
21
|
+
# returning the drives.
|
22
|
+
attr_accessor :street_address1
|
23
|
+
|
24
|
+
# @return [String] The second line of the street address to use when
|
25
|
+
# returning the drives.
|
26
|
+
attr_accessor :street_address2
|
27
|
+
|
28
|
+
# @return [String] The city name to use when returning the drives.
|
29
|
+
attr_accessor :city
|
30
|
+
|
31
|
+
# @return [String] The state or province to use when returning the
|
32
|
+
# drives.
|
33
|
+
attr_accessor :state_or_province
|
34
|
+
|
35
|
+
# @return [String] The postal code to use when returning the drives.
|
36
|
+
attr_accessor :postal_code
|
37
|
+
|
38
|
+
# @return [String] The country or region to use when returning the
|
39
|
+
# drives.
|
40
|
+
attr_accessor :country_or_region
|
41
|
+
|
42
|
+
# @return [String] Phone number of the recipient of the returned drives.
|
43
|
+
attr_accessor :phone
|
44
|
+
|
45
|
+
|
46
|
+
#
|
47
|
+
# Mapper for ShippingInformation class as Ruby Hash.
|
48
|
+
# This will be used for serialization/deserialization.
|
49
|
+
#
|
50
|
+
def self.mapper()
|
51
|
+
{
|
52
|
+
client_side_validation: true,
|
53
|
+
required: false,
|
54
|
+
serialized_name: 'ShippingInformation',
|
55
|
+
type: {
|
56
|
+
name: 'Composite',
|
57
|
+
class_name: 'ShippingInformation',
|
58
|
+
model_properties: {
|
59
|
+
recipient_name: {
|
60
|
+
client_side_validation: true,
|
61
|
+
required: true,
|
62
|
+
serialized_name: 'recipientName',
|
63
|
+
type: {
|
64
|
+
name: 'String'
|
65
|
+
}
|
66
|
+
},
|
67
|
+
street_address1: {
|
68
|
+
client_side_validation: true,
|
69
|
+
required: true,
|
70
|
+
serialized_name: 'streetAddress1',
|
71
|
+
type: {
|
72
|
+
name: 'String'
|
73
|
+
}
|
74
|
+
},
|
75
|
+
street_address2: {
|
76
|
+
client_side_validation: true,
|
77
|
+
required: false,
|
78
|
+
serialized_name: 'streetAddress2',
|
79
|
+
type: {
|
80
|
+
name: 'String'
|
81
|
+
}
|
82
|
+
},
|
83
|
+
city: {
|
84
|
+
client_side_validation: true,
|
85
|
+
required: true,
|
86
|
+
serialized_name: 'city',
|
87
|
+
type: {
|
88
|
+
name: 'String'
|
89
|
+
}
|
90
|
+
},
|
91
|
+
state_or_province: {
|
92
|
+
client_side_validation: true,
|
93
|
+
required: true,
|
94
|
+
serialized_name: 'stateOrProvince',
|
95
|
+
type: {
|
96
|
+
name: 'String'
|
97
|
+
}
|
98
|
+
},
|
99
|
+
postal_code: {
|
100
|
+
client_side_validation: true,
|
101
|
+
required: true,
|
102
|
+
serialized_name: 'postalCode',
|
103
|
+
type: {
|
104
|
+
name: 'String'
|
105
|
+
}
|
106
|
+
},
|
107
|
+
country_or_region: {
|
108
|
+
client_side_validation: true,
|
109
|
+
required: true,
|
110
|
+
serialized_name: 'countryOrRegion',
|
111
|
+
type: {
|
112
|
+
name: 'String'
|
113
|
+
}
|
114
|
+
},
|
115
|
+
phone: {
|
116
|
+
client_side_validation: true,
|
117
|
+
required: false,
|
118
|
+
serialized_name: 'phone',
|
119
|
+
type: {
|
120
|
+
name: 'String'
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ImportExport::Mgmt::V2016_11_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Update Job parameters
|
10
|
+
#
|
11
|
+
class UpdateJobParameters
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return Specifies the tags that will be assigned to the job
|
16
|
+
attr_accessor :tags
|
17
|
+
|
18
|
+
# @return [Boolean] If specified, the value must be true. The service
|
19
|
+
# will attempt to cancel the job.
|
20
|
+
attr_accessor :cancel_requested
|
21
|
+
|
22
|
+
# @return [String] If specified, the value must be Shipping, which tells
|
23
|
+
# the Import/Export service that the package for the job has been
|
24
|
+
# shipped. The ReturnAddress and DeliveryPackage properties must have
|
25
|
+
# been set either in this request or in a previous request, otherwise the
|
26
|
+
# request will fail.
|
27
|
+
attr_accessor :state
|
28
|
+
|
29
|
+
# @return [ReturnAddress] Specifies the return address information for
|
30
|
+
# the job.
|
31
|
+
attr_accessor :return_address
|
32
|
+
|
33
|
+
# @return [ReturnShipping] Specifies the return carrier and customer's
|
34
|
+
# account with the carrier.
|
35
|
+
attr_accessor :return_shipping
|
36
|
+
|
37
|
+
# @return [PackageInfomation] Contains information about the package
|
38
|
+
# being shipped by the customer to the Microsoft data center.
|
39
|
+
attr_accessor :delivery_package
|
40
|
+
|
41
|
+
# @return [String] Indicates whether error logging or verbose logging is
|
42
|
+
# enabled.
|
43
|
+
attr_accessor :log_level
|
44
|
+
|
45
|
+
# @return [Boolean] Indicates whether the manifest files on the drives
|
46
|
+
# should be copied to block blobs.
|
47
|
+
attr_accessor :backup_drive_manifest
|
48
|
+
|
49
|
+
# @return [Array<DriveStatus>] List of drives that comprise the job.
|
50
|
+
attr_accessor :drive_list
|
51
|
+
|
52
|
+
|
53
|
+
#
|
54
|
+
# Mapper for UpdateJobParameters class as Ruby Hash.
|
55
|
+
# This will be used for serialization/deserialization.
|
56
|
+
#
|
57
|
+
def self.mapper()
|
58
|
+
{
|
59
|
+
client_side_validation: true,
|
60
|
+
required: false,
|
61
|
+
serialized_name: 'UpdateJobParameters',
|
62
|
+
type: {
|
63
|
+
name: 'Composite',
|
64
|
+
class_name: 'UpdateJobParameters',
|
65
|
+
model_properties: {
|
66
|
+
tags: {
|
67
|
+
client_side_validation: true,
|
68
|
+
required: false,
|
69
|
+
serialized_name: 'tags',
|
70
|
+
type: {
|
71
|
+
name: 'Object'
|
72
|
+
}
|
73
|
+
},
|
74
|
+
cancel_requested: {
|
75
|
+
client_side_validation: true,
|
76
|
+
required: false,
|
77
|
+
serialized_name: 'properties.cancelRequested',
|
78
|
+
type: {
|
79
|
+
name: 'Boolean'
|
80
|
+
}
|
81
|
+
},
|
82
|
+
state: {
|
83
|
+
client_side_validation: true,
|
84
|
+
required: false,
|
85
|
+
serialized_name: 'properties.state',
|
86
|
+
type: {
|
87
|
+
name: 'String'
|
88
|
+
}
|
89
|
+
},
|
90
|
+
return_address: {
|
91
|
+
client_side_validation: true,
|
92
|
+
required: false,
|
93
|
+
serialized_name: 'properties.returnAddress',
|
94
|
+
type: {
|
95
|
+
name: 'Composite',
|
96
|
+
class_name: 'ReturnAddress'
|
97
|
+
}
|
98
|
+
},
|
99
|
+
return_shipping: {
|
100
|
+
client_side_validation: true,
|
101
|
+
required: false,
|
102
|
+
serialized_name: 'properties.returnShipping',
|
103
|
+
type: {
|
104
|
+
name: 'Composite',
|
105
|
+
class_name: 'ReturnShipping'
|
106
|
+
}
|
107
|
+
},
|
108
|
+
delivery_package: {
|
109
|
+
client_side_validation: true,
|
110
|
+
required: false,
|
111
|
+
serialized_name: 'properties.deliveryPackage',
|
112
|
+
type: {
|
113
|
+
name: 'Composite',
|
114
|
+
class_name: 'PackageInfomation'
|
115
|
+
}
|
116
|
+
},
|
117
|
+
log_level: {
|
118
|
+
client_side_validation: true,
|
119
|
+
required: false,
|
120
|
+
serialized_name: 'properties.logLevel',
|
121
|
+
type: {
|
122
|
+
name: 'String'
|
123
|
+
}
|
124
|
+
},
|
125
|
+
backup_drive_manifest: {
|
126
|
+
client_side_validation: true,
|
127
|
+
required: false,
|
128
|
+
serialized_name: 'properties.backupDriveManifest',
|
129
|
+
type: {
|
130
|
+
name: 'Boolean'
|
131
|
+
}
|
132
|
+
},
|
133
|
+
drive_list: {
|
134
|
+
client_side_validation: true,
|
135
|
+
required: false,
|
136
|
+
serialized_name: 'properties.driveList',
|
137
|
+
type: {
|
138
|
+
name: 'Sequence',
|
139
|
+
element: {
|
140
|
+
client_side_validation: true,
|
141
|
+
required: false,
|
142
|
+
serialized_name: 'DriveStatusElementType',
|
143
|
+
type: {
|
144
|
+
name: 'Composite',
|
145
|
+
class_name: 'DriveStatus'
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure end
|
7
|
+
module Azure::ImportExport end
|
8
|
+
module Azure::ImportExport::Mgmt end
|
9
|
+
module Azure::ImportExport::Mgmt::V2016_11_01 end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ImportExport::Mgmt::V2016_11_01
|
7
|
+
#
|
8
|
+
# The Storage Import/Export Resource Provider API.
|
9
|
+
#
|
10
|
+
class Operations
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Operations class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [StorageImportExport] reference to the StorageImportExport
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Returns the list of operations supported by the import/export resource
|
26
|
+
# provider.
|
27
|
+
#
|
28
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
29
|
+
# will be added to the HTTP request.
|
30
|
+
#
|
31
|
+
# @return [ListOperationsResponse] operation results.
|
32
|
+
#
|
33
|
+
def list(custom_headers:nil)
|
34
|
+
response = list_async(custom_headers:custom_headers).value!
|
35
|
+
response.body unless response.nil?
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Returns the list of operations supported by the import/export resource
|
40
|
+
# provider.
|
41
|
+
#
|
42
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
43
|
+
# will be added to the HTTP request.
|
44
|
+
#
|
45
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
46
|
+
#
|
47
|
+
def list_with_http_info(custom_headers:nil)
|
48
|
+
list_async(custom_headers:custom_headers).value!
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Returns the list of operations supported by the import/export resource
|
53
|
+
# provider.
|
54
|
+
#
|
55
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
56
|
+
# to the HTTP request.
|
57
|
+
#
|
58
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
59
|
+
#
|
60
|
+
def list_async(custom_headers:nil)
|
61
|
+
@client.api_version = '2016-11-01'
|
62
|
+
|
63
|
+
|
64
|
+
request_headers = {}
|
65
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
66
|
+
|
67
|
+
# Set Headers
|
68
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
69
|
+
request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
|
70
|
+
path_template = 'providers/Microsoft.ImportExport/operations'
|
71
|
+
|
72
|
+
request_url = @base_url || @client.base_url
|
73
|
+
|
74
|
+
options = {
|
75
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
76
|
+
query_params: {'api-version' => @client.api_version},
|
77
|
+
headers: request_headers.merge(custom_headers || {}),
|
78
|
+
base_url: request_url
|
79
|
+
}
|
80
|
+
promise = @client.make_request_async(:get, path_template, options)
|
81
|
+
|
82
|
+
promise = promise.then do |result|
|
83
|
+
http_response = result.response
|
84
|
+
status_code = http_response.status
|
85
|
+
response_content = http_response.body
|
86
|
+
unless status_code == 200
|
87
|
+
error_model = JSON.load(response_content)
|
88
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
89
|
+
end
|
90
|
+
|
91
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
92
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
93
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
94
|
+
# Deserialize Response
|
95
|
+
if status_code == 200
|
96
|
+
begin
|
97
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
98
|
+
result_mapper = Azure::ImportExport::Mgmt::V2016_11_01::Models::ListOperationsResponse.mapper()
|
99
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
100
|
+
rescue Exception => e
|
101
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
promise.execute
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ImportExport::Mgmt::V2016_11_01
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class StorageImportExport < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] Specifies the API version to use for this request.
|
21
|
+
attr_reader :api_version
|
22
|
+
|
23
|
+
# @return [String] The subscription ID for the Azure user.
|
24
|
+
attr_accessor :subscription_id
|
25
|
+
|
26
|
+
# @return [String] Specifies the preferred language for the response.
|
27
|
+
attr_accessor :accept_language
|
28
|
+
|
29
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
30
|
+
# Operations. Default value is 30.
|
31
|
+
attr_accessor :long_running_operation_retry_timeout
|
32
|
+
|
33
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
34
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
35
|
+
# generated and included in each request. Default is true.
|
36
|
+
attr_accessor :generate_client_request_id
|
37
|
+
|
38
|
+
# @return [Locations] locations
|
39
|
+
attr_reader :locations
|
40
|
+
|
41
|
+
# @return [Jobs] jobs
|
42
|
+
attr_reader :jobs
|
43
|
+
|
44
|
+
# @return [BitLockerKeys] bit_locker_keys
|
45
|
+
attr_reader :bit_locker_keys
|
46
|
+
|
47
|
+
# @return [Operations] operations
|
48
|
+
attr_reader :operations
|
49
|
+
|
50
|
+
#
|
51
|
+
# Creates initializes a new instance of the StorageImportExport class.
|
52
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
53
|
+
# @param base_url [String] the base URI of the service.
|
54
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
55
|
+
#
|
56
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
57
|
+
super(credentials, options)
|
58
|
+
@base_url = base_url || 'https://management.azure.com'
|
59
|
+
|
60
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
61
|
+
@credentials = credentials
|
62
|
+
|
63
|
+
@locations = Locations.new(self)
|
64
|
+
@jobs = Jobs.new(self)
|
65
|
+
@bit_locker_keys = BitLockerKeys.new(self)
|
66
|
+
@operations = Operations.new(self)
|
67
|
+
@api_version = '2016-11-01'
|
68
|
+
@long_running_operation_retry_timeout = 30
|
69
|
+
@generate_client_request_id = true
|
70
|
+
add_telemetry
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# Makes a request and returns the body of the response.
|
75
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
76
|
+
# @param path [String] the path, relative to {base_url}.
|
77
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
78
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
79
|
+
# Example:
|
80
|
+
#
|
81
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
82
|
+
# path = "/path"
|
83
|
+
# options = {
|
84
|
+
# body: request_content,
|
85
|
+
# query_params: {'api-version' => '2016-02-01'}
|
86
|
+
# }
|
87
|
+
# result = @client.make_request(:put, path, options)
|
88
|
+
#
|
89
|
+
def make_request(method, path, options = {})
|
90
|
+
result = make_request_with_http_info(method, path, options)
|
91
|
+
result.body unless result.nil?
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# Makes a request and returns the operation response.
|
96
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
97
|
+
# @param path [String] the path, relative to {base_url}.
|
98
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
99
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
100
|
+
#
|
101
|
+
def make_request_with_http_info(method, path, options = {})
|
102
|
+
result = make_request_async(method, path, options).value!
|
103
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
104
|
+
result
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# Makes a request asynchronously.
|
109
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
110
|
+
# @param path [String] the path, relative to {base_url}.
|
111
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
112
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
113
|
+
#
|
114
|
+
def make_request_async(method, path, options = {})
|
115
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
116
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
117
|
+
|
118
|
+
request_url = options[:base_url] || @base_url
|
119
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
120
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
121
|
+
end
|
122
|
+
|
123
|
+
request_headers = @request_headers
|
124
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
125
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
126
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
127
|
+
|
128
|
+
super(request_url, method, path, options)
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
private
|
133
|
+
#
|
134
|
+
# Adds telemetry information.
|
135
|
+
#
|
136
|
+
def add_telemetry
|
137
|
+
sdk_information = 'azure_mgmt_import_export'
|
138
|
+
sdk_information = "#{sdk_information}/0.17.0"
|
139
|
+
add_user_agent_information(sdk_information)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|