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

com.azure.resourcemanager.security.models.GcpProjectEnvironmentData 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;

/**
 * The GCP project connector environment data.
 */
@Fluent
public final class GcpProjectEnvironmentData extends EnvironmentData {
    /*
     * The type of the environment data.
     */
    private EnvironmentType environmentType = EnvironmentType.GCP_PROJECT;

    /*
     * The Gcp project's organizational data
     */
    private GcpOrganizationalData organizationalData;

    /*
     * The Gcp project's details
     */
    private GcpProjectDetails projectDetails;

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

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

    /**
     * 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 Gcp project's organizational data.
     * 
     * @return the organizationalData value.
     */
    public GcpOrganizationalData organizationalData() {
        return this.organizationalData;
    }

    /**
     * Set the organizationalData property: The Gcp project's organizational data.
     * 
     * @param organizationalData the organizationalData value to set.
     * @return the GcpProjectEnvironmentData object itself.
     */
    public GcpProjectEnvironmentData withOrganizationalData(GcpOrganizationalData organizationalData) {
        this.organizationalData = organizationalData;
        return this;
    }

    /**
     * Get the projectDetails property: The Gcp project's details.
     * 
     * @return the projectDetails value.
     */
    public GcpProjectDetails projectDetails() {
        return this.projectDetails;
    }

    /**
     * Set the projectDetails property: The Gcp project's details.
     * 
     * @param projectDetails the projectDetails value to set.
     * @return the GcpProjectEnvironmentData object itself.
     */
    public GcpProjectEnvironmentData withProjectDetails(GcpProjectDetails projectDetails) {
        this.projectDetails = projectDetails;
        return this;
    }

    /**
     * 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 GcpProjectEnvironmentData object itself.
     */
    public GcpProjectEnvironmentData 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();
        }
        if (projectDetails() != null) {
            projectDetails().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.writeJsonField("projectDetails", this.projectDetails);
        jsonWriter.writeNumberField("scanInterval", this.scanInterval);
        return jsonWriter.writeEndObject();
    }

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

                if ("environmentType".equals(fieldName)) {
                    deserializedGcpProjectEnvironmentData.environmentType
                        = EnvironmentType.fromString(reader.getString());
                } else if ("organizationalData".equals(fieldName)) {
                    deserializedGcpProjectEnvironmentData.organizationalData = GcpOrganizationalData.fromJson(reader);
                } else if ("projectDetails".equals(fieldName)) {
                    deserializedGcpProjectEnvironmentData.projectDetails = GcpProjectDetails.fromJson(reader);
                } else if ("scanInterval".equals(fieldName)) {
                    deserializedGcpProjectEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedGcpProjectEnvironmentData;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy