com.azure.resourcemanager.databoxedge.models.SymmetricKey Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.databoxedge.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Symmetric key for authentication.
*/
@Fluent
public final class SymmetricKey implements JsonSerializable {
/*
* Connection string based on the symmetric key.
*/
private AsymmetricEncryptedSecret connectionString;
/**
* Creates an instance of SymmetricKey class.
*/
public SymmetricKey() {
}
/**
* Get the connectionString property: Connection string based on the symmetric key.
*
* @return the connectionString value.
*/
public AsymmetricEncryptedSecret connectionString() {
return this.connectionString;
}
/**
* Set the connectionString property: Connection string based on the symmetric key.
*
* @param connectionString the connectionString value to set.
* @return the SymmetricKey object itself.
*/
public SymmetricKey withConnectionString(AsymmetricEncryptedSecret connectionString) {
this.connectionString = connectionString;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (connectionString() != null) {
connectionString().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("connectionString", this.connectionString);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SymmetricKey from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SymmetricKey if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the SymmetricKey.
*/
public static SymmetricKey fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SymmetricKey deserializedSymmetricKey = new SymmetricKey();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("connectionString".equals(fieldName)) {
deserializedSymmetricKey.connectionString = AsymmetricEncryptedSecret.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedSymmetricKey;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy