class Azure::GraphRbac::V1_6::Applications

The Graph RBAC Management Client

Attributes

client[R]

@return [GraphRbacClient] reference to the GraphRbacClient

Private Class Methods

new(client) click to toggle source

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

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

add_owner(application_object_id, parameters, custom_headers:nil) click to toggle source

Add an owner to an application.

@param application_object_id [String] The object ID of the application to which to add the owner. @param parameters [ApplicationAddOwnerParameters] The URL of the owner object, such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 577
def add_owner(application_object_id, parameters, custom_headers:nil)
  response = add_owner_async(application_object_id, parameters, custom_headers:custom_headers).value!
  nil
end
add_owner_async(application_object_id, parameters, custom_headers:nil) click to toggle source

Add an owner to an application.

@param application_object_id [String] The object ID of the application to which to add the owner. @param parameters [ApplicationAddOwnerParameters] The URL of the owner object, such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. @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/1.6/generated/azure_graph_rbac/applications.rb, line 612
def add_owner_async(application_object_id, parameters, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::GraphRbac::V1_6::Models::ApplicationAddOwnerParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/applications/{applicationObjectId}/$links/owners'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      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
add_owner_with_http_info(application_object_id, parameters, custom_headers:nil) click to toggle source

Add an owner to an application.

@param application_object_id [String] The object ID of the application to which to add the owner. @param parameters [ApplicationAddOwnerParameters] The URL of the owner object, such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. @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/1.6/generated/azure_graph_rbac/applications.rb, line 595
def add_owner_with_http_info(application_object_id, parameters, custom_headers:nil)
  add_owner_async(application_object_id, parameters, custom_headers:custom_headers).value!
end
create(parameters, custom_headers:nil) click to toggle source

Create a new application.

@param parameters [ApplicationCreateParameters] The parameters for creating an application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Application] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 34
def create(parameters, custom_headers:nil)
  response = create_async(parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_async(parameters, custom_headers:nil) click to toggle source

Create a new application.

@param parameters [ApplicationCreateParameters] The parameters for creating an application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 63
def create_async(parameters, custom_headers:nil)
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::GraphRbac::V1_6::Models::ApplicationCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/applications'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::GraphRbac::V1_6::Models::Application.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(parameters, custom_headers:nil) click to toggle source

Create a new application.

@param parameters [ApplicationCreateParameters] The parameters for creating an application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 49
def create_with_http_info(parameters, custom_headers:nil)
  create_async(parameters, custom_headers:custom_headers).value!
end
delete(application_object_id, custom_headers:nil) click to toggle source

Delete an application.

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

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 217
def delete(application_object_id, custom_headers:nil)
  response = delete_async(application_object_id, custom_headers:custom_headers).value!
  nil
end
delete_async(application_object_id, custom_headers:nil) click to toggle source

Delete an application.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 244
def delete_async(application_object_id, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/applications/{applicationObjectId}'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      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
delete_with_http_info(application_object_id, custom_headers:nil) click to toggle source

Delete an application.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 231
def delete_with_http_info(application_object_id, custom_headers:nil)
  delete_async(application_object_id, custom_headers:custom_headers).value!
end
get(application_object_id, custom_headers:nil) click to toggle source

Get an application by object ID.

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

@return [Application] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 295
def get(application_object_id, custom_headers:nil)
  response = get_async(application_object_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(application_object_id, custom_headers:nil) click to toggle source

Get an application by object ID.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 322
def get_async(application_object_id, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/applications/{applicationObjectId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_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::GraphRbac::V1_6::Models::Application.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_with_http_info(application_object_id, custom_headers:nil) click to toggle source

Get an application by object ID.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 309
def get_with_http_info(application_object_id, custom_headers:nil)
  get_async(application_object_id, custom_headers:custom_headers).value!
end
list(filter:nil, custom_headers:nil) click to toggle source

Lists applications by filter parameters.

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

@return [Array<Application>] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 131
def list(filter:nil, custom_headers:nil)
  first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end
list_as_lazy(filter:nil, custom_headers:nil) click to toggle source

Lists applications by filter parameters.

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

@return [ApplicationListResult] which provide lazy access to pages of the response.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 1119
def list_as_lazy(filter:nil, custom_headers:nil)
  response = list_async(filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_next_async(next_link, custom_headers:custom_headers)
    end
    page
  end
end
list_async(filter:nil, custom_headers:nil) click to toggle source

Lists applications by filter parameters.

@param filter [String] The filters to apply to the operation. @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/1.6/generated/azure_graph_rbac/applications.rb, line 158
def list_async(filter:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      query_params: {'$filter' => filter,'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::GraphRbac::V1_6::Models::ApplicationListResult.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_key_credentials(application_object_id, custom_headers:nil) click to toggle source

Get the keyCredentials associated with an application.

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

@return [KeyCredentialListResult] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 671
def list_key_credentials(application_object_id, custom_headers:nil)
  response = list_key_credentials_async(application_object_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_key_credentials_async(application_object_id, custom_headers:nil) click to toggle source

Get the keyCredentials associated with an application.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 698
def list_key_credentials_async(application_object_id, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/applications/{applicationObjectId}/keyCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_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::GraphRbac::V1_6::Models::KeyCredentialListResult.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_key_credentials_with_http_info(application_object_id, custom_headers:nil) click to toggle source

Get the keyCredentials associated with an application.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 685
def list_key_credentials_with_http_info(application_object_id, custom_headers:nil)
  list_key_credentials_async(application_object_id, custom_headers:custom_headers).value!
end
list_next(next_link, custom_headers:nil) click to toggle source

Gets a list of applications from the current tenant.

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

@return [Array<Application>] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 1029
def list_next(next_link, custom_headers:nil)
  response = list_next_async(next_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_next_async(next_link, custom_headers:nil) click to toggle source

Gets a list of applications from the current tenant.

@param next_link [String] Next link for the list operation. @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/1.6/generated/azure_graph_rbac/applications.rb, line 1056
def list_next_async(next_link, custom_headers:nil)
  fail ArgumentError, 'next_link is nil' if next_link.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'nextLink' => next_link},
      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::GraphRbac::V1_6::Models::ApplicationListResult.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_next_with_http_info(next_link, custom_headers:nil) click to toggle source

Gets a list of applications from the current tenant.

@param next_link [String] Next link for the list operation. @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/1.6/generated/azure_graph_rbac/applications.rb, line 1043
def list_next_with_http_info(next_link, custom_headers:nil)
  list_next_async(next_link, custom_headers:custom_headers).value!
end
list_owners(application_object_id, custom_headers:nil) click to toggle source

Directory objects that are owners of the application.

The owners are a set of non-admin users who are allowed to modify this object.

@param application_object_id [String] The object ID of the application for which to get owners. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [DirectoryObjectListResult] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 478
def list_owners(application_object_id, custom_headers:nil)
  response = list_owners_async(application_object_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_owners_async(application_object_id, custom_headers:nil) click to toggle source

Directory objects that are owners of the application.

The owners are a set of non-admin users who are allowed to modify this object.

@param application_object_id [String] The object ID of the application for which to get owners. @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/1.6/generated/azure_graph_rbac/applications.rb, line 513
def list_owners_async(application_object_id, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/applications/{applicationObjectId}/owners'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_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::GraphRbac::V1_6::Models::DirectoryObjectListResult.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_owners_with_http_info(application_object_id, custom_headers:nil) click to toggle source

Directory objects that are owners of the application.

The owners are a set of non-admin users who are allowed to modify this object.

@param application_object_id [String] The object ID of the application for which to get owners. @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/1.6/generated/azure_graph_rbac/applications.rb, line 496
def list_owners_with_http_info(application_object_id, custom_headers:nil)
  list_owners_async(application_object_id, custom_headers:custom_headers).value!
end
list_password_credentials(application_object_id, custom_headers:nil) click to toggle source

Get the passwordCredentials associated with an application.

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

@return [PasswordCredentialListResult] operation results.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 850
def list_password_credentials(application_object_id, custom_headers:nil)
  response = list_password_credentials_async(application_object_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_password_credentials_async(application_object_id, custom_headers:nil) click to toggle source

Get the passwordCredentials associated with an application.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 877
def list_password_credentials_async(application_object_id, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/applications/{applicationObjectId}/passwordCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_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::GraphRbac::V1_6::Models::PasswordCredentialListResult.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_password_credentials_with_http_info(application_object_id, custom_headers:nil) click to toggle source

Get the passwordCredentials associated with an application.

@param application_object_id [String] Application object ID. @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/1.6/generated/azure_graph_rbac/applications.rb, line 864
def list_password_credentials_with_http_info(application_object_id, custom_headers:nil)
  list_password_credentials_async(application_object_id, custom_headers:custom_headers).value!
end
list_with_http_info(filter:nil, custom_headers:nil) click to toggle source

Lists applications by filter parameters.

@param filter [String] The filters to apply to the operation. @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/1.6/generated/azure_graph_rbac/applications.rb, line 145
def list_with_http_info(filter:nil, custom_headers:nil)
  list_async(filter:filter, custom_headers:custom_headers).value!
end
patch(application_object_id, parameters, custom_headers:nil) click to toggle source

Update an existing application.

@param application_object_id [String] Application object ID. @param parameters [ApplicationUpdateParameters] Parameters to update an existing application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 384
def patch(application_object_id, parameters, custom_headers:nil)
  response = patch_async(application_object_id, parameters, custom_headers:custom_headers).value!
  nil
end
patch_async(application_object_id, parameters, custom_headers:nil) click to toggle source

Update an existing application.

@param application_object_id [String] Application object ID. @param parameters [ApplicationUpdateParameters] Parameters to update an existing application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 415
def patch_async(application_object_id, parameters, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::GraphRbac::V1_6::Models::ApplicationUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/applications/{applicationObjectId}'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      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
patch_with_http_info(application_object_id, parameters, custom_headers:nil) click to toggle source

Update an existing application.

@param application_object_id [String] Application object ID. @param parameters [ApplicationUpdateParameters] Parameters to update an existing application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 400
def patch_with_http_info(application_object_id, parameters, custom_headers:nil)
  patch_async(application_object_id, parameters, custom_headers:custom_headers).value!
end
update_key_credentials(application_object_id, parameters, custom_headers:nil) click to toggle source

Update the keyCredentials associated with an application.

@param application_object_id [String] Application object ID. @param parameters [KeyCredentialsUpdateParameters] Parameters to update the keyCredentials of an existing application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 760
def update_key_credentials(application_object_id, parameters, custom_headers:nil)
  response = update_key_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
  nil
end
update_key_credentials_async(application_object_id, parameters, custom_headers:nil) click to toggle source

Update the keyCredentials associated with an application.

@param application_object_id [String] Application object ID. @param parameters [KeyCredentialsUpdateParameters] Parameters to update the keyCredentials of an existing application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 791
def update_key_credentials_async(application_object_id, parameters, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::GraphRbac::V1_6::Models::KeyCredentialsUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/applications/{applicationObjectId}/keyCredentials'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      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
update_key_credentials_with_http_info(application_object_id, parameters, custom_headers:nil) click to toggle source

Update the keyCredentials associated with an application.

@param application_object_id [String] Application object ID. @param parameters [KeyCredentialsUpdateParameters] Parameters to update the keyCredentials of an existing application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 776
def update_key_credentials_with_http_info(application_object_id, parameters, custom_headers:nil)
  update_key_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
end
update_password_credentials(application_object_id, parameters, custom_headers:nil) click to toggle source

Update passwordCredentials associated with an application.

@param application_object_id [String] Application object ID. @param parameters [PasswordCredentialsUpdateParameters] Parameters to update passwordCredentials of an existing application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/1.6/generated/azure_graph_rbac/applications.rb, line 939
def update_password_credentials(application_object_id, parameters, custom_headers:nil)
  response = update_password_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
  nil
end
update_password_credentials_async(application_object_id, parameters, custom_headers:nil) click to toggle source

Update passwordCredentials associated with an application.

@param application_object_id [String] Application object ID. @param parameters [PasswordCredentialsUpdateParameters] Parameters to update passwordCredentials of an existing application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 970
def update_password_credentials_async(application_object_id, parameters, custom_headers:nil)
  fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::GraphRbac::V1_6::Models::PasswordCredentialsUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/applications/{applicationObjectId}/passwordCredentials'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      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
update_password_credentials_with_http_info(application_object_id, parameters, custom_headers:nil) click to toggle source

Update passwordCredentials associated with an application.

@param application_object_id [String] Application object ID. @param parameters [PasswordCredentialsUpdateParameters] Parameters to update passwordCredentials of an existing application. @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/1.6/generated/azure_graph_rbac/applications.rb, line 955
def update_password_credentials_with_http_info(application_object_id, parameters, custom_headers:nil)
  update_password_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
end