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

com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner Maven / Gradle / Ivy

// 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.management.ProxyResource;
import com.azure.json.JsonReader;
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.util.List;

/**
 * Security Assignment on a resource group over a given scope.
 */
@Fluent
public final class StandardAssignmentInner extends ProxyResource {
    /*
     * Properties of a standard assignments assignment
     */
    private StandardAssignmentProperties innerProperties;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: Properties of a standard assignments assignment.
     * 
     * @return the innerProperties value.
     */
    private StandardAssignmentProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

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

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

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

    /**
     * Set the description property: Description of the standardAssignment.
     * 
     * @param description the description value to set.
     * @return the StandardAssignmentInner object itself.
     */
    public StandardAssignmentInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new StandardAssignmentProperties();
        }
        this.innerProperties().withDescription(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.innerProperties() == null ? null : this.innerProperties().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 StandardAssignmentInner object itself.
     */
    public StandardAssignmentInner withAssignedStandard(AssignedStandardItem assignedStandard) {
        if (this.innerProperties() == null) {
            this.innerProperties = new StandardAssignmentProperties();
        }
        this.innerProperties().withAssignedStandard(assignedStandard);
        return this;
    }

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

    /**
     * Set the effect property: Expected effect of this assignment (Audit/Exempt/Attest).
     * 
     * @param effect the effect value to set.
     * @return the StandardAssignmentInner object itself.
     */
    public StandardAssignmentInner withEffect(Effect effect) {
        if (this.innerProperties() == null) {
            this.innerProperties = new StandardAssignmentProperties();
        }
        this.innerProperties().withEffect(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.innerProperties() == null ? null : this.innerProperties().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 StandardAssignmentInner object itself.
     */
    public StandardAssignmentInner withExcludedScopes(List excludedScopes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new StandardAssignmentProperties();
        }
        this.innerProperties().withExcludedScopes(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.innerProperties() == null ? null : this.innerProperties().expiresOn();
    }

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

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

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

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

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

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

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

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

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

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

                if ("id".equals(fieldName)) {
                    deserializedStandardAssignmentInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedStandardAssignmentInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedStandardAssignmentInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedStandardAssignmentInner.innerProperties = StandardAssignmentProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedStandardAssignmentInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy