class Azure::ServiceFabric::V6_4_0_36::MeshSecretValue

Service Fabric REST Client APIs allows management of Service Fabric clusters, applications and services.

Attributes

client[R]

@return [ServiceFabricClientAPIs] reference to the ServiceFabricClientAPIs

Public Class Methods

new(client) click to toggle source

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

# File lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 18
def initialize(client)
  @client = client
end

Public Instance Methods

add_value(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:nil) click to toggle source

Adds the specified value as a new version of the specified secret resource.

Creates a new value of the specified secret resource. The name of the value is typically the version identifier. Once created the value cannot be changed.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @param secret_value_resource_description [SecretValueResourceDescription] Description for creating a value of a secret resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SecretValueResourceDescription] operation results.

# File lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 42
def add_value(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:nil)
  response = add_value_async(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
add_value_async(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:nil) click to toggle source

Adds the specified value as a new version of the specified secret resource.

Creates a new value of the specified secret resource. The name of the value is typically the version identifier. Once created the value cannot be changed.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @param secret_value_resource_description [SecretValueResourceDescription] Description for creating a value of a secret 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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 85
def add_value_async(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'secret_resource_name is nil' if secret_resource_name.nil?
  fail ArgumentError, 'secret_value_resource_name is nil' if secret_value_resource_name.nil?
  fail ArgumentError, 'secret_value_resource_description is nil' if secret_value_resource_description.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::ServiceFabric::V6_4_0_36::Models::SecretValueResourceDescription.mapper()
  request_content = @client.serialize(request_mapper,  secret_value_resource_description)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'Resources/Secrets/{secretResourceName}/values/{secretValueResourceName}'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.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::ServiceFabric::V6_4_0_36::Models::SecretValueResourceDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::V6_4_0_36::Models::SecretValueResourceDescription.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
add_value_with_http_info(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:nil) click to toggle source

Adds the specified value as a new version of the specified secret resource.

Creates a new value of the specified secret resource. The name of the value is typically the version identifier. Once created the value cannot be changed.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @param secret_value_resource_description [SecretValueResourceDescription] Description for creating a value of a secret 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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 64
def add_value_with_http_info(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:nil)
  add_value_async(secret_resource_name, secret_value_resource_name, secret_value_resource_description, custom_headers:custom_headers).value!
end
delete(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Deletes the specified value of the named secret resource.

Deletes the secret value resource identified by the name. The name of the resource is typically the version associated with that value. Deletion will fail if the specified value is in use.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 276
def delete(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  response = delete_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
  nil
end
delete_async(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Deletes the specified value of the named secret resource.

Deletes the secret value resource identified by the name. The name of the resource is typically the version associated with that value. Deletion will fail if the specified value is in use.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 315
def delete_async(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'secret_resource_name is nil' if secret_resource_name.nil?
  fail ArgumentError, 'secret_value_resource_name is nil' if secret_value_resource_name.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 = 'Resources/Secrets/{secretResourceName}/values/{secretValueResourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'secretResourceName' => secret_resource_name,'secretValueResourceName' => secret_value_resource_name},
      query_params: {'api-version' => 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 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.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
delete_with_http_info(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Deletes the specified value of the named secret resource.

Deletes the secret value resource identified by the name. The name of the resource is typically the version associated with that value. Deletion will fail if the specified value is in use.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 296
def delete_with_http_info(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  delete_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
end
get(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Gets the specified secret value resource.

Get the information about the specified named secret value resources. The information does not include the actual value of the secret.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SecretValueResourceDescription] operation results.

# File lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 171
def get(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  response = get_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Gets the specified secret value resource.

Get the information about the specified named secret value resources. The information does not include the actual value of the secret.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 208
def get_async(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'secret_resource_name is nil' if secret_resource_name.nil?
  fail ArgumentError, 'secret_value_resource_name is nil' if secret_value_resource_name.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 = 'Resources/Secrets/{secretResourceName}/values/{secretValueResourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'secretResourceName' => secret_resource_name,'secretValueResourceName' => secret_value_resource_name},
      query_params: {'api-version' => 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?
    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::ServiceFabric::V6_4_0_36::Models::SecretValueResourceDescription.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(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Gets the specified secret value resource.

Get the information about the specified named secret value resources. The information does not include the actual value of the secret.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 190
def get_with_http_info(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  get_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
end
list(secret_resource_name, custom_headers:nil) click to toggle source

List names of all values of the specified secret resource.

Gets information about all secret value resources of the specified secret resource. The information includes the names of the secret value resources, but not the actual values.

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

@return [PagedSecretValueResourceDescriptionList] operation results.

# File lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 372
def list(secret_resource_name, custom_headers:nil)
  response = list_async(secret_resource_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_async(secret_resource_name, custom_headers:nil) click to toggle source

List names of all values of the specified secret resource.

Gets information about all secret value resources of the specified secret resource. The information includes the names of the secret value resources, but not the actual values.

@param secret_resource_name [String] The name of the secret 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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 407
def list_async(secret_resource_name, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'secret_resource_name is nil' if secret_resource_name.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 = 'Resources/Secrets/{secretResourceName}/values'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'secretResourceName' => secret_resource_name},
      query_params: {'api-version' => 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?
    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::ServiceFabric::V6_4_0_36::Models::PagedSecretValueResourceDescriptionList.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_with_http_info(secret_resource_name, custom_headers:nil) click to toggle source

List names of all values of the specified secret resource.

Gets information about all secret value resources of the specified secret resource. The information includes the names of the secret value resources, but not the actual values.

@param secret_resource_name [String] The name of the secret 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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 390
def list_with_http_info(secret_resource_name, custom_headers:nil)
  list_async(secret_resource_name, custom_headers:custom_headers).value!
end
show(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Lists the specified value of the secret resource.

Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SecretValue] operation results.

# File lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 474
def show(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  response = show_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
show_async(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Lists the specified value of the secret resource.

Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 511
def show_async(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'secret_resource_name is nil' if secret_resource_name.nil?
  fail ArgumentError, 'secret_value_resource_name is nil' if secret_value_resource_name.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 = 'Resources/Secrets/{secretResourceName}/values/{secretValueResourceName}/list_value'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'secretResourceName' => secret_resource_name,'secretValueResourceName' => secret_value_resource_name},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::ServiceFabric::V6_4_0_36::Models::SecretValue.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
show_with_http_info(secret_resource_name, secret_value_resource_name, custom_headers:nil) click to toggle source

Lists the specified value of the secret resource.

Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation.

@param secret_resource_name [String] The name of the secret resource. @param secret_value_resource_name [String] The name of the secret resource value which is typically the version identifier for the value. @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/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb, line 493
def show_with_http_info(secret_resource_name, secret_value_resource_name, custom_headers:nil)
  show_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
end