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

com.azure.resourcemanager.securityinsights.models.EnrichmentDomainWhoisDetails 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * The whois record for a given domain.
 */
@Fluent
public final class EnrichmentDomainWhoisDetails implements JsonSerializable {
    /*
     * The registrar associated with this domain
     */
    private EnrichmentDomainWhoisRegistrarDetails registrar;

    /*
     * The set of contacts associated with this domain
     */
    private EnrichmentDomainWhoisContacts contacts;

    /*
     * A list of name servers associated with this domain
     */
    private List nameServers;

    /*
     * The set of status flags for this whois record
     */
    private List statuses;

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

    /**
     * Get the registrar property: The registrar associated with this domain.
     * 
     * @return the registrar value.
     */
    public EnrichmentDomainWhoisRegistrarDetails registrar() {
        return this.registrar;
    }

    /**
     * Set the registrar property: The registrar associated with this domain.
     * 
     * @param registrar the registrar value to set.
     * @return the EnrichmentDomainWhoisDetails object itself.
     */
    public EnrichmentDomainWhoisDetails withRegistrar(EnrichmentDomainWhoisRegistrarDetails registrar) {
        this.registrar = registrar;
        return this;
    }

    /**
     * Get the contacts property: The set of contacts associated with this domain.
     * 
     * @return the contacts value.
     */
    public EnrichmentDomainWhoisContacts contacts() {
        return this.contacts;
    }

    /**
     * Set the contacts property: The set of contacts associated with this domain.
     * 
     * @param contacts the contacts value to set.
     * @return the EnrichmentDomainWhoisDetails object itself.
     */
    public EnrichmentDomainWhoisDetails withContacts(EnrichmentDomainWhoisContacts contacts) {
        this.contacts = contacts;
        return this;
    }

    /**
     * Get the nameServers property: A list of name servers associated with this domain.
     * 
     * @return the nameServers value.
     */
    public List nameServers() {
        return this.nameServers;
    }

    /**
     * Set the nameServers property: A list of name servers associated with this domain.
     * 
     * @param nameServers the nameServers value to set.
     * @return the EnrichmentDomainWhoisDetails object itself.
     */
    public EnrichmentDomainWhoisDetails withNameServers(List nameServers) {
        this.nameServers = nameServers;
        return this;
    }

    /**
     * Get the statuses property: The set of status flags for this whois record.
     * 
     * @return the statuses value.
     */
    public List statuses() {
        return this.statuses;
    }

    /**
     * Set the statuses property: The set of status flags for this whois record.
     * 
     * @param statuses the statuses value to set.
     * @return the EnrichmentDomainWhoisDetails object itself.
     */
    public EnrichmentDomainWhoisDetails withStatuses(List statuses) {
        this.statuses = statuses;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("registrar", this.registrar);
        jsonWriter.writeJsonField("contacts", this.contacts);
        jsonWriter.writeArrayField("nameServers", this.nameServers, (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("statuses", this.statuses, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("registrar".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisDetails.registrar
                        = EnrichmentDomainWhoisRegistrarDetails.fromJson(reader);
                } else if ("contacts".equals(fieldName)) {
                    deserializedEnrichmentDomainWhoisDetails.contacts = EnrichmentDomainWhoisContacts.fromJson(reader);
                } else if ("nameServers".equals(fieldName)) {
                    List nameServers = reader.readArray(reader1 -> reader1.getString());
                    deserializedEnrichmentDomainWhoisDetails.nameServers = nameServers;
                } else if ("statuses".equals(fieldName)) {
                    List statuses = reader.readArray(reader1 -> reader1.getString());
                    deserializedEnrichmentDomainWhoisDetails.statuses = statuses;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEnrichmentDomainWhoisDetails;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy