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

com.azure.resourcemanager.security.models.AwsEnvironmentData Maven / Gradle / Ivy

Go to download

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

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.security.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * The AWS connector environment data.
 */
@Fluent
public final class AwsEnvironmentData extends EnvironmentData {
    /*
     * The type of the environment data.
     */
    private EnvironmentType environmentType = EnvironmentType.AWS_ACCOUNT;

    /*
     * The AWS account's organizational data
     */
    private AwsOrganizationalData organizationalData;

    /*
     * list of regions to scan
     */
    private List regions;

    /*
     * The AWS account name
     */
    private String accountName;

    /*
     * Scan interval in hours (value should be between 1-hour to 24-hours)
     */
    private Long scanInterval;

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

    /**
     * Get the environmentType property: The type of the environment data.
     * 
     * @return the environmentType value.
     */
    @Override
    public EnvironmentType environmentType() {
        return this.environmentType;
    }

    /**
     * Get the organizationalData property: The AWS account's organizational data.
     * 
     * @return the organizationalData value.
     */
    public AwsOrganizationalData organizationalData() {
        return this.organizationalData;
    }

    /**
     * Set the organizationalData property: The AWS account's organizational data.
     * 
     * @param organizationalData the organizationalData value to set.
     * @return the AwsEnvironmentData object itself.
     */
    public AwsEnvironmentData withOrganizationalData(AwsOrganizationalData organizationalData) {
        this.organizationalData = organizationalData;
        return this;
    }

    /**
     * Get the regions property: list of regions to scan.
     * 
     * @return the regions value.
     */
    public List regions() {
        return this.regions;
    }

    /**
     * Set the regions property: list of regions to scan.
     * 
     * @param regions the regions value to set.
     * @return the AwsEnvironmentData object itself.
     */
    public AwsEnvironmentData withRegions(List regions) {
        this.regions = regions;
        return this;
    }

    /**
     * Get the accountName property: The AWS account name.
     * 
     * @return the accountName value.
     */
    public String accountName() {
        return this.accountName;
    }

    /**
     * Get the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours).
     * 
     * @return the scanInterval value.
     */
    public Long scanInterval() {
        return this.scanInterval;
    }

    /**
     * Set the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours).
     * 
     * @param scanInterval the scanInterval value to set.
     * @return the AwsEnvironmentData object itself.
     */
    public AwsEnvironmentData withScanInterval(Long scanInterval) {
        this.scanInterval = scanInterval;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("environmentType",
            this.environmentType == null ? null : this.environmentType.toString());
        jsonWriter.writeJsonField("organizationalData", this.organizationalData);
        jsonWriter.writeArrayField("regions", this.regions, (writer, element) -> writer.writeString(element));
        jsonWriter.writeNumberField("scanInterval", this.scanInterval);
        return jsonWriter.writeEndObject();
    }

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

                if ("environmentType".equals(fieldName)) {
                    deserializedAwsEnvironmentData.environmentType = EnvironmentType.fromString(reader.getString());
                } else if ("organizationalData".equals(fieldName)) {
                    deserializedAwsEnvironmentData.organizationalData = AwsOrganizationalData.fromJson(reader);
                } else if ("regions".equals(fieldName)) {
                    List regions = reader.readArray(reader1 -> reader1.getString());
                    deserializedAwsEnvironmentData.regions = regions;
                } else if ("accountName".equals(fieldName)) {
                    deserializedAwsEnvironmentData.accountName = reader.getString();
                } else if ("scanInterval".equals(fieldName)) {
                    deserializedAwsEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAwsEnvironmentData;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy