class Azure::PowerBiEmbedded::Mgmt::V2016_01_29::WorkspaceCollections

Client to manage your Power BI Embedded workspace collections and retrieve workspaces.

Attributes

client[R]

@return [PowerBIEmbeddedManagementClient] reference to the PowerBIEmbeddedManagementClient

Private Class Methods

new(client) click to toggle source

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

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 18
def initialize(client)
  @client = client
end

Private Instance Methods

begin_delete(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Delete a Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 975
def begin_delete(resource_group_name, workspace_collection_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Delete a Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 1006
def begin_delete_async(resource_group_name, workspace_collection_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_collection_name is nil' if workspace_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.PowerBI/workspaceCollections/{workspaceCollectionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceCollectionName' => workspace_collection_name},
      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 == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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
  end

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

Delete a Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 991
def begin_delete_with_http_info(resource_group_name, workspace_collection_name, custom_headers:nil)
  begin_delete_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
end
check_name_availability(location, body, custom_headers:nil) click to toggle source

Verify the specified Power BI Workspace Collection name is valid and not already in use.

@param location [String] Azure location @param body [CheckNameRequest] Check name availability request @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [CheckNameResponse] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 398
def check_name_availability(location, body, custom_headers:nil)
  response = check_name_availability_async(location, body, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
check_name_availability_async(location, body, custom_headers:nil) click to toggle source

Verify the specified Power BI Workspace Collection name is valid and not already in use.

@param location [String] Azure location @param body [CheckNameRequest] Check name availability request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 429
def check_name_availability_async(location, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'location is nil' if location.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.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::PowerBiEmbedded::Mgmt::V2016_01_29::Models::CheckNameRequest.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
      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 MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::CheckNameResponse.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, body, custom_headers:nil) click to toggle source

Verify the specified Power BI Workspace Collection name is valid and not already in use.

@param location [String] Azure location @param body [CheckNameRequest] Check name availability request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 414
def check_name_availability_with_http_info(location, body, custom_headers:nil)
  check_name_availability_async(location, body, custom_headers:custom_headers).value!
end
create(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [CreateWorkspaceCollectionRequest] Create workspace collection request @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [WorkspaceCollection] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 135
def create(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  response = create_async(resource_group_name, workspace_collection_name, body, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_async(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [CreateWorkspaceCollectionRequest] Create workspace collection request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 174
def create_async(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_collection_name is nil' if workspace_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.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::PowerBiEmbedded::Mgmt::V2016_01_29::Models::CreateWorkspaceCollectionRequest.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceCollectionName' => workspace_collection_name},
      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
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollection.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
create_with_http_info(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [CreateWorkspaceCollectionRequest] Create workspace collection request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 155
def create_with_http_info(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  create_async(resource_group_name, workspace_collection_name, body, custom_headers:custom_headers).value!
end
delete(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Delete a Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 356
def delete(resource_group_name, workspace_collection_name, custom_headers:nil)
  response = delete_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
  nil
end
delete_async(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 371
def delete_async(resource_group_name, workspace_collection_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, workspace_collection_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_access_keys(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [WorkspaceCollectionAccessKeys] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 679
def get_access_keys(resource_group_name, workspace_collection_name, custom_headers:nil)
  response = get_access_keys_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_access_keys_async(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 712
def get_access_keys_async(resource_group_name, workspace_collection_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_collection_name is nil' if workspace_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.PowerBI/workspaceCollections/{workspaceCollectionName}/listKeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceCollectionName' => workspace_collection_name},
      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
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollectionAccessKeys.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_access_keys_with_http_info(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 696
def get_access_keys_with_http_info(resource_group_name, workspace_collection_name, custom_headers:nil)
  get_access_keys_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
end
get_by_name(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Retrieves an existing Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [WorkspaceCollection] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 36
def get_by_name(resource_group_name, workspace_collection_name, custom_headers:nil)
  response = get_by_name_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_by_name_async(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Retrieves an existing Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 67
def get_by_name_async(resource_group_name, workspace_collection_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_collection_name is nil' if workspace_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.PowerBI/workspaceCollections/{workspaceCollectionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceCollectionName' => workspace_collection_name},
      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 MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollection.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_by_name_with_http_info(resource_group_name, workspace_collection_name, custom_headers:nil) click to toggle source

Retrieves an existing Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 52
def get_by_name_with_http_info(resource_group_name, workspace_collection_name, custom_headers:nil)
  get_by_name_async(resource_group_name, workspace_collection_name, custom_headers:custom_headers).value!
end
list_by_resource_group(resource_group_name, custom_headers:nil) click to toggle source

Retrieves all existing Power BI workspace collections in the specified resource group.

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

@return [WorkspaceCollectionList] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 499
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

Retrieves all existing Power BI workspace collections in the specified resource group.

@param resource_group_name [String] Azure resource group @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 528
def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.PowerBI/workspaceCollections'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      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 MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollectionList.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

Retrieves all existing Power BI workspace collections in the specified resource group.

@param resource_group_name [String] Azure resource group @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 514
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_by_subscription(custom_headers:nil) click to toggle source

Retrieves all existing Power BI workspace collections in the specified subscription.

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

@return [WorkspaceCollectionList] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 589
def list_by_subscription(custom_headers:nil)
  response = list_by_subscription_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_by_subscription_async(custom_headers:nil) click to toggle source

Retrieves all existing Power BI workspace collections in the specified 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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 616
def list_by_subscription_async(custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.PowerBI/workspaceCollections'

  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 MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollectionList.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_subscription_with_http_info(custom_headers:nil) click to toggle source

Retrieves all existing Power BI workspace collections in the specified 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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 603
def list_by_subscription_with_http_info(custom_headers:nil)
  list_by_subscription_async(custom_headers:custom_headers).value!
end
migrate(resource_group_name, body, custom_headers:nil) click to toggle source

Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription.

@param resource_group_name [String] Azure resource group @param body [MigrateWorkspaceCollectionRequest] Workspace migration request @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 884
def migrate(resource_group_name, body, custom_headers:nil)
  response = migrate_async(resource_group_name, body, custom_headers:custom_headers).value!
  nil
end
migrate_async(resource_group_name, body, custom_headers:nil) click to toggle source

Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription.

@param resource_group_name [String] Azure resource group @param body [MigrateWorkspaceCollectionRequest] Workspace migration request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 915
def migrate_async(resource_group_name, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.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::PowerBiEmbedded::Mgmt::V2016_01_29::Models::MigrateWorkspaceCollectionRequest.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      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 MsRest::HttpOperationError.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
  end

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

Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription.

@param resource_group_name [String] Azure resource group @param body [MigrateWorkspaceCollectionRequest] Workspace migration request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 900
def migrate_with_http_info(resource_group_name, body, custom_headers:nil)
  migrate_async(resource_group_name, body, custom_headers:custom_headers).value!
end
regenerate_key(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Regenerates the primary or secondary access key for the specified Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [WorkspaceCollectionAccessKey] Access key to regenerate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [WorkspaceCollectionAccessKeys] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 778
def regenerate_key(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  response = regenerate_key_async(resource_group_name, workspace_collection_name, body, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
regenerate_key_async(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Regenerates the primary or secondary access key for the specified Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [WorkspaceCollectionAccessKey] Access key to regenerate @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 813
def regenerate_key_async(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_collection_name is nil' if workspace_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.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::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollectionAccessKey.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/regenerateKey'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceCollectionName' => workspace_collection_name},
      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 MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollectionAccessKeys.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
regenerate_key_with_http_info(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Regenerates the primary or secondary access key for the specified Power BI Workspace Collection.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [WorkspaceCollectionAccessKey] Access key to regenerate @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 796
def regenerate_key_with_http_info(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  regenerate_key_async(resource_group_name, workspace_collection_name, body, custom_headers:custom_headers).value!
end
update(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Update an existing Power BI Workspace Collection with the specified properties.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [UpdateWorkspaceCollectionRequest] Update workspace collection request @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [WorkspaceCollection] operation results.

# File lib/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 249
def update(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  response = update_async(resource_group_name, workspace_collection_name, body, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_async(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Update an existing Power BI Workspace Collection with the specified properties.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [UpdateWorkspaceCollectionRequest] Update workspace collection request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 286
def update_async(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_collection_name is nil' if workspace_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.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::PowerBiEmbedded::Mgmt::V2016_01_29::Models::UpdateWorkspaceCollectionRequest.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceCollectionName' => workspace_collection_name},
      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
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PowerBiEmbedded::Mgmt::V2016_01_29::Models::WorkspaceCollection.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
update_with_http_info(resource_group_name, workspace_collection_name, body, custom_headers:nil) click to toggle source

Update an existing Power BI Workspace Collection with the specified properties.

@param resource_group_name [String] Azure resource group @param workspace_collection_name [String] Power BI Embedded Workspace Collection name @param body [UpdateWorkspaceCollectionRequest] Update workspace collection request @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/2016-01-29/generated/azure_mgmt_powerbi_embedded/workspace_collections.rb, line 268
def update_with_http_info(resource_group_name, workspace_collection_name, body, custom_headers:nil)
  update_async(resource_group_name, workspace_collection_name, body, custom_headers:custom_headers).value!
end