class Azure::EventGrid::Mgmt::V2017_06_15_preview::EventSubscriptions

Azure EventGrid Management Client

Attributes

client[R]

@return [EventGridManagementClient] reference to the EventGridManagementClient

Public Class Methods

new(client) click to toggle source

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

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 17
def initialize(client)
  @client = client
end

Public Instance Methods

begin_create(scope, event_subscription_name, event_subscription_info, custom_headers:nil) click to toggle source

Create an event subscription

Asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot be updated with this API and should instead use the Update event subscription API.

@param scope [String] The scope of the resource to which the event subscription needs to be created. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created. Event subscription names must be between 3 and 64 characters in length and use alphanumeric letters only. @param event_subscription_info [EventSubscription] Event subscription properties containing the destination and filter information @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscription] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1452
def begin_create(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
  response = begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil) click to toggle source

Create an event subscription

Asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot be updated with this API and should instead use the Update event subscription API.

@param scope [String] The scope of the resource to which the event subscription needs to be created. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created. Event subscription names must be between 3 and 64 characters in length and use alphanumeric letters only. @param event_subscription_info [EventSubscription] Event subscription properties containing the destination and filter information @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1517
def begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
  fail ArgumentError, 'event_subscription_info is nil' if event_subscription_info.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?

  # Serialize Request
  request_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.mapper()
  request_content = @client.serialize(request_mapper,  event_subscription_info)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'eventSubscriptionName' => event_subscription_name},
      skip_encoding_path_params: {'scope' => scope},
      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 == 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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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(scope, event_subscription_name, event_subscription_info, custom_headers:nil) click to toggle source

Create an event subscription

Asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot be updated with this API and should instead use the Update event subscription API.

@param scope [String] The scope of the resource to which the event subscription needs to be created. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created. Event subscription names must be between 3 and 64 characters in length and use alphanumeric letters only. @param event_subscription_info [EventSubscription] Event subscription properties containing the destination and filter information @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1485
def begin_create_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
  begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
end
begin_delete(scope, event_subscription_name, custom_headers:nil) click to toggle source

Delete an event subscription

Delete an existing event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1600
def begin_delete(scope, event_subscription_name, custom_headers:nil)
  response = begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(scope, event_subscription_name, custom_headers:nil) click to toggle source

Delete an event subscription

Delete an existing event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1651
def begin_delete_async(scope, event_subscription_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'event_subscription_name is nil' if event_subscription_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 = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'eventSubscriptionName' => event_subscription_name},
      skip_encoding_path_params: {'scope' => scope},
      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 == 202 || status_code == 204
      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(scope, event_subscription_name, custom_headers:nil) click to toggle source

Delete an event subscription

Delete an existing event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1626
def begin_delete_with_http_info(scope, event_subscription_name, custom_headers:nil)
  begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
end
begin_update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil) click to toggle source

Update an event subscription

Asynchronously updates an existing event subscription.

@param scope [String] The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created @param event_subscription_update_parameters

EventSubscriptionUpdateParameters

Updated event subscription information

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

@return [EventSubscription] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1720
def begin_update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
  response = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil) click to toggle source

Update an event subscription

Asynchronously updates an existing event subscription.

@param scope [String] The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created @param event_subscription_update_parameters

EventSubscriptionUpdateParameters

Updated event subscription information

@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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1777
def begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
  fail ArgumentError, 'event_subscription_update_parameters is nil' if event_subscription_update_parameters.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?

  # Serialize Request
  request_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  event_subscription_update_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'eventSubscriptionName' => event_subscription_name},
      skip_encoding_path_params: {'scope' => scope},
      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 == 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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil) click to toggle source

Update an event subscription

Asynchronously updates an existing event subscription.

@param scope [String] The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created @param event_subscription_update_parameters

EventSubscriptionUpdateParameters

Updated event subscription information

@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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1749
def begin_update_with_http_info(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
  begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
end
create(scope, event_subscription_name, event_subscription_info, custom_headers:nil) click to toggle source

Create an event subscription

Asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot be updated with this API and should instead use the Update event subscription API.

@param scope [String] The scope of the resource to which the event subscription needs to be created. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created. Event subscription names must be between 3 and 64 characters in length and use alphanumeric letters only. @param event_subscription_info [EventSubscription] Event subscription properties containing the destination and filter information @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscription] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 179
def create(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
  response = create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil) click to toggle source

@param scope [String] The scope of the resource to which the event subscription needs to be created. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created. Event subscription names must be between 3 and 64 characters in length and use alphanumeric letters only. @param event_subscription_info [EventSubscription] Event subscription properties containing the destination and filter information @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 207
def create_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
  # Send request
  promise = begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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(scope, event_subscription_name, custom_headers:nil) click to toggle source

Delete an event subscription

Delete an existing event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 244
def delete(scope, event_subscription_name, custom_headers:nil)
  response = delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
  nil
end
delete_async(scope, event_subscription_name, custom_headers:nil) click to toggle source

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 267
def delete_async(scope, event_subscription_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(scope, event_subscription_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(scope, event_subscription_name, custom_headers:nil) click to toggle source

Get an event subscription

Get properties of an event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscription] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 45
def get(scope, event_subscription_name, custom_headers:nil)
  response = get_async(scope, event_subscription_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(scope, event_subscription_name, custom_headers:nil) click to toggle source

Get an event subscription

Get properties of an event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 96
def get_async(scope, event_subscription_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'event_subscription_name is nil' if event_subscription_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 = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'eventSubscriptionName' => event_subscription_name},
      skip_encoding_path_params: {'scope' => scope},
      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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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_full_url(scope, event_subscription_name, custom_headers:nil) click to toggle source

Get full URL of an event subscription

Get the full endpoint URL for an event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscriptionFullUrl] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 372
def get_full_url(scope, event_subscription_name, custom_headers:nil)
  response = get_full_url_async(scope, event_subscription_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_full_url_async(scope, event_subscription_name, custom_headers:nil) click to toggle source

Get full URL of an event subscription

Get the full endpoint URL for an event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 423
def get_full_url_async(scope, event_subscription_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'event_subscription_name is nil' if event_subscription_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 = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'eventSubscriptionName' => event_subscription_name},
      skip_encoding_path_params: {'scope' => scope},
      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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionFullUrl.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_full_url_with_http_info(scope, event_subscription_name, custom_headers:nil) click to toggle source

Get full URL of an event subscription

Get the full endpoint URL for an event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 398
def get_full_url_with_http_info(scope, event_subscription_name, custom_headers:nil)
  get_full_url_async(scope, event_subscription_name, custom_headers:custom_headers).value!
end
get_with_http_info(scope, event_subscription_name, custom_headers:nil) click to toggle source

Get an event subscription

Get properties of an event subscription

@param scope [String] The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 71
def get_with_http_info(scope, event_subscription_name, custom_headers:nil)
  get_async(scope, event_subscription_name, custom_headers:custom_headers).value!
end
list_by_resource(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil) click to toggle source

List all event subscriptions for a specific topic

List all event subscriptions that have been created for a specific topic

@param resource_group_name [String] The name of the resource group within the user's subscription. @param provider_namespace [String] Namespace of the provider of the topic @param resource_type_name [String] Name of the resource type @param resource_name [String] Name of the resource @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1328
def list_by_resource(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
  response = list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil) click to toggle source

List all event subscriptions for a specific topic

List all event subscriptions that have been created for a specific topic

@param resource_group_name [String] The name of the resource group within the user's subscription. @param provider_namespace [String] Namespace of the provider of the topic @param resource_type_name [String] Name of the resource type @param resource_name [String] Name of the resource @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1367
def list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_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, 'provider_namespace is nil' if provider_namespace.nil?
  fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_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/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'

  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,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil) click to toggle source

List all event subscriptions for a specific topic

List all event subscriptions that have been created for a specific topic

@param resource_group_name [String] The name of the resource group within the user's subscription. @param provider_namespace [String] Namespace of the provider of the topic @param resource_type_name [String] Name of the resource type @param resource_name [String] Name of the resource @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1348
def list_by_resource_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
  list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
end
list_global_by_resource_group(resource_group_name, custom_headers:nil) click to toggle source

List all global event subscriptions under an Azure subscription and resource group

List all global event subscriptions under a specific Azure subscription and resource group

@param resource_group_name [String] The name of the resource group within the user's subscription. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 689
def list_global_by_resource_group(resource_group_name, custom_headers:nil)
  response = list_global_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_global_by_resource_group_async(resource_group_name, custom_headers:nil) click to toggle source

List all global event subscriptions under an Azure subscription and resource group

List all global event subscriptions under a specific Azure subscription and resource group

@param resource_group_name [String] The name of the resource group within the user's 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 726
def list_global_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.EventGrid/eventSubscriptions'

  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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_global_by_resource_group_for_topic_type(resource_group_name, topic_type_name, custom_headers:nil) click to toggle source

List all global event subscriptions under a resource group for a topic type

List all global event subscriptions under a resource group for a specific topic type.

@param resource_group_name [String] The name of the resource group within the user's subscription. @param topic_type_name [String] Name of the topic type @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 794
def list_global_by_resource_group_for_topic_type(resource_group_name, topic_type_name, custom_headers:nil)
  response = list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:nil) click to toggle source

List all global event subscriptions under a resource group for a topic type

List all global event subscriptions under a resource group for a specific topic type.

@param resource_group_name [String] The name of the resource group within the user's subscription. @param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 831
def list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_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, 'topic_type_name is nil' if topic_type_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.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'

  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,'topicTypeName' => topic_type_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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_global_by_resource_group_for_topic_type_with_http_info(resource_group_name, topic_type_name, custom_headers:nil) click to toggle source

List all global event subscriptions under a resource group for a topic type

List all global event subscriptions under a resource group for a specific topic type.

@param resource_group_name [String] The name of the resource group within the user's subscription. @param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 813
def list_global_by_resource_group_for_topic_type_with_http_info(resource_group_name, topic_type_name, custom_headers:nil)
  list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:custom_headers).value!
end
list_global_by_resource_group_with_http_info(resource_group_name, custom_headers:nil) click to toggle source

List all global event subscriptions under an Azure subscription and resource group

List all global event subscriptions under a specific Azure subscription and resource group

@param resource_group_name [String] The name of the resource group within the user's 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 708
def list_global_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_global_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end
list_global_by_subscription(custom_headers:nil) click to toggle source

Get an aggregated list of all global event subscriptions under an Azure subscription

List all aggregated global event subscriptions under a specific Azure subscription

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

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 490
def list_global_by_subscription(custom_headers:nil)
  response = list_global_by_subscription_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_global_by_subscription_async(custom_headers:nil) click to toggle source

Get an aggregated list of all global event subscriptions under an Azure subscription

List all aggregated global event subscriptions under a specific Azure 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 523
def list_global_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.EventGrid/eventSubscriptions'

  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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_global_by_subscription_for_topic_type(topic_type_name, custom_headers:nil) click to toggle source

List all global event subscriptions for a topic type

List all global event subscriptions under an Azure subscription for a topic type.

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

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 588
def list_global_by_subscription_for_topic_type(topic_type_name, custom_headers:nil)
  response = list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:nil) click to toggle source

List all global event subscriptions for a topic type

List all global event subscriptions under an Azure subscription for a topic type.

@param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 621
def list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'topic_type_name is nil' if topic_type_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}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'topicTypeName' => topic_type_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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_global_by_subscription_for_topic_type_with_http_info(topic_type_name, custom_headers:nil) click to toggle source

List all global event subscriptions for a topic type

List all global event subscriptions under an Azure subscription for a topic type.

@param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 605
def list_global_by_subscription_for_topic_type_with_http_info(topic_type_name, custom_headers:nil)
  list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:custom_headers).value!
end
list_global_by_subscription_with_http_info(custom_headers:nil) click to toggle source

Get an aggregated list of all global event subscriptions under an Azure subscription

List all aggregated global event subscriptions under a specific Azure 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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 507
def list_global_by_subscription_with_http_info(custom_headers:nil)
  list_global_by_subscription_async(custom_headers:custom_headers).value!
end
list_regional_by_resource_group(resource_group_name, location, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription and resource group

List all event subscriptions from the given location under a specific Azure subscription and resource group

@param resource_group_name [String] The name of the resource group within the user's subscription. @param location [String] Name of the location @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1000
def list_regional_by_resource_group(resource_group_name, location, custom_headers:nil)
  response = list_regional_by_resource_group_async(resource_group_name, location, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_regional_by_resource_group_async(resource_group_name, location, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription and resource group

List all event subscriptions from the given location under a specific Azure subscription and resource group

@param resource_group_name [String] The name of the resource group within the user's subscription. @param location [String] Name of the location @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1039
def list_regional_by_resource_group_async(resource_group_name, location, 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, 'location is nil' if location.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.EventGrid/locations/{location}/eventSubscriptions'

  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,'location' => location},
      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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_regional_by_resource_group_for_topic_type(resource_group_name, location, topic_type_name, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription and resource group for a topic type

List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type

@param resource_group_name [String] The name of the resource group within the user's subscription. @param location [String] Name of the location @param topic_type_name [String] Name of the topic type @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1216
def list_regional_by_resource_group_for_topic_type(resource_group_name, location, topic_type_name, custom_headers:nil)
  response = list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription and resource group for a topic type

List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type

@param resource_group_name [String] The name of the resource group within the user's subscription. @param location [String] Name of the location @param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1257
def list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_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, 'location is nil' if location.nil?
  fail ArgumentError, 'topic_type_name is nil' if topic_type_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.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'

  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,'location' => location,'topicTypeName' => topic_type_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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_regional_by_resource_group_for_topic_type_with_http_info(resource_group_name, location, topic_type_name, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription and resource group for a topic type

List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type

@param resource_group_name [String] The name of the resource group within the user's subscription. @param location [String] Name of the location @param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1237
def list_regional_by_resource_group_for_topic_type_with_http_info(resource_group_name, location, topic_type_name, custom_headers:nil)
  list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:custom_headers).value!
end
list_regional_by_resource_group_with_http_info(resource_group_name, location, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription and resource group

List all event subscriptions from the given location under a specific Azure subscription and resource group

@param resource_group_name [String] The name of the resource group within the user's subscription. @param location [String] Name of the location @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1020
def list_regional_by_resource_group_with_http_info(resource_group_name, location, custom_headers:nil)
  list_regional_by_resource_group_async(resource_group_name, location, custom_headers:custom_headers).value!
end
list_regional_by_subscription(location, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription

List all event subscriptions from the given location under a specific Azure subscription

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

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 898
def list_regional_by_subscription(location, custom_headers:nil)
  response = list_regional_by_subscription_async(location, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_regional_by_subscription_async(location, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription

List all event subscriptions from the given location under a specific Azure subscription

@param location [String] Name of the location @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 931
def list_regional_by_subscription_async(location, 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?


  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.EventGrid/locations/{location}/eventSubscriptions'

  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},
      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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_regional_by_subscription_for_topic_type(location, topic_type_name, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription for a topic type

List all event subscriptions from the given location under a specific Azure subscription and topic type.

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

@return [EventSubscriptionsListResult] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1108
def list_regional_by_subscription_for_topic_type(location, topic_type_name, custom_headers:nil)
  response = list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription for a topic type

List all event subscriptions from the given location under a specific Azure subscription and topic type.

@param location [String] Name of the location @param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1145
def list_regional_by_subscription_for_topic_type_async(location, topic_type_name, 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, 'topic_type_name is nil' if topic_type_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}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'

  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,'topicTypeName' => topic_type_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 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::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscriptionsListResult.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_regional_by_subscription_for_topic_type_with_http_info(location, topic_type_name, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription for a topic type

List all event subscriptions from the given location under a specific Azure subscription and topic type.

@param location [String] Name of the location @param topic_type_name [String] Name of the topic type @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 1127
def list_regional_by_subscription_for_topic_type_with_http_info(location, topic_type_name, custom_headers:nil)
  list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:custom_headers).value!
end
list_regional_by_subscription_with_http_info(location, custom_headers:nil) click to toggle source

List all regional event subscriptions under an Azure subscription

List all event subscriptions from the given location under a specific Azure subscription

@param location [String] Name of the location @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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 915
def list_regional_by_subscription_with_http_info(location, custom_headers:nil)
  list_regional_by_subscription_async(location, custom_headers:custom_headers).value!
end
update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil) click to toggle source

Update an event subscription

Asynchronously updates an existing event subscription.

@param scope [String] The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created @param event_subscription_update_parameters

EventSubscriptionUpdateParameters

Updated event subscription information

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

@return [EventSubscription] operation results.

# File lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 307
def update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
  response = update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil) click to toggle source

@param scope [String] The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param event_subscription_name [String] Name of the event subscription to be created @param event_subscription_update_parameters

EventSubscriptionUpdateParameters

Updated event subscription information

@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-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb, line 333
def update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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