
com.azure.resourcemanager.appcontainers.fluent.models.ContainerAppAuthTokenProperties 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.appcontainers.fluent.models;
import com.azure.core.annotation.Immutable;
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 java.io.IOException;
import java.time.OffsetDateTime;
/**
* Container App auth token resource specific properties.
*/
@Immutable
public final class ContainerAppAuthTokenProperties implements JsonSerializable {
/*
* Auth token value.
*/
private String token;
/*
* Token expiration date.
*/
private OffsetDateTime expires;
/**
* Creates an instance of ContainerAppAuthTokenProperties class.
*/
public ContainerAppAuthTokenProperties() {
}
/**
* Get the token property: Auth token value.
*
* @return the token value.
*/
public String token() {
return this.token;
}
/**
* Get the expires property: Token expiration date.
*
* @return the expires value.
*/
public OffsetDateTime expires() {
return this.expires;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ContainerAppAuthTokenProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ContainerAppAuthTokenProperties 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 ContainerAppAuthTokenProperties.
*/
public static ContainerAppAuthTokenProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ContainerAppAuthTokenProperties deserializedContainerAppAuthTokenProperties
= new ContainerAppAuthTokenProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("token".equals(fieldName)) {
deserializedContainerAppAuthTokenProperties.token = reader.getString();
} else if ("expires".equals(fieldName)) {
deserializedContainerAppAuthTokenProperties.expires = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedContainerAppAuthTokenProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy