com.microsoft.azure.keyvault.models.custom.SecretBundle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-keyvault Show documentation
Show all versions of azure-keyvault Show documentation
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.
// 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);
}
}
}