All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.keyvault.models.custom.SecretBundle Maven / Gradle / Ivy

Go to download

This library has been replaced by new Azure SDKs, you can read about them at https://aka.ms/azsdkvalueprop. The latest libraries to interact with the Azure Key Vault service are: (1) https://search.maven.org/artifact/com.azure/azure-security-keyvault-keys. (2) https://search.maven.org/artifact/com.azure/azure-security-keyvault-secrets. (3) https://search.maven.org/artifact/com.azure/azure-security-keyvault-certificates. It is recommended that you move to the new package.

There is a newer version: 1.2.6
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.microsoft.azure.keyvault.models.custom;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.microsoft.azure.keyvault.SecretIdentifier;

import java.io.IOException;

/**
 * A secret consisting of a value, id and its attributes.
 */
public class SecretBundle {


    /**
     * The secret id.
     */
    @JsonProperty(value = "id")
    private String id;


    /**
     * Get the id value.
     *
     * @return the id value
     */
    public String id() {
        return this.id;
    }

    /**
     * the secret identifier.
     * @return The Identifier value
     */
    public SecretIdentifier secretIdentifier() {
        if (id() == null || id().length() == 0) {
            return null;
        }
        return new SecretIdentifier(id());
    }

    @Override
    public String toString() {
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(this);
        } catch (JsonGenerationException e) {
            throw new IllegalStateException(e);
        } catch (JsonMappingException e) {
            throw new IllegalStateException(e);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy