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

com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData 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.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 java.io.IOException;

/**
 * Data regarding 3rd party partner integration.
 */
@Fluent
public final class SecurityAssessmentPartnerData implements JsonSerializable {
    /*
     * Name of the company of the partner
     */
    private String partnerName;

    /*
     * secret to authenticate the partner - write only
     */
    private String secret;

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

    /**
     * Get the partnerName property: Name of the company of the partner.
     * 
     * @return the partnerName value.
     */
    public String partnerName() {
        return this.partnerName;
    }

    /**
     * Set the partnerName property: Name of the company of the partner.
     * 
     * @param partnerName the partnerName value to set.
     * @return the SecurityAssessmentPartnerData object itself.
     */
    public SecurityAssessmentPartnerData withPartnerName(String partnerName) {
        this.partnerName = partnerName;
        return this;
    }

    /**
     * Get the secret property: secret to authenticate the partner - write only.
     * 
     * @return the secret value.
     */
    public String secret() {
        return this.secret;
    }

    /**
     * Set the secret property: secret to authenticate the partner - write only.
     * 
     * @param secret the secret value to set.
     * @return the SecurityAssessmentPartnerData object itself.
     */
    public SecurityAssessmentPartnerData withSecret(String secret) {
        this.secret = secret;
        return this;
    }

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

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

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

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

                if ("partnerName".equals(fieldName)) {
                    deserializedSecurityAssessmentPartnerData.partnerName = reader.getString();
                } else if ("secret".equals(fieldName)) {
                    deserializedSecurityAssessmentPartnerData.secret = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecurityAssessmentPartnerData;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy