class Azure::PowerBiDedicated::Mgmt::V2017_10_01::Capacities

PowerBI Dedicated Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete Power BI dedicated capacities

Attributes

client[R]

@return [PowerBIDedicatedManagementClient] reference to the PowerBIDedicatedManagementClient

Private Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the Capacities class. @param client service class for accessing basic functionality.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 19
def initialize(client)
  @client = client
end

Private Instance Methods

begin_create(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil) click to toggle source

Provisions the specified Dedicated capacity based on the configuration specified in the request.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param capacity_parameters [DedicatedCapacity] Contains the information used to provision the Dedicated capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacity] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 875
def begin_create(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil)
  response = begin_create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil) click to toggle source

Provisions the specified Dedicated capacity based on the configuration specified in the request.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param capacity_parameters [DedicatedCapacity] Contains the information used to provision the Dedicated capacity. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 916
def begin_create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, 'capacity_parameters is nil' if capacity_parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
  request_content = @client.serialize(request_mapper,  capacity_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 201
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_create_with_http_info(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil) click to toggle source

Provisions the specified Dedicated capacity based on the configuration specified in the request.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param capacity_parameters [DedicatedCapacity] Contains the information used to provision the Dedicated capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 896
def begin_create_with_http_info(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil)
  begin_create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:custom_headers).value!
end
begin_delete(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Deletes the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1007
def begin_delete(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Deletes the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1042
def begin_delete_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 204 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end
begin_delete_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Deletes the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1025
def begin_delete_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  begin_delete_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
end
begin_resume(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Resumes operation of the specified Dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1336
def begin_resume(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = begin_resume_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  nil
end
begin_resume_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Resumes operation of the specified Dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1371
def begin_resume_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/resume'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end
begin_resume_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Resumes operation of the specified Dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1354
def begin_resume_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  begin_resume_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
end
begin_suspend(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Suspends operation of the specified dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1238
def begin_suspend(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = begin_suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  nil
end
begin_suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Suspends operation of the specified dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1273
def begin_suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/suspend'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end
begin_suspend_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Suspends operation of the specified dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1256
def begin_suspend_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  begin_suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
end
begin_update(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil) click to toggle source

Updates the current state of the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param capacity_update_parameters [DedicatedCapacityUpdateParameters] Request object that contains the updated information for the capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacity] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1108
def begin_update(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil)
  response = begin_update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil) click to toggle source

Updates the current state of the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param capacity_update_parameters [DedicatedCapacityUpdateParameters] Request object that contains the updated information for the capacity. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1147
def begin_update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, 'capacity_update_parameters is nil' if capacity_update_parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacityUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  capacity_update_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_update_with_http_info(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil) click to toggle source

Updates the current state of the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param capacity_update_parameters [DedicatedCapacityUpdateParameters] Request object that contains the updated information for the capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 1128
def begin_update_with_http_info(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil)
  begin_update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:custom_headers).value!
end
check_name_availability(location, capacity_parameters, custom_headers:nil) click to toggle source

Check the name availability in the target location.

@param location [String] The region name which the operation will lookup into. @param capacity_parameters [CheckCapacityNameAvailabilityParameters] The name of the capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [CheckCapacityNameAvailabilityResult] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 764
def check_name_availability(location, capacity_parameters, custom_headers:nil)
  response = check_name_availability_async(location, capacity_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
check_name_availability_async(location, capacity_parameters, custom_headers:nil) click to toggle source

Check the name availability in the target location.

@param location [String] The region name which the operation will lookup into. @param capacity_parameters [CheckCapacityNameAvailabilityParameters] The name of the capacity. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 797
def check_name_availability_async(location, capacity_parameters, custom_headers:nil)
  fail ArgumentError, 'location is nil' if location.nil?
  fail ArgumentError, 'capacity_parameters is nil' if capacity_parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::CheckCapacityNameAvailabilityParameters.mapper()
  request_content = @client.serialize(request_mapper,  capacity_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/locations/{location}/checkNameAvailability'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::CheckCapacityNameAvailabilityResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
check_name_availability_with_http_info(location, capacity_parameters, custom_headers:nil) click to toggle source

Check the name availability in the target location.

@param location [String] The region name which the operation will lookup into. @param capacity_parameters [CheckCapacityNameAvailabilityParameters] The name of the capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 781
def check_name_availability_with_http_info(location, capacity_parameters, custom_headers:nil)
  check_name_availability_async(location, capacity_parameters, custom_headers:custom_headers).value!
end
create(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil) click to toggle source

Provisions the specified Dedicated capacity based on the configuration specified in the request.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param capacity_parameters [DedicatedCapacity] Contains the information used to provision the Dedicated capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacity] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 151
def create(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil)
  response = create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param capacity_parameters [DedicatedCapacity] Contains the information used to provision the Dedicated capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 170
def create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:nil)
  # Send request
  promise = begin_create_async(resource_group_name, dedicated_capacity_name, capacity_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
delete(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Deletes the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 199
def delete(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = delete_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  nil
end
delete_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 216
def delete_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_details(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Gets details about the specified dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacity] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 39
def get_details(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = get_details_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_details_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Gets details about the specified dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 74
def get_details_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
get_details_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Gets details about the specified dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 57
def get_details_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  get_details_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
end
list(custom_headers:nil) click to toggle source

Lists all the Dedicated capacities for the given subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacities] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 479
def list(custom_headers:nil)
  response = list_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_async(custom_headers:nil) click to toggle source

Lists all the Dedicated capacities for the given subscription.

@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 504
def list_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacities.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_by_resource_group(resource_group_name, custom_headers:nil) click to toggle source

Gets all the Dedicated capacities for the given resource group.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacities] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 383
def list_by_resource_group(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_by_resource_group_async(resource_group_name, custom_headers:nil) click to toggle source

Gets all the Dedicated capacities for the given resource group.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 414
def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacities.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil) click to toggle source

Gets all the Dedicated capacities for the given resource group.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 399
def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end
list_skus(custom_headers:nil) click to toggle source

Lists eligible SKUs for PowerBI Dedicated resource provider.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SkuEnumerationForNewResourceResult] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 565
def list_skus(custom_headers:nil)
  response = list_skus_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_skus_async(custom_headers:nil) click to toggle source

Lists eligible SKUs for PowerBI Dedicated resource provider.

@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 590
def list_skus_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::SkuEnumerationForNewResourceResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_skus_for_capacity(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Lists eligible SKUs for a PowerBI Dedicated resource.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SkuEnumerationForExistingResourceResult] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 656
def list_skus_for_capacity(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = list_skus_for_capacity_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_skus_for_capacity_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Lists eligible SKUs for a PowerBI Dedicated resource.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 691
def list_skus_for_capacity_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'dedicated_capacity_name is nil' if dedicated_capacity_name.nil?
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MaxLength': '63'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length > 63
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'MinLength': '3'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.length < 3
  fail ArgumentError, "'dedicated_capacity_name' should satisfy the constraint - 'Pattern': '^[a-z][a-z0-9]*$'" if !dedicated_capacity_name.nil? && dedicated_capacity_name.match(Regexp.new('^^[a-z][a-z0-9]*$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/skus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'dedicatedCapacityName' => dedicated_capacity_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::SkuEnumerationForExistingResourceResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_skus_for_capacity_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Lists eligible SKUs for a PowerBI Dedicated resource.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 674
def list_skus_for_capacity_with_http_info(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  list_skus_for_capacity_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
end
list_skus_with_http_info(custom_headers:nil) click to toggle source

Lists eligible SKUs for PowerBI Dedicated resource provider.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 578
def list_skus_with_http_info(custom_headers:nil)
  list_skus_async(custom_headers:custom_headers).value!
end
list_with_http_info(custom_headers:nil) click to toggle source

Lists all the Dedicated capacities for the given subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 492
def list_with_http_info(custom_headers:nil)
  list_async(custom_headers:custom_headers).value!
end
resume(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Resumes operation of the specified Dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 339
def resume(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = resume_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  nil
end
resume_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 356
def resume_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  # Send request
  promise = begin_resume_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
suspend(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

Suspends operation of the specified dedicated capacity instance.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 295
def suspend(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  response = suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers).value!
  nil
end
suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 312
def suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:nil)
  # Send request
  promise = begin_suspend_async(resource_group_name, dedicated_capacity_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
update(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil) click to toggle source

Updates the current state of the specified Dedicated capacity.

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param capacity_update_parameters [DedicatedCapacityUpdateParameters] Request object that contains the updated information for the capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DedicatedCapacity] operation results.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 247
def update(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil)
  response = update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. This name must be at least 1 character in length, and no more than 90. @param dedicated_capacity_name [String] The name of the Dedicated capacity. It must be at least 3 characters in length, and no more than 63. @param capacity_update_parameters [DedicatedCapacityUpdateParameters] Request object that contains the updated information for the capacity. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-10-01/generated/azure_mgmt_powerbi_dedicated/capacities.rb, line 266
def update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, dedicated_capacity_name, capacity_update_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::PowerBiDedicated::Mgmt::V2017_10_01::Models::DedicatedCapacity.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end