Search in sources :

Example 1 with AccessPolicy

use of com.microsoft.azure.management.keyvault.AccessPolicy in project azure-sdk-for-java by Azure.

the class Utils method print.

/**
     * Print a key vault.
     * @param vault the key vault resource
     */
public static void print(Vault vault) {
    StringBuilder info = new StringBuilder().append("Key Vault: ").append(vault.id()).append("Name: ").append(vault.name()).append("\n\tResource group: ").append(vault.resourceGroupName()).append("\n\tRegion: ").append(vault.region()).append("\n\tSku: ").append(vault.sku().name()).append(" - ").append(vault.sku().family()).append("\n\tVault URI: ").append(vault.vaultUri()).append("\n\tAccess policies: ");
    for (AccessPolicy accessPolicy : vault.accessPolicies()) {
        info.append("\n\t\tIdentity:").append(accessPolicy.objectId()).append("\n\t\tKey permissions: ").append(Joiner.on(", ").join(accessPolicy.permissions().keys())).append("\n\t\tSecret permissions: ").append(Joiner.on(", ").join(accessPolicy.permissions().secrets()));
    }
    System.out.println(info.toString());
}
Also used : AccessPolicy(com.microsoft.azure.management.keyvault.AccessPolicy)

Example 2 with AccessPolicy

use of com.microsoft.azure.management.keyvault.AccessPolicy in project azure-sdk-for-java by Azure.

the class VaultImpl method createResourceAsync.

@Override
public Observable<Vault> createResourceAsync() {
    final VaultsInner client = this.manager().inner().vaults();
    return populateAccessPolicies().flatMap(new Func1<Object, Observable<VaultInner>>() {

        @Override
        public Observable<VaultInner> call(Object o) {
            VaultCreateOrUpdateParametersInner parameters = new VaultCreateOrUpdateParametersInner();
            parameters.withLocation(regionName());
            parameters.withProperties(inner().properties());
            parameters.withTags(inner().getTags());
            parameters.properties().withAccessPolicies(new ArrayList<AccessPolicyEntry>());
            for (AccessPolicy accessPolicy : accessPolicies) {
                parameters.properties().accessPolicies().add(accessPolicy.inner());
            }
            return client.createOrUpdateAsync(resourceGroupName(), name(), parameters);
        }
    }).map(innerToFluentMap(this));
}
Also used : AccessPolicyEntry(com.microsoft.azure.management.keyvault.AccessPolicyEntry) Func1(rx.functions.Func1) AccessPolicy(com.microsoft.azure.management.keyvault.AccessPolicy)

Aggregations

AccessPolicy (com.microsoft.azure.management.keyvault.AccessPolicy)2 AccessPolicyEntry (com.microsoft.azure.management.keyvault.AccessPolicyEntry)1 Func1 (rx.functions.Func1)1