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

com.azure.resourcemanager.securityinsights.fluent.models.AwsCloudTrailDataConnectorProperties 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.logging.ClientLogger;
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.AwsCloudTrailDataConnectorDataTypes;
import java.io.IOException;

/**
 * Amazon Web Services CloudTrail data connector properties.
 */
@Fluent
public final class AwsCloudTrailDataConnectorProperties
    implements JsonSerializable {
    /*
     * The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access the Aws account.
     */
    private String awsRoleArn;

    /*
     * The available data types for the connector.
     */
    private AwsCloudTrailDataConnectorDataTypes dataTypes;

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

    /**
     * Get the awsRoleArn property: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access the Aws
     * account.
     * 
     * @return the awsRoleArn value.
     */
    public String awsRoleArn() {
        return this.awsRoleArn;
    }

    /**
     * Set the awsRoleArn property: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access the Aws
     * account.
     * 
     * @param awsRoleArn the awsRoleArn value to set.
     * @return the AwsCloudTrailDataConnectorProperties object itself.
     */
    public AwsCloudTrailDataConnectorProperties withAwsRoleArn(String awsRoleArn) {
        this.awsRoleArn = awsRoleArn;
        return this;
    }

    /**
     * Get the dataTypes property: The available data types for the connector.
     * 
     * @return the dataTypes value.
     */
    public AwsCloudTrailDataConnectorDataTypes dataTypes() {
        return this.dataTypes;
    }

    /**
     * Set the dataTypes property: The available data types for the connector.
     * 
     * @param dataTypes the dataTypes value to set.
     * @return the AwsCloudTrailDataConnectorProperties object itself.
     */
    public AwsCloudTrailDataConnectorProperties withDataTypes(AwsCloudTrailDataConnectorDataTypes dataTypes) {
        this.dataTypes = dataTypes;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (dataTypes() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property dataTypes in model AwsCloudTrailDataConnectorProperties"));
        } else {
            dataTypes().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(AwsCloudTrailDataConnectorProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("dataTypes", this.dataTypes);
        jsonWriter.writeStringField("awsRoleArn", this.awsRoleArn);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AwsCloudTrailDataConnectorProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AwsCloudTrailDataConnectorProperties if the JsonReader was pointing to an instance of it,
     * or null if it was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the AwsCloudTrailDataConnectorProperties.
     */
    public static AwsCloudTrailDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AwsCloudTrailDataConnectorProperties deserializedAwsCloudTrailDataConnectorProperties
                = new AwsCloudTrailDataConnectorProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("dataTypes".equals(fieldName)) {
                    deserializedAwsCloudTrailDataConnectorProperties.dataTypes
                        = AwsCloudTrailDataConnectorDataTypes.fromJson(reader);
                } else if ("awsRoleArn".equals(fieldName)) {
                    deserializedAwsCloudTrailDataConnectorProperties.awsRoleArn = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAwsCloudTrailDataConnectorProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy