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

com.azure.resourcemanager.security.models.DockerHubEnvironmentData 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 Docker Hub connector environment data.
 */
@Fluent
public final class DockerHubEnvironmentData extends EnvironmentData {
    /*
     * The type of the environment data.
     */
    private EnvironmentType environmentType = EnvironmentType.DOCKER_HUB_ORGANIZATION;

    /*
     * The Docker Hub organization authentication details
     */
    private Authentication authentication;

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

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

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

    /**
     * Get the authentication property: The Docker Hub organization authentication details.
     * 
     * @return the authentication value.
     */
    public Authentication authentication() {
        return this.authentication;
    }

    /**
     * Set the authentication property: The Docker Hub organization authentication details.
     * 
     * @param authentication the authentication value to set.
     * @return the DockerHubEnvironmentData object itself.
     */
    public DockerHubEnvironmentData withAuthentication(Authentication authentication) {
        this.authentication = authentication;
        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 DockerHubEnvironmentData object itself.
     */
    public DockerHubEnvironmentData 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 (authentication() != null) {
            authentication().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("environmentType",
            this.environmentType == null ? null : this.environmentType.toString());
        jsonWriter.writeJsonField("authentication", this.authentication);
        jsonWriter.writeNumberField("scanInterval", this.scanInterval);
        return jsonWriter.writeEndObject();
    }

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

                if ("environmentType".equals(fieldName)) {
                    deserializedDockerHubEnvironmentData.environmentType
                        = EnvironmentType.fromString(reader.getString());
                } else if ("authentication".equals(fieldName)) {
                    deserializedDockerHubEnvironmentData.authentication = Authentication.fromJson(reader);
                } else if ("scanInterval".equals(fieldName)) {
                    deserializedDockerHubEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDockerHubEnvironmentData;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy