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

com.azure.resourcemanager.securityinsights.models.EntityExpandParameters Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.

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.securityinsights.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;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.UUID;

/**
 * The parameters required to execute an expand operation on the given entity.
 */
@Fluent
public final class EntityExpandParameters implements JsonSerializable {
    /*
     * The end date filter, so the only expansion results returned are before this date.
     */
    private OffsetDateTime endTime;

    /*
     * The Id of the expansion to perform.
     */
    private UUID expansionId;

    /*
     * The start date filter, so the only expansion results returned are after this date.
     */
    private OffsetDateTime startTime;

    /**
     * Creates an instance of EntityExpandParameters class.
     */
    public EntityExpandParameters() {
    }

    /**
     * Get the endTime property: The end date filter, so the only expansion results returned are before this date.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: The end date filter, so the only expansion results returned are before this date.
     * 
     * @param endTime the endTime value to set.
     * @return the EntityExpandParameters object itself.
     */
    public EntityExpandParameters withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the expansionId property: The Id of the expansion to perform.
     * 
     * @return the expansionId value.
     */
    public UUID expansionId() {
        return this.expansionId;
    }

    /**
     * Set the expansionId property: The Id of the expansion to perform.
     * 
     * @param expansionId the expansionId value to set.
     * @return the EntityExpandParameters object itself.
     */
    public EntityExpandParameters withExpansionId(UUID expansionId) {
        this.expansionId = expansionId;
        return this;
    }

    /**
     * Get the startTime property: The start date filter, so the only expansion results returned are after this date.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: The start date filter, so the only expansion results returned are after this date.
     * 
     * @param startTime the startTime value to set.
     * @return the EntityExpandParameters object itself.
     */
    public EntityExpandParameters withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        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("endTime",
            this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
        jsonWriter.writeStringField("expansionId", Objects.toString(this.expansionId, null));
        jsonWriter.writeStringField("startTime",
            this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
        return jsonWriter.writeEndObject();
    }

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

                if ("endTime".equals(fieldName)) {
                    deserializedEntityExpandParameters.endTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("expansionId".equals(fieldName)) {
                    deserializedEntityExpandParameters.expansionId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("startTime".equals(fieldName)) {
                    deserializedEntityExpandParameters.startTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEntityExpandParameters;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy