Class: Azure::RecoveryServicesBackup::Mgmt::V2016_06_01::RecoveryServicesBackupClient

Inherits:
MsRestAzure::AzureServiceClient
  • Object
show all
Includes:
MsRestAzure, MsRestAzure::Serialization
Defined in:
lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb

Overview

A service client - single point of access to the REST API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials = nil, base_url = nil, options = nil) ⇒ RecoveryServicesBackupClient

Creates initializes a new instance of the RecoveryServicesBackupClient class.

Parameters:

  • credentials (MsRest::ServiceClientCredentials) (defaults to: nil)

    credentials to authorize HTTP requests made by the service client.

  • base_url (String) (defaults to: nil)

    the base URI of the service.

  • options (Array) (defaults to: nil)

    filters to be applied to the HTTP requests.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 119

def initialize(credentials = nil, base_url = nil, options = nil)
  super(credentials, options)
  @base_url = base_url || 'https://management.azure.com'

  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
  @credentials = credentials

  @item_level_recovery_connections = ItemLevelRecoveryConnections.new(self)
  @restores = Restores.new(self)
  @protection_policy_operation_statuses = ProtectionPolicyOperationStatuses.new(self)
  @protection_policy_operation_results = ProtectionPolicyOperationResults.new(self)
  @protection_policies = ProtectionPolicies.new(self)
  @protection_container_operation_results = ProtectionContainerOperationResults.new(self)
  @protection_container_refresh_operation_results = ProtectionContainerRefreshOperationResults.new(self)
  @protection_containers = ProtectionContainers.new(self)
  @recovery_points = RecoveryPoints.new(self)
  @backups = Backups.new(self)
  @protected_item_operation_statuses = ProtectedItemOperationStatuses.new(self)
  @protected_item_operation_results = ProtectedItemOperationResults.new(self)
  @protected_items = ProtectedItems.new(self)
  @protectable_items = ProtectableItems.new(self)
  @export_jobs_operation_results = ExportJobsOperationResults.new(self)
  @job_operation_results = JobOperationResults.new(self)
  @jobs = Jobs.new(self)
  @job_cancellations = JobCancellations.new(self)
  @job_details = JobDetails.new(self)
  @backup_operation_statuses = BackupOperationStatuses.new(self)
  @backup_operation_results = BackupOperationResults.new(self)
  @backup_engines = BackupEngines.new(self)
  @api_version = '2016-06-01'
  @accept_language = 'en-US'
  @long_running_operation_retry_timeout = 30
  @generate_client_request_id = true
  add_telemetry
end

Instance Attribute Details

#accept_languageString

Returns The preferred language for the response.

Returns:

  • (String)

    The preferred language for the response.



31
32
33
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 31

def accept_language
  @accept_language
end

#api_versionString (readonly)

Returns Client API version.

Returns:

  • (String)

    Client API version.



28
29
30
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 28

def api_version
  @api_version
end

#backup_enginesBackupEngines (readonly)

Returns backup_engines.

Returns:



111
112
113
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 111

def backup_engines
  @backup_engines
end

#backup_operation_resultsBackupOperationResults (readonly)

Returns backup_operation_results.

Returns:



108
109
110
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 108

def backup_operation_results
  @backup_operation_results
end

#backup_operation_statusesBackupOperationStatuses (readonly)

Returns backup_operation_statuses.

Returns:



105
106
107
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 105

def backup_operation_statuses
  @backup_operation_statuses
end

#backupsBackups (readonly)

Returns backups.

Returns:



74
75
76
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 74

def backups
  @backups
end

#base_urlString

Returns the base URI of the service.

Returns:

  • (String)

    the base URI of the service.



19
20
21
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 19

def base_url
  @base_url
end

#credentialsObject (readonly)

Returns Credentials needed for the client to connect to Azure.

Returns:

  • Credentials needed for the client to connect to Azure.



22
23
24
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 22

def credentials
  @credentials
end

#export_jobs_operation_resultsExportJobsOperationResults (readonly)

Returns export_jobs_operation_results.

Returns:



90
91
92
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 90

def export_jobs_operation_results
  @export_jobs_operation_results
end

#generate_client_request_idBoolean

generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.

Returns:

  • (Boolean)

    Whether a unique x-ms-client-request-id should be



40
41
42
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 40

def generate_client_request_id
  @generate_client_request_id
end

#item_level_recovery_connectionsItemLevelRecoveryConnections (readonly)

Returns item_level_recovery_connections.

Returns:



43
44
45
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 43

def item_level_recovery_connections
  @item_level_recovery_connections
end

#job_cancellationsJobCancellations (readonly)

Returns job_cancellations.

Returns:



99
100
101
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 99

def job_cancellations
  @job_cancellations
end

#job_detailsJobDetails (readonly)

Returns job_details.

Returns:



102
103
104
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 102

def job_details
  @job_details
end

#job_operation_resultsJobOperationResults (readonly)

Returns job_operation_results.

Returns:



93
94
95
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 93

def job_operation_results
  @job_operation_results
end

#jobsJobs (readonly)

Returns jobs.

Returns:



96
97
98
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 96

def jobs
  @jobs
end

#long_running_operation_retry_timeoutInteger

Operations. Default value is 30.

Returns:

  • (Integer)

    The retry timeout in seconds for Long Running



35
36
37
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 35

def long_running_operation_retry_timeout
  @long_running_operation_retry_timeout
end

#protectable_itemsProtectableItems (readonly)

Returns protectable_items.

Returns:



87
88
89
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 87

def protectable_items
  @protectable_items
end

#protected_item_operation_resultsProtectedItemOperationResults (readonly)

Returns protected_item_operation_results.

Returns:



81
82
83
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 81

def protected_item_operation_results
  @protected_item_operation_results
end

#protected_item_operation_statusesProtectedItemOperationStatuses (readonly)

protected_item_operation_statuses



78
79
80
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 78

def protected_item_operation_statuses
  @protected_item_operation_statuses
end

#protected_itemsProtectedItems (readonly)

Returns protected_items.

Returns:



84
85
86
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 84

def protected_items
  @protected_items
end

#protection_container_operation_resultsProtectionContainerOperationResults (readonly)

protection_container_operation_results



61
62
63
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 61

def protection_container_operation_results
  @protection_container_operation_results
end

#protection_container_refresh_operation_resultsProtectionContainerRefreshOperationResults (readonly)

protection_container_refresh_operation_results



65
66
67
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 65

def protection_container_refresh_operation_results
  @protection_container_refresh_operation_results
end

#protection_containersProtectionContainers (readonly)

Returns protection_containers.

Returns:



68
69
70
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 68

def protection_containers
  @protection_containers
end

#protection_policiesProtectionPolicies (readonly)

Returns protection_policies.

Returns:



57
58
59
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 57

def protection_policies
  @protection_policies
end

#protection_policy_operation_resultsProtectionPolicyOperationResults (readonly)

protection_policy_operation_results



54
55
56
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 54

def protection_policy_operation_results
  @protection_policy_operation_results
end

#protection_policy_operation_statusesProtectionPolicyOperationStatuses (readonly)

protection_policy_operation_statuses



50
51
52
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 50

def protection_policy_operation_statuses
  @protection_policy_operation_statuses
end

#recovery_pointsRecoveryPoints (readonly)

Returns recovery_points.

Returns:



71
72
73
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 71

def recovery_points
  @recovery_points
end

#restoresRestores (readonly)

Returns restores.

Returns:



46
47
48
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 46

def restores
  @restores
end

#subscription_idString

Returns The subscription ID.

Returns:

  • (String)

    The subscription ID.



25
26
27
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 25

def subscription_id
  @subscription_id
end

Instance Method Details

#make_request(method, path, options = {}) ⇒ Hash{String=>String}

Makes a request and returns the body of the response. Example:

request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
path = "/path"
options = {
  body: request_content,
  query_params: {'api-version' => '2016-02-01'}
}
result = @client.make_request(:put, path, options)

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (Hash{String=>String})

    containing the body of the response.



171
172
173
174
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 171

def make_request(method, path, options = {})
  result = make_request_with_http_info(method, path, options)
  result.body unless result.nil?
end

#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise

Makes a request asynchronously.

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 196

def make_request_async(method, path, options = {})
  fail ArgumentError, 'method is nil' if method.nil?
  fail ArgumentError, 'path is nil' if path.nil?

  request_url = options[:base_url] || @base_url
  if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
    @request_headers['Content-Type'] = options[:headers]['Content-Type']
  end

  request_headers = @request_headers
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
  options.merge!({headers: request_headers.merge(options[:headers] || {})})
  options.merge!({credentials: @credentials}) unless @credentials.nil?

  super(request_url, method, path, options)
end

#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse

Makes a request and returns the operation response.

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (MsRestAzure::AzureOperationResponse)

    Operation response containing the request, response and status.



183
184
185
186
187
# File 'lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 183

def make_request_with_http_info(method, path, options = {})
  result = make_request_async(method, path, options).value!
  result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
  result
end