
com.azure.resourcemanager.orbital.models.AuthorizedGroundstation 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.orbital.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;
import java.time.LocalDate;
import java.util.Objects;
/**
* Authorized groundstation.
*/
@Fluent
public final class AuthorizedGroundstation implements JsonSerializable {
/*
* Groundstation name.
*/
private String groundStation;
/*
* Date of authorization expiration.
*/
private LocalDate expirationDate;
/**
* Creates an instance of AuthorizedGroundstation class.
*/
public AuthorizedGroundstation() {
}
/**
* Get the groundStation property: Groundstation name.
*
* @return the groundStation value.
*/
public String groundStation() {
return this.groundStation;
}
/**
* Set the groundStation property: Groundstation name.
*
* @param groundStation the groundStation value to set.
* @return the AuthorizedGroundstation object itself.
*/
public AuthorizedGroundstation withGroundStation(String groundStation) {
this.groundStation = groundStation;
return this;
}
/**
* Get the expirationDate property: Date of authorization expiration.
*
* @return the expirationDate value.
*/
public LocalDate expirationDate() {
return this.expirationDate;
}
/**
* Set the expirationDate property: Date of authorization expiration.
*
* @param expirationDate the expirationDate value to set.
* @return the AuthorizedGroundstation object itself.
*/
public AuthorizedGroundstation withExpirationDate(LocalDate expirationDate) {
this.expirationDate = expirationDate;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (groundStation() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property groundStation in model AuthorizedGroundstation"));
}
if (expirationDate() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property expirationDate in model AuthorizedGroundstation"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(AuthorizedGroundstation.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("groundStation", this.groundStation);
jsonWriter.writeStringField("expirationDate", Objects.toString(this.expirationDate, null));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AuthorizedGroundstation from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AuthorizedGroundstation 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 AuthorizedGroundstation.
*/
public static AuthorizedGroundstation fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AuthorizedGroundstation deserializedAuthorizedGroundstation = new AuthorizedGroundstation();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("groundStation".equals(fieldName)) {
deserializedAuthorizedGroundstation.groundStation = reader.getString();
} else if ("expirationDate".equals(fieldName)) {
deserializedAuthorizedGroundstation.expirationDate
= reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedAuthorizedGroundstation;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy