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

com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner 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-2021-09.

There is a newer version: 1.0.0
Show 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.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 com.azure.resourcemanager.securityinsights.models.EnrichmentDomainWhoisDetails;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Whois information for a given domain and associated metadata.
 */
@Fluent
public final class EnrichmentDomainWhoisInner implements JsonSerializable {
    /*
     * The domain for this whois record
     */
    private String domain;

    /*
     * The hostname of this registrar's whois server
     */
    private String server;

    /*
     * The timestamp at which this record was created
     */
    private OffsetDateTime created;

    /*
     * The timestamp at which this record was last updated
     */
    private OffsetDateTime updated;

    /*
     * The timestamp at which this record will expire
     */
    private OffsetDateTime expires;

    /*
     * The whois record for a given domain
     */
    private EnrichmentDomainWhoisDetails parsedWhois;

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

    /**
     * Get the domain property: The domain for this whois record.
     * 
     * @return the domain value.
     */
    public String domain() {
        return this.domain;
    }

    /**
     * Set the domain property: The domain for this whois record.
     * 
     * @param domain the domain value to set.
     * @return the EnrichmentDomainWhoisInner object itself.
     */
    public EnrichmentDomainWhoisInner withDomain(String domain) {
        this.domain = domain;
        return this;
    }

    /**
     * Get the server property: The hostname of this registrar's whois server.
     * 
     * @return the server value.
     */
    public String server() {
        return this.server;
    }

    /**
     * Set the server property: The hostname of this registrar's whois server.
     * 
     * @param server the server value to set.
     * @return the EnrichmentDomainWhoisInner object itself.
     */
    public EnrichmentDomainWhoisInner withServer(String server) {
        this.server = server;
        return this;
    }

    /**
     * Get the created property: The timestamp at which this record was created.
     * 
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.created;
    }

    /**
     * Set the created property: The timestamp at which this record was created.
     * 
     * @param created the created value to set.
     * @return the EnrichmentDomainWhoisInner object itself.
     */
    public EnrichmentDomainWhoisInner withCreated(OffsetDateTime created) {
        this.created = created;
        return this;
    }

    /**
     * Get the updated property: The timestamp at which this record was last updated.
     * 
     * @return the updated value.
     */
    public OffsetDateTime updated() {
        return this.updated;
    }

    /**
     * Set the updated property: The timestamp at which this record was last updated.
     * 
     * @param updated the updated value to set.
     * @return the EnrichmentDomainWhoisInner object itself.
     */
    public EnrichmentDomainWhoisInner withUpdated(OffsetDateTime updated) {
        this.updated = updated;
        return this;
    }

    /**
     * Get the expires property: The timestamp at which this record will expire.
     * 
     * @return the expires value.
     */
    public OffsetDateTime expires() {
        return this.expires;
    }

    /**
     * Set the expires property: The timestamp at which this record will expire.
     * 
     * @param expires the expires value to set.
     * @return the EnrichmentDomainWhoisInner object itself.
     */
    public EnrichmentDomainWhoisInner withExpires(OffsetDateTime expires) {
        this.expires = expires;
        return this;
    }

    /**
     * Get the parsedWhois property: The whois record for a given domain.
     * 
     * @return the parsedWhois value.
     */
    public EnrichmentDomainWhoisDetails parsedWhois() {
        return this.parsedWhois;
    }

    /**
     * Set the parsedWhois property: The whois record for a given domain.
     * 
     * @param parsedWhois the parsedWhois value to set.
     * @return the EnrichmentDomainWhoisInner object itself.
     */
    public EnrichmentDomainWhoisInner withParsedWhois(EnrichmentDomainWhoisDetails parsedWhois) {
        this.parsedWhois = parsedWhois;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (parsedWhois() != null) {
            parsedWhois().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("domain", this.domain);
        jsonWriter.writeStringField("server", this.server);
        jsonWriter.writeStringField("created",
            this.created == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.created));
        jsonWriter.writeStringField("updated",
            this.updated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.updated));
        jsonWriter.writeStringField("expires",
            this.expires == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expires));
        jsonWriter.writeJsonField("parsedWhois", this.parsedWhois);
        return jsonWriter.writeEndObject();
    }

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

                if ("domain".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisInner.domain = reader.getString();
                } else if ("server".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisInner.server = reader.getString();
                } else if ("created".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisInner.created = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("updated".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisInner.updated = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("expires".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisInner.expires = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("parsedWhois".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisInner.parsedWhois = EnrichmentDomainWhoisDetails.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEnrichmentDomainWhoisInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy