
com.azure.resourcemanager.deviceupdate.models.DiagnosticStorageProperties 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.deviceupdate.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Customer-initiated diagnostic log collection storage properties.
*/
@Fluent
public final class DiagnosticStorageProperties implements JsonSerializable {
/*
* Authentication Type
*/
private AuthenticationType authenticationType;
/*
* ConnectionString of the diagnostic storage account
*/
private String connectionString;
/*
* ResourceId of the diagnostic storage account
*/
private String resourceId;
/**
* Creates an instance of DiagnosticStorageProperties class.
*/
public DiagnosticStorageProperties() {
}
/**
* Get the authenticationType property: Authentication Type.
*
* @return the authenticationType value.
*/
public AuthenticationType authenticationType() {
return this.authenticationType;
}
/**
* Set the authenticationType property: Authentication Type.
*
* @param authenticationType the authenticationType value to set.
* @return the DiagnosticStorageProperties object itself.
*/
public DiagnosticStorageProperties withAuthenticationType(AuthenticationType authenticationType) {
this.authenticationType = authenticationType;
return this;
}
/**
* Get the connectionString property: ConnectionString of the diagnostic storage account.
*
* @return the connectionString value.
*/
public String connectionString() {
return this.connectionString;
}
/**
* Set the connectionString property: ConnectionString of the diagnostic storage account.
*
* @param connectionString the connectionString value to set.
* @return the DiagnosticStorageProperties object itself.
*/
public DiagnosticStorageProperties withConnectionString(String connectionString) {
this.connectionString = connectionString;
return this;
}
/**
* Get the resourceId property: ResourceId of the diagnostic storage account.
*
* @return the resourceId value.
*/
public String resourceId() {
return this.resourceId;
}
/**
* Set the resourceId property: ResourceId of the diagnostic storage account.
*
* @param resourceId the resourceId value to set.
* @return the DiagnosticStorageProperties object itself.
*/
public DiagnosticStorageProperties withResourceId(String resourceId) {
this.resourceId = resourceId;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (authenticationType() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property authenticationType in model DiagnosticStorageProperties"));
}
if (resourceId() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property resourceId in model DiagnosticStorageProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DiagnosticStorageProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("authenticationType",
this.authenticationType == null ? null : this.authenticationType.toString());
jsonWriter.writeStringField("resourceId", this.resourceId);
jsonWriter.writeStringField("connectionString", this.connectionString);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DiagnosticStorageProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DiagnosticStorageProperties if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the DiagnosticStorageProperties.
*/
public static DiagnosticStorageProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DiagnosticStorageProperties deserializedDiagnosticStorageProperties = new DiagnosticStorageProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("authenticationType".equals(fieldName)) {
deserializedDiagnosticStorageProperties.authenticationType
= AuthenticationType.fromString(reader.getString());
} else if ("resourceId".equals(fieldName)) {
deserializedDiagnosticStorageProperties.resourceId = reader.getString();
} else if ("connectionString".equals(fieldName)) {
deserializedDiagnosticStorageProperties.connectionString = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedDiagnosticStorageProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy