Class: Azure::Armrest::KeyVaultService

Inherits:
ResourceGroupBasedService show all
Defined in:
lib/azure/armrest/key_vault_service.rb

Overview

Base class for managing key vaults.

Constant Summary

Constants inherited from ResourceGroupBasedService

ResourceGroupBasedService::SERVICE_NAME_MAP

Instance Attribute Summary

Attributes inherited from ArmrestService

#api_version, #armrest_configuration, #base_url, #provider, #service_name

Instance Method Summary collapse

Methods inherited from ResourceGroupBasedService

#create, #delete, #delete_by_id, #get, #get_by_id, #list, #list_all

Methods inherited from ArmrestService

configure, #get_provider, #get_subscription, #list_locations, #list_resource_groups, #list_resources, #list_subscriptions, #locations, #poll, #tags, #tenants, #wait

Constructor Details

#initialize(configuration, options = {}) ⇒ KeyVaultService

Create and return a new KeyVaultService instance.



9
10
11
# File 'lib/azure/armrest/key_vault_service.rb', line 9

def initialize(configuration, options = {})
  super(configuration, 'vaults', 'Microsoft.KeyVault', options)
end

Instance Method Details

#get_deleted(vault_name, location) ⇒ Object

Gets the deleted Azure key vault.



34
35
36
37
38
39
# File 'lib/azure/armrest/key_vault_service.rb', line 34

def get_deleted(vault_name, location)
  url = File.join(base_url, 'providers', provider, 'locations', location, 'deletedVaults', vault_name)
  url << "?api-version=#{api_version}"
  response = rest_get(url)
  get_all_results(response)
end

#get_secret(secret_name, vault_name, resource_group = configuration.resource_group) ⇒ Object

Get information for the specified secret_name in vault_name within the given resource_group.



16
17
18
19
# File 'lib/azure/armrest/key_vault_service.rb', line 16

def get_secret(secret_name, vault_name, resource_group = configuration.resource_group)
  url = build_url(resource_group, vault_name, 'secrets', secret_name)
  model_class.new(rest_get(url))
end

#list_deletedObject

Gets information about the deleted vaults in a subscription.



43
44
45
46
47
# File 'lib/azure/armrest/key_vault_service.rb', line 43

def list_deleted
  url = File.join(base_url, 'providers', provider, 'deletedVaults') + "?api-version=#{api_version}"
  response = rest_get(url)
  get_all_results(response)
end

#list_secrets(vault_name, resource_group = configuration.resource_group, options = {}) ⇒ Object

Get a list secrets for the given vault_name within resource_group. You may optionally specify the maxresults, which defaults to 25.



24
25
26
27
28
29
30
# File 'lib/azure/armrest/key_vault_service.rb', line 24

def list_secrets(vault_name, resource_group = configuration.resource_group, options = {})
  url = build_url(resource_group, vault_name, 'secrets')
  url << "&maxresults=#{options[:maxresults]}" if options[:maxresults]

  response = rest_get(url)
  get_all_results(response)
end

#purge_deleted(vault_name, location) ⇒ Object

Permanently removes the deleted vault_name at location.



51
52
53
54
55
56
# File 'lib/azure/armrest/key_vault_service.rb', line 51

def purge_deleted(vault_name, location)
  url = File.join(base_url, 'providers', provider, 'locations', location, 'deletedVaults', vault_name, 'purge')
  url << "?api-version=#{api_version}"
  response = rest_post(url)
  get_all_results(response)
end