
com.azure.resourcemanager.relay.fluent.models.RelayNamespaceInner 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.relay.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.relay.models.ProvisioningStateEnum;
import com.azure.resourcemanager.relay.models.Sku;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.Map;
/**
* Description of a namespace resource.
*/
@Fluent
public final class RelayNamespaceInner extends Resource {
/*
* SKU of the namespace.
*/
private Sku sku;
/*
* Description of Relay namespace
*/
private RelayNamespaceProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of RelayNamespaceInner class.
*/
public RelayNamespaceInner() {
}
/**
* Get the sku property: SKU of the namespace.
*
* @return the sku value.
*/
public Sku sku() {
return this.sku;
}
/**
* Set the sku property: SKU of the namespace.
*
* @param sku the sku value to set.
* @return the RelayNamespaceInner object itself.
*/
public RelayNamespaceInner withSku(Sku sku) {
this.sku = sku;
return this;
}
/**
* Get the innerProperties property: Description of Relay namespace.
*
* @return the innerProperties value.
*/
private RelayNamespaceProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* {@inheritDoc}
*/
@Override
public RelayNamespaceInner withLocation(String location) {
super.withLocation(location);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public RelayNamespaceInner withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the provisioningState property: The provisioningState property.
*
* @return the provisioningState value.
*/
public ProvisioningStateEnum provisioningState() {
return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Get the createdAt property: The time the namespace was created.
*
* @return the createdAt value.
*/
public OffsetDateTime createdAt() {
return this.innerProperties() == null ? null : this.innerProperties().createdAt();
}
/**
* Get the updatedAt property: The time the namespace was updated.
*
* @return the updatedAt value.
*/
public OffsetDateTime updatedAt() {
return this.innerProperties() == null ? null : this.innerProperties().updatedAt();
}
/**
* Get the serviceBusEndpoint property: Endpoint you can use to perform Service Bus operations.
*
* @return the serviceBusEndpoint value.
*/
public String serviceBusEndpoint() {
return this.innerProperties() == null ? null : this.innerProperties().serviceBusEndpoint();
}
/**
* Get the metricId property: Identifier for Azure Insights metrics.
*
* @return the metricId value.
*/
public String metricId() {
return this.innerProperties() == null ? null : this.innerProperties().metricId();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (sku() != null) {
sku().validate();
}
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("location", location());
jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("sku", this.sku);
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RelayNamespaceInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RelayNamespaceInner 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 RelayNamespaceInner.
*/
public static RelayNamespaceInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RelayNamespaceInner deserializedRelayNamespaceInner = new RelayNamespaceInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedRelayNamespaceInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedRelayNamespaceInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedRelayNamespaceInner.type = reader.getString();
} else if ("location".equals(fieldName)) {
deserializedRelayNamespaceInner.withLocation(reader.getString());
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedRelayNamespaceInner.withTags(tags);
} else if ("sku".equals(fieldName)) {
deserializedRelayNamespaceInner.sku = Sku.fromJson(reader);
} else if ("properties".equals(fieldName)) {
deserializedRelayNamespaceInner.innerProperties = RelayNamespaceProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedRelayNamespaceInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy