All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.automation.fluent.models.CredentialProperties Maven / Gradle / Ivy

Go to download

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 java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Definition of the credential properties.
 */
@Fluent
public final class CredentialProperties implements JsonSerializable {
    /*
     * Gets the user name of the credential.
     */
    private String username;

    /*
     * 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 CredentialProperties class.
     */
    public CredentialProperties() {
    }

    /**
     * Get the username property: Gets the user name of the credential.
     * 
     * @return the username value.
     */
    public String username() {
        return this.username;
    }

    /**
     * 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 CredentialProperties object itself.
     */
    public CredentialProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * 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();
        jsonWriter.writeStringField("description", this.description);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of CredentialProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of CredentialProperties 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 CredentialProperties.
     */
    public static CredentialProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            CredentialProperties deserializedCredentialProperties = new CredentialProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("userName".equals(fieldName)) {
                    deserializedCredentialProperties.username = reader.getString();
                } else if ("creationTime".equals(fieldName)) {
                    deserializedCredentialProperties.creationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastModifiedTime".equals(fieldName)) {
                    deserializedCredentialProperties.lastModifiedTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedCredentialProperties.description = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCredentialProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy