
com.azure.resourcemanager.orbital.models.SpacecraftLink 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.util.List;
/**
* List of authorized spacecraft links per ground station and the expiration date of the authorization.
*/
@Fluent
public final class SpacecraftLink implements JsonSerializable {
/*
* Link name.
*/
private String name;
/*
* Center Frequency in MHz.
*/
private float centerFrequencyMHz;
/*
* Bandwidth in MHz.
*/
private float bandwidthMHz;
/*
* Direction (Uplink or Downlink).
*/
private Direction direction;
/*
* Polarization. e.g. (RHCP, LHCP).
*/
private Polarization polarization;
/*
* Authorized Ground Stations
*/
private List authorizations;
/**
* Creates an instance of SpacecraftLink class.
*/
public SpacecraftLink() {
}
/**
* Get the name property: Link name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Link name.
*
* @param name the name value to set.
* @return the SpacecraftLink object itself.
*/
public SpacecraftLink withName(String name) {
this.name = name;
return this;
}
/**
* Get the centerFrequencyMHz property: Center Frequency in MHz.
*
* @return the centerFrequencyMHz value.
*/
public float centerFrequencyMHz() {
return this.centerFrequencyMHz;
}
/**
* Set the centerFrequencyMHz property: Center Frequency in MHz.
*
* @param centerFrequencyMHz the centerFrequencyMHz value to set.
* @return the SpacecraftLink object itself.
*/
public SpacecraftLink withCenterFrequencyMHz(float centerFrequencyMHz) {
this.centerFrequencyMHz = centerFrequencyMHz;
return this;
}
/**
* Get the bandwidthMHz property: Bandwidth in MHz.
*
* @return the bandwidthMHz value.
*/
public float bandwidthMHz() {
return this.bandwidthMHz;
}
/**
* Set the bandwidthMHz property: Bandwidth in MHz.
*
* @param bandwidthMHz the bandwidthMHz value to set.
* @return the SpacecraftLink object itself.
*/
public SpacecraftLink withBandwidthMHz(float bandwidthMHz) {
this.bandwidthMHz = bandwidthMHz;
return this;
}
/**
* Get the direction property: Direction (Uplink or Downlink).
*
* @return the direction value.
*/
public Direction direction() {
return this.direction;
}
/**
* Set the direction property: Direction (Uplink or Downlink).
*
* @param direction the direction value to set.
* @return the SpacecraftLink object itself.
*/
public SpacecraftLink withDirection(Direction direction) {
this.direction = direction;
return this;
}
/**
* Get the polarization property: Polarization. e.g. (RHCP, LHCP).
*
* @return the polarization value.
*/
public Polarization polarization() {
return this.polarization;
}
/**
* Set the polarization property: Polarization. e.g. (RHCP, LHCP).
*
* @param polarization the polarization value to set.
* @return the SpacecraftLink object itself.
*/
public SpacecraftLink withPolarization(Polarization polarization) {
this.polarization = polarization;
return this;
}
/**
* Get the authorizations property: Authorized Ground Stations.
*
* @return the authorizations value.
*/
public List authorizations() {
return this.authorizations;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (name() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property name in model SpacecraftLink"));
}
if (direction() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property direction in model SpacecraftLink"));
}
if (polarization() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property polarization in model SpacecraftLink"));
}
if (authorizations() != null) {
authorizations().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(SpacecraftLink.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeFloatField("centerFrequencyMHz", this.centerFrequencyMHz);
jsonWriter.writeFloatField("bandwidthMHz", this.bandwidthMHz);
jsonWriter.writeStringField("direction", this.direction == null ? null : this.direction.toString());
jsonWriter.writeStringField("polarization", this.polarization == null ? null : this.polarization.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SpacecraftLink from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SpacecraftLink 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 SpacecraftLink.
*/
public static SpacecraftLink fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SpacecraftLink deserializedSpacecraftLink = new SpacecraftLink();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedSpacecraftLink.name = reader.getString();
} else if ("centerFrequencyMHz".equals(fieldName)) {
deserializedSpacecraftLink.centerFrequencyMHz = reader.getFloat();
} else if ("bandwidthMHz".equals(fieldName)) {
deserializedSpacecraftLink.bandwidthMHz = reader.getFloat();
} else if ("direction".equals(fieldName)) {
deserializedSpacecraftLink.direction = Direction.fromString(reader.getString());
} else if ("polarization".equals(fieldName)) {
deserializedSpacecraftLink.polarization = Polarization.fromString(reader.getString());
} else if ("authorizations".equals(fieldName)) {
List authorizations
= reader.readArray(reader1 -> AuthorizedGroundstation.fromJson(reader1));
deserializedSpacecraftLink.authorizations = authorizations;
} else {
reader.skipChildren();
}
}
return deserializedSpacecraftLink;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy