Class: Azure::RecoveryServicesBackup::Mgmt::V2019_05_13::RecoveryServicesBackupClient

Inherits:
MsRestAzure::AzureServiceClient
  • Object
show all
Includes:
MsRestAzure, MsRestAzure::Serialization
Defined in:
lib/2019-05-13/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.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 93

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

  @backup_resource_vault_configs = BackupResourceVaultConfigs.new(self)
  @protected_items = ProtectedItems.new(self)
  @protected_item_operation_results = ProtectedItemOperationResults.new(self)
  @recovery_points = RecoveryPoints.new(self)
  @restores = Restores.new(self)
  @backup_policies = BackupPolicies.new(self)
  @protection_policies = ProtectionPolicies.new(self)
  @protection_policy_operation_results = ProtectionPolicyOperationResults.new(self)
  @backup_jobs = BackupJobs.new(self)
  @job_details = JobDetails.new(self)
  @job_cancellations = JobCancellations.new(self)
  @job_operation_results = JobOperationResults.new(self)
  @export_jobs_operation_results = ExportJobsOperationResults.new(self)
  @jobs = Jobs.new(self)
  @backup_protected_items = BackupProtectedItems.new(self)
  @operation = Operation.new(self)
  @api_version = '2019-05-13'
  @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.



27
28
29
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 27

def accept_language
  @accept_language
end

#api_versionString (readonly)

Returns Client Api Version.

Returns:

  • (String)

    Client Api Version.



24
25
26
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 24

def api_version
  @api_version
end

#backup_jobsBackupJobs (readonly)

Returns backup_jobs.

Returns:



64
65
66
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 64

def backup_jobs
  @backup_jobs
end

#backup_policiesBackupPolicies (readonly)

Returns backup_policies.

Returns:



54
55
56
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 54

def backup_policies
  @backup_policies
end

#backup_protected_itemsBackupProtectedItems (readonly)

Returns backup_protected_items.

Returns:



82
83
84
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 82

def backup_protected_items
  @backup_protected_items
end

#backup_resource_vault_configsBackupResourceVaultConfigs (readonly)

Returns backup_resource_vault_configs.

Returns:



39
40
41
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 39

def backup_resource_vault_configs
  @backup_resource_vault_configs
end

#base_urlString

Returns the base URI of the service.

Returns:

  • (String)

    the base URI of the service.



15
16
17
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 15

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.



18
19
20
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 18

def credentials
  @credentials
end

#export_jobs_operation_resultsExportJobsOperationResults (readonly)

Returns export_jobs_operation_results.

Returns:



76
77
78
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 76

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



36
37
38
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 36

def generate_client_request_id
  @generate_client_request_id
end

#job_cancellationsJobCancellations (readonly)

Returns job_cancellations.

Returns:



70
71
72
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 70

def job_cancellations
  @job_cancellations
end

#job_detailsJobDetails (readonly)

Returns job_details.

Returns:



67
68
69
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 67

def job_details
  @job_details
end

#job_operation_resultsJobOperationResults (readonly)

Returns job_operation_results.

Returns:



73
74
75
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 73

def job_operation_results
  @job_operation_results
end

#jobsJobs (readonly)

Returns jobs.

Returns:



79
80
81
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 79

def jobs
  @jobs
end

#long_running_operation_retry_timeoutInteger

Operations. Default value is 30.

Returns:

  • (Integer)

    The retry timeout in seconds for Long Running



31
32
33
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 31

def long_running_operation_retry_timeout
  @long_running_operation_retry_timeout
end

#operationOperation (readonly)

Returns operation.

Returns:



85
86
87
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 85

def operation
  @operation
end

#protected_item_operation_resultsProtectedItemOperationResults (readonly)

Returns protected_item_operation_results.

Returns:



45
46
47
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 45

def protected_item_operation_results
  @protected_item_operation_results
end

#protected_itemsProtectedItems (readonly)

Returns protected_items.

Returns:



42
43
44
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 42

def protected_items
  @protected_items
end

#protection_policiesProtectionPolicies (readonly)

Returns protection_policies.

Returns:



57
58
59
# File 'lib/2019-05-13/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



61
62
63
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 61

def protection_policy_operation_results
  @protection_policy_operation_results
end

#recovery_pointsRecoveryPoints (readonly)

Returns recovery_points.

Returns:



48
49
50
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 48

def recovery_points
  @recovery_points
end

#restoresRestores (readonly)

Returns restores.

Returns:



51
52
53
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 51

def restores
  @restores
end

#subscription_idString

Returns The subscription Id.

Returns:

  • (String)

    The subscription Id.



21
22
23
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 21

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.



139
140
141
142
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 139

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.



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 164

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.



151
152
153
154
155
# File 'lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 151

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