forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kv Keys update
- Loading branch information
Showing
21 changed files
with
1,282 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
...-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SecretKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
|
||
class SecretKey { | ||
|
||
/* | ||
* The value of the secret. | ||
*/ | ||
@JsonProperty(value = "value") | ||
private String value; | ||
|
||
/* | ||
* The secret properties. | ||
*/ | ||
private SecretProperties properties; | ||
|
||
/* | ||
* Creates an empty instance of the Secret. | ||
*/ | ||
SecretKey() { | ||
properties = new SecretProperties(); | ||
} | ||
|
||
/* | ||
* Creates a Secret with {@code name} and {@code value}. | ||
* | ||
* @param name The name of the secret. | ||
* @param value the value of the secret. | ||
*/ | ||
SecretKey(String name, String value) { | ||
properties = new SecretProperties(name); | ||
this.value = value; | ||
} | ||
|
||
/* | ||
* Get the value of the secret. | ||
* | ||
* @return the secret value | ||
*/ | ||
String getValue() { | ||
return this.value; | ||
} | ||
|
||
/* | ||
* Get the secret identifier. | ||
* | ||
* @return the secret identifier. | ||
*/ | ||
String getId() { | ||
return properties.getId(); | ||
} | ||
|
||
/* | ||
* Get the secret name. | ||
* | ||
* @return the secret name. | ||
*/ | ||
String getName() { | ||
return properties.getName(); | ||
} | ||
|
||
/* | ||
* Get the secret properties | ||
* @return the Secret properties | ||
*/ | ||
SecretProperties getProperties() { | ||
return this.properties; | ||
} | ||
|
||
/* | ||
* Set the secret properties | ||
* @param properties The Secret properties | ||
* @throws NullPointerException if {@code properties} is null. | ||
* @return the updated secret key object | ||
*/ | ||
SecretKey setProperties(SecretProperties properties) { | ||
Objects.requireNonNull(properties); | ||
properties.name = this.properties.name; | ||
this.properties = properties; | ||
return this; | ||
} | ||
|
||
@JsonProperty(value = "id") | ||
private void unpackId(String id) { | ||
properties.unpackId(id); | ||
} | ||
|
||
/* | ||
* Unpacks the attributes json response and updates the variables in the Secret Attributes object. | ||
* Uses Lazy Update to set values for variables id, tags, contentType, managed and keyId as these variables are | ||
* part of main json body and not attributes json body when the secret response comes from list Secrets operations. | ||
* @param attributes The key value mapping of the Secret attributes | ||
*/ | ||
@JsonProperty("attributes") | ||
@SuppressWarnings("unchecked") | ||
private void unpackAttributes(Map<String, Object> attributes) { | ||
properties.unpackAttributes(attributes); | ||
} | ||
|
||
@JsonProperty("managed") | ||
private void unpackManaged(Boolean managed) { | ||
properties.managed = managed; | ||
} | ||
|
||
@JsonProperty("kid") | ||
private void unpackKid(String kid) { | ||
properties.keyId = kid; | ||
} | ||
|
||
@JsonProperty("contentType") | ||
private void unpackContentType(String contentType) { | ||
properties.contentType = contentType; | ||
} | ||
|
||
@JsonProperty("tags") | ||
private void unpackTags(Map<String, String> tags) { | ||
properties.tags = tags; | ||
} | ||
} | ||
|
Oops, something went wrong.