com.azure.resourcemanager.automation.fluent.models.ConnectionProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.automation.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.automation.models.ConnectionTypeAssociationProperty;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.Map;
/**
* Definition of the connection properties.
*/
@Fluent
public final class ConnectionProperties implements JsonSerializable {
/*
* Gets or sets the connectionType of the connection.
*/
private ConnectionTypeAssociationProperty connectionType;
/*
* Gets the field definition values of the connection.
*/
private Map fieldDefinitionValues;
/*
* Gets the creation time.
*/
private OffsetDateTime creationTime;
/*
* Gets the last modified time.
*/
private OffsetDateTime lastModifiedTime;
/*
* Gets or sets the description.
*/
private String description;
/**
* Creates an instance of ConnectionProperties class.
*/
public ConnectionProperties() {
}
/**
* Get the connectionType property: Gets or sets the connectionType of the connection.
*
* @return the connectionType value.
*/
public ConnectionTypeAssociationProperty connectionType() {
return this.connectionType;
}
/**
* Set the connectionType property: Gets or sets the connectionType of the connection.
*
* @param connectionType the connectionType value to set.
* @return the ConnectionProperties object itself.
*/
public ConnectionProperties withConnectionType(ConnectionTypeAssociationProperty connectionType) {
this.connectionType = connectionType;
return this;
}
/**
* Get the fieldDefinitionValues property: Gets the field definition values of the connection.
*
* @return the fieldDefinitionValues value.
*/
public Map fieldDefinitionValues() {
return this.fieldDefinitionValues;
}
/**
* Get the creationTime property: Gets the creation time.
*
* @return the creationTime value.
*/
public OffsetDateTime creationTime() {
return this.creationTime;
}
/**
* Get the lastModifiedTime property: Gets the last modified time.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.lastModifiedTime;
}
/**
* Get the description property: Gets or sets the description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: Gets or sets the description.
*
* @param description the description value to set.
* @return the ConnectionProperties object itself.
*/
public ConnectionProperties withDescription(String description) {
this.description = description;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (connectionType() != null) {
connectionType().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("connectionType", this.connectionType);
jsonWriter.writeStringField("description", this.description);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ConnectionProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ConnectionProperties 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 ConnectionProperties.
*/
public static ConnectionProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ConnectionProperties deserializedConnectionProperties = new ConnectionProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("connectionType".equals(fieldName)) {
deserializedConnectionProperties.connectionType
= ConnectionTypeAssociationProperty.fromJson(reader);
} else if ("fieldDefinitionValues".equals(fieldName)) {
Map fieldDefinitionValues = reader.readMap(reader1 -> reader1.getString());
deserializedConnectionProperties.fieldDefinitionValues = fieldDefinitionValues;
} else if ("creationTime".equals(fieldName)) {
deserializedConnectionProperties.creationTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedTime".equals(fieldName)) {
deserializedConnectionProperties.lastModifiedTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("description".equals(fieldName)) {
deserializedConnectionProperties.description = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedConnectionProperties;
});
}
}