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

com.azure.resourcemanager.security.fluent.models.GovernanceAssignmentInner 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.GovernanceAssignmentAdditionalData;
import com.azure.resourcemanager.security.models.GovernanceEmailNotification;
import com.azure.resourcemanager.security.models.RemediationEta;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Governance assignment over a given scope.
 */
@Fluent
public final class GovernanceAssignmentInner extends ProxyResource {
    /*
     * The properties of a governance assignment
     */
    private GovernanceAssignmentProperties 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 GovernanceAssignmentInner class.
     */
    public GovernanceAssignmentInner() {
    }

    /**
     * Get the innerProperties property: The properties of a governance assignment.
     * 
     * @return the innerProperties value.
     */
    private GovernanceAssignmentProperties 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 owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example.
     * 
     * @return the owner value.
     */
    public String owner() {
        return this.innerProperties() == null ? null : this.innerProperties().owner();
    }

    /**
     * Set the owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example.
     * 
     * @param owner the owner value to set.
     * @return the GovernanceAssignmentInner object itself.
     */
    public GovernanceAssignmentInner withOwner(String owner) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GovernanceAssignmentProperties();
        }
        this.innerProperties().withOwner(owner);
        return this;
    }

    /**
     * Get the remediationDueDate property: The remediation due-date - after this date Secure Score will be affected (in
     * case of active grace-period).
     * 
     * @return the remediationDueDate value.
     */
    public OffsetDateTime remediationDueDate() {
        return this.innerProperties() == null ? null : this.innerProperties().remediationDueDate();
    }

    /**
     * Set the remediationDueDate property: The remediation due-date - after this date Secure Score will be affected (in
     * case of active grace-period).
     * 
     * @param remediationDueDate the remediationDueDate value to set.
     * @return the GovernanceAssignmentInner object itself.
     */
    public GovernanceAssignmentInner withRemediationDueDate(OffsetDateTime remediationDueDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GovernanceAssignmentProperties();
        }
        this.innerProperties().withRemediationDueDate(remediationDueDate);
        return this;
    }

    /**
     * Get the remediationEta property: The ETA (estimated time of arrival) for remediation (optional), see example.
     * 
     * @return the remediationEta value.
     */
    public RemediationEta remediationEta() {
        return this.innerProperties() == null ? null : this.innerProperties().remediationEta();
    }

    /**
     * Set the remediationEta property: The ETA (estimated time of arrival) for remediation (optional), see example.
     * 
     * @param remediationEta the remediationEta value to set.
     * @return the GovernanceAssignmentInner object itself.
     */
    public GovernanceAssignmentInner withRemediationEta(RemediationEta remediationEta) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GovernanceAssignmentProperties();
        }
        this.innerProperties().withRemediationEta(remediationEta);
        return this;
    }

    /**
     * Get the isGracePeriod property: Defines whether there is a grace period on the governance assignment.
     * 
     * @return the isGracePeriod value.
     */
    public Boolean isGracePeriod() {
        return this.innerProperties() == null ? null : this.innerProperties().isGracePeriod();
    }

    /**
     * Set the isGracePeriod property: Defines whether there is a grace period on the governance assignment.
     * 
     * @param isGracePeriod the isGracePeriod value to set.
     * @return the GovernanceAssignmentInner object itself.
     */
    public GovernanceAssignmentInner withIsGracePeriod(Boolean isGracePeriod) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GovernanceAssignmentProperties();
        }
        this.innerProperties().withIsGracePeriod(isGracePeriod);
        return this;
    }

    /**
     * Get the governanceEmailNotification property: The email notifications settings for the governance rule, states
     * whether to disable notifications for mangers and owners.
     * 
     * @return the governanceEmailNotification value.
     */
    public GovernanceEmailNotification governanceEmailNotification() {
        return this.innerProperties() == null ? null : this.innerProperties().governanceEmailNotification();
    }

    /**
     * Set the governanceEmailNotification property: The email notifications settings for the governance rule, states
     * whether to disable notifications for mangers and owners.
     * 
     * @param governanceEmailNotification the governanceEmailNotification value to set.
     * @return the GovernanceAssignmentInner object itself.
     */
    public GovernanceAssignmentInner
        withGovernanceEmailNotification(GovernanceEmailNotification governanceEmailNotification) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GovernanceAssignmentProperties();
        }
        this.innerProperties().withGovernanceEmailNotification(governanceEmailNotification);
        return this;
    }

    /**
     * Get the additionalData property: The additional data for the governance assignment - e.g. links to ticket
     * (optional), see example.
     * 
     * @return the additionalData value.
     */
    public GovernanceAssignmentAdditionalData additionalData() {
        return this.innerProperties() == null ? null : this.innerProperties().additionalData();
    }

    /**
     * Set the additionalData property: The additional data for the governance assignment - e.g. links to ticket
     * (optional), see example.
     * 
     * @param additionalData the additionalData value to set.
     * @return the GovernanceAssignmentInner object itself.
     */
    public GovernanceAssignmentInner withAdditionalData(GovernanceAssignmentAdditionalData additionalData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GovernanceAssignmentProperties();
        }
        this.innerProperties().withAdditionalData(additionalData);
        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 GovernanceAssignmentInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of GovernanceAssignmentInner 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 GovernanceAssignmentInner.
     */
    public static GovernanceAssignmentInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            GovernanceAssignmentInner deserializedGovernanceAssignmentInner = new GovernanceAssignmentInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

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

            return deserializedGovernanceAssignmentInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy