Class: Azure::ARM::SQL::SqlManagementClient

Inherits:
MsRestAzure::AzureServiceClient
  • Object
show all
Includes:
MsRestAzure, MsRestAzure::Serialization
Defined in:
lib/generated/azure_mgmt_sql/sql_management_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) ⇒ SqlManagementClient

Creates initializes a new instance of the SqlManagementClient 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.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 83

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

  @databases = Databases.new(self)
  @servers = Servers.new(self)
  @recoverable_databases = RecoverableDatabases.new(self)
  @restorable_dropped_databases = RestorableDroppedDatabases.new(self)
  @capabilities = Capabilities.new(self)
  @firewall_rules = FirewallRules.new(self)
  @elastic_pools = ElasticPools.new(self)
  @operations = Operations.new(self)
  @server_azure_adadministrators = ServerAzureADAdministrators.new(self)
  @server_communication_links = ServerCommunicationLinks.new(self)
  @recommended_elastic_pools = RecommendedElasticPools.new(self)
  @failover_groups = FailoverGroups.new(self)
  @server_keys = ServerKeys.new(self)
  @virtual_network_rules = VirtualNetworkRules.new(self)
  @accept_language = 'en-US'
  @long_running_operation_retry_timeout = 30
  @generate_client_request_id = true
  add_telemetry
end

Instance Attribute Details

#accept_languageString

Returns Gets or sets the preferred language for the response.

Returns:

  • (String)

    Gets or sets the preferred language for the response.



25
26
27
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 25

def accept_language
  @accept_language
end

#base_urlString

Returns the base URI of the service.

Returns:

  • (String)

    the base URI of the service.



15
16
17
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 15

def base_url
  @base_url
end

#capabilitiesCapabilities (readonly)

Returns capabilities.

Returns:



48
49
50
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 48

def capabilities
  @capabilities
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/generated/azure_mgmt_sql/sql_management_client.rb', line 18

def credentials
  @credentials
end

#databasesDatabases (readonly)

Returns databases.

Returns:



36
37
38
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 36

def databases
  @databases
end

#elastic_poolsElasticPools (readonly)

Returns elastic_pools.

Returns:



54
55
56
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 54

def elastic_pools
  @elastic_pools
end

#failover_groupsFailoverGroups (readonly)

Returns failover_groups.

Returns:



69
70
71
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 69

def failover_groups
  @failover_groups
end

#firewall_rulesFirewallRules (readonly)

Returns firewall_rules.

Returns:



51
52
53
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 51

def firewall_rules
  @firewall_rules
end

#generate_client_request_idBoolean

is generated and included in each request. Default is true.

Returns:

  • (Boolean)

    When set to true a unique x-ms-client-request-id value



33
34
35
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 33

def generate_client_request_id
  @generate_client_request_id
end

#long_running_operation_retry_timeoutInteger

Running Operations. Default value is 30.

Returns:

  • (Integer)

    Gets or sets the retry timeout in seconds for Long



29
30
31
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 29

def long_running_operation_retry_timeout
  @long_running_operation_retry_timeout
end

#operationsOperations (readonly)

Returns operations.

Returns:



57
58
59
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 57

def operations
  @operations
end

Returns recommended_elastic_pools.

Returns:



66
67
68
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 66

def recommended_elastic_pools
  @recommended_elastic_pools
end

#recoverable_databasesRecoverableDatabases (readonly)

Returns recoverable_databases.

Returns:



42
43
44
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 42

def recoverable_databases
  @recoverable_databases
end

#restorable_dropped_databasesRestorableDroppedDatabases (readonly)

Returns restorable_dropped_databases.

Returns:



45
46
47
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 45

def restorable_dropped_databases
  @restorable_dropped_databases
end

#server_azure_adadministratorsServerAzureADAdministrators (readonly)

Returns server_azure_adadministrators.

Returns:



60
61
62
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 60

def server_azure_adadministrators
  @server_azure_adadministrators
end

Returns server_communication_links.

Returns:



63
64
65
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 63

def server_communication_links
  @server_communication_links
end

#server_keysServerKeys (readonly)

Returns server_keys.

Returns:



72
73
74
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 72

def server_keys
  @server_keys
end

#serversServers (readonly)

Returns servers.

Returns:



39
40
41
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 39

def servers
  @servers
end

#subscription_idString

subscription.

Returns:

  • (String)

    The subscription ID that identifies an Azure



22
23
24
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 22

def subscription_id
  @subscription_id
end

#virtual_network_rulesVirtualNetworkRules (readonly)

Returns virtual_network_rules.

Returns:



75
76
77
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 75

def virtual_network_rules
  @virtual_network_rules
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.



126
127
128
129
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 126

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.



151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 151

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

  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.



138
139
140
141
142
# File 'lib/generated/azure_mgmt_sql/sql_management_client.rb', line 138

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