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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.AssignedStandardItem;
import com.azure.resourcemanager.security.models.Effect;
import com.azure.resourcemanager.security.models.StandardAssignmentMetadata;
import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesAttestationData;
import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesExemptionData;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * Describes the properties of a standardAssignment.
 */
@Fluent
public final class StandardAssignmentProperties implements JsonSerializable {
    /*
     * Display name of the standardAssignment
     */
    private String displayName;

    /*
     * Description of the standardAssignment
     */
    private String description;

    /*
     * Standard item with key as applied to this standard assignment over the given scope
     */
    private AssignedStandardItem assignedStandard;

    /*
     * Expected effect of this assignment (Audit/Exempt/Attest)
     */
    private Effect effect;

    /*
     * Excluded scopes, filter out the descendants of the scope (on management scopes)
     */
    private List excludedScopes;

    /*
     * Expiration date of this assignment as a full ISO date
     */
    private OffsetDateTime expiresOn;

    /*
     * Additional data about assignment that has Exempt effect
     */
    private StandardAssignmentPropertiesExemptionData exemptionData;

    /*
     * Additional data about assignment that has Attest effect
     */
    private StandardAssignmentPropertiesAttestationData attestationData;

    /*
     * The standard assignment metadata.
     */
    private StandardAssignmentMetadata metadata;

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

    /**
     * Get the displayName property: Display name of the standardAssignment.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Display name of the standardAssignment.
     * 
     * @param displayName the displayName value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the description property: Description of the standardAssignment.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Description of the standardAssignment.
     * 
     * @param description the description value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the assignedStandard property: Standard item with key as applied to this standard assignment over the given
     * scope.
     * 
     * @return the assignedStandard value.
     */
    public AssignedStandardItem assignedStandard() {
        return this.assignedStandard;
    }

    /**
     * Set the assignedStandard property: Standard item with key as applied to this standard assignment over the given
     * scope.
     * 
     * @param assignedStandard the assignedStandard value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withAssignedStandard(AssignedStandardItem assignedStandard) {
        this.assignedStandard = assignedStandard;
        return this;
    }

    /**
     * Get the effect property: Expected effect of this assignment (Audit/Exempt/Attest).
     * 
     * @return the effect value.
     */
    public Effect effect() {
        return this.effect;
    }

    /**
     * Set the effect property: Expected effect of this assignment (Audit/Exempt/Attest).
     * 
     * @param effect the effect value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withEffect(Effect effect) {
        this.effect = effect;
        return this;
    }

    /**
     * Get the excludedScopes property: Excluded scopes, filter out the descendants of the scope (on management scopes).
     * 
     * @return the excludedScopes value.
     */
    public List excludedScopes() {
        return this.excludedScopes;
    }

    /**
     * Set the excludedScopes property: Excluded scopes, filter out the descendants of the scope (on management scopes).
     * 
     * @param excludedScopes the excludedScopes value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withExcludedScopes(List excludedScopes) {
        this.excludedScopes = excludedScopes;
        return this;
    }

    /**
     * Get the expiresOn property: Expiration date of this assignment as a full ISO date.
     * 
     * @return the expiresOn value.
     */
    public OffsetDateTime expiresOn() {
        return this.expiresOn;
    }

    /**
     * Set the expiresOn property: Expiration date of this assignment as a full ISO date.
     * 
     * @param expiresOn the expiresOn value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withExpiresOn(OffsetDateTime expiresOn) {
        this.expiresOn = expiresOn;
        return this;
    }

    /**
     * Get the exemptionData property: Additional data about assignment that has Exempt effect.
     * 
     * @return the exemptionData value.
     */
    public StandardAssignmentPropertiesExemptionData exemptionData() {
        return this.exemptionData;
    }

    /**
     * Set the exemptionData property: Additional data about assignment that has Exempt effect.
     * 
     * @param exemptionData the exemptionData value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withExemptionData(StandardAssignmentPropertiesExemptionData exemptionData) {
        this.exemptionData = exemptionData;
        return this;
    }

    /**
     * Get the attestationData property: Additional data about assignment that has Attest effect.
     * 
     * @return the attestationData value.
     */
    public StandardAssignmentPropertiesAttestationData attestationData() {
        return this.attestationData;
    }

    /**
     * Set the attestationData property: Additional data about assignment that has Attest effect.
     * 
     * @param attestationData the attestationData value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties
        withAttestationData(StandardAssignmentPropertiesAttestationData attestationData) {
        this.attestationData = attestationData;
        return this;
    }

    /**
     * Get the metadata property: The standard assignment metadata.
     * 
     * @return the metadata value.
     */
    public StandardAssignmentMetadata metadata() {
        return this.metadata;
    }

    /**
     * Set the metadata property: The standard assignment metadata.
     * 
     * @param metadata the metadata value to set.
     * @return the StandardAssignmentProperties object itself.
     */
    public StandardAssignmentProperties withMetadata(StandardAssignmentMetadata metadata) {
        this.metadata = metadata;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeJsonField("assignedStandard", this.assignedStandard);
        jsonWriter.writeStringField("effect", this.effect == null ? null : this.effect.toString());
        jsonWriter.writeArrayField("excludedScopes", this.excludedScopes,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("expiresOn",
            this.expiresOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiresOn));
        jsonWriter.writeJsonField("exemptionData", this.exemptionData);
        jsonWriter.writeJsonField("attestationData", this.attestationData);
        jsonWriter.writeJsonField("metadata", this.metadata);
        return jsonWriter.writeEndObject();
    }

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

                if ("displayName".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.displayName = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.description = reader.getString();
                } else if ("assignedStandard".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.assignedStandard = AssignedStandardItem.fromJson(reader);
                } else if ("effect".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.effect = Effect.fromString(reader.getString());
                } else if ("excludedScopes".equals(fieldName)) {
                    List excludedScopes = reader.readArray(reader1 -> reader1.getString());
                    deserializedStandardAssignmentProperties.excludedScopes = excludedScopes;
                } else if ("expiresOn".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.expiresOn = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("exemptionData".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.exemptionData
                        = StandardAssignmentPropertiesExemptionData.fromJson(reader);
                } else if ("attestationData".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.attestationData
                        = StandardAssignmentPropertiesAttestationData.fromJson(reader);
                } else if ("metadata".equals(fieldName)) {
                    deserializedStandardAssignmentProperties.metadata = StandardAssignmentMetadata.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedStandardAssignmentProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy