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

com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentProperties 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.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Properties of the DevOps policy assignment resource.
 */
@Fluent
public final class DevOpsPolicyAssignmentProperties implements JsonSerializable {
    /*
     * Gets the resource status message.
     */
    private String provisioningStatusMessage;

    /*
     * Gets the time when resource was last checked.
     */
    private OffsetDateTime provisioningStatusUpdateTimeUtc;

    /*
     * The provisioning state of the resource.
     * 
     * Pending - Provisioning pending.
     * Failed - Provisioning failed.
     * Succeeded - Successful provisioning.
     * Canceled - Provisioning canceled.
     * PendingDeletion - Deletion pending.
     * DeletionSuccess - Deletion successful.
     * DeletionFailure - Deletion failure.
     */
    private DevOpsProvisioningState provisioningState;

    /*
     * Gets or sets the Azure resource id.
     */
    private String resourceId;

    /*
     * The behavior of a policy on descendant resources.
     */
    private DescendantBehavior descendantBehavior;

    /*
     * Condensed information to identify a DevOps Policy resource.
     */
    private DevOpsPolicyDescriptor policy;

    /*
     * Gets or sets time when the assignment was created in UTC.
     */
    private OffsetDateTime assignedAt;

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

    /**
     * Get the provisioningStatusMessage property: Gets the resource status message.
     * 
     * @return the provisioningStatusMessage value.
     */
    public String provisioningStatusMessage() {
        return this.provisioningStatusMessage;
    }

    /**
     * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked.
     * 
     * @return the provisioningStatusUpdateTimeUtc value.
     */
    public OffsetDateTime provisioningStatusUpdateTimeUtc() {
        return this.provisioningStatusUpdateTimeUtc;
    }

    /**
     * Get the provisioningState property: The provisioning state of the resource.
     * 
     * Pending - Provisioning pending.
     * Failed - Provisioning failed.
     * Succeeded - Successful provisioning.
     * Canceled - Provisioning canceled.
     * PendingDeletion - Deletion pending.
     * DeletionSuccess - Deletion successful.
     * DeletionFailure - Deletion failure.
     * 
     * @return the provisioningState value.
     */
    public DevOpsProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the resourceId property: Gets or sets the Azure resource id.
     * 
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: Gets or sets the Azure resource id.
     * 
     * @param resourceId the resourceId value to set.
     * @return the DevOpsPolicyAssignmentProperties object itself.
     */
    public DevOpsPolicyAssignmentProperties withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get the descendantBehavior property: The behavior of a policy on descendant resources.
     * 
     * @return the descendantBehavior value.
     */
    public DescendantBehavior descendantBehavior() {
        return this.descendantBehavior;
    }

    /**
     * Set the descendantBehavior property: The behavior of a policy on descendant resources.
     * 
     * @param descendantBehavior the descendantBehavior value to set.
     * @return the DevOpsPolicyAssignmentProperties object itself.
     */
    public DevOpsPolicyAssignmentProperties withDescendantBehavior(DescendantBehavior descendantBehavior) {
        this.descendantBehavior = descendantBehavior;
        return this;
    }

    /**
     * Get the policy property: Condensed information to identify a DevOps Policy resource.
     * 
     * @return the policy value.
     */
    public DevOpsPolicyDescriptor policy() {
        return this.policy;
    }

    /**
     * Set the policy property: Condensed information to identify a DevOps Policy resource.
     * 
     * @param policy the policy value to set.
     * @return the DevOpsPolicyAssignmentProperties object itself.
     */
    public DevOpsPolicyAssignmentProperties withPolicy(DevOpsPolicyDescriptor policy) {
        this.policy = policy;
        return this;
    }

    /**
     * Get the assignedAt property: Gets or sets time when the assignment was created in UTC.
     * 
     * @return the assignedAt value.
     */
    public OffsetDateTime assignedAt() {
        return this.assignedAt;
    }

    /**
     * Set the assignedAt property: Gets or sets time when the assignment was created in UTC.
     * 
     * @param assignedAt the assignedAt value to set.
     * @return the DevOpsPolicyAssignmentProperties object itself.
     */
    public DevOpsPolicyAssignmentProperties withAssignedAt(OffsetDateTime assignedAt) {
        this.assignedAt = assignedAt;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("resourceId", this.resourceId);
        jsonWriter.writeStringField("descendantBehavior",
            this.descendantBehavior == null ? null : this.descendantBehavior.toString());
        jsonWriter.writeJsonField("policy", this.policy);
        jsonWriter.writeStringField("assignedAt",
            this.assignedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.assignedAt));
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningStatusMessage".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.provisioningStatusMessage = reader.getString();
                } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.provisioningStatusUpdateTimeUtc = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.provisioningState
                        = DevOpsProvisioningState.fromString(reader.getString());
                } else if ("resourceId".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.resourceId = reader.getString();
                } else if ("descendantBehavior".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.descendantBehavior
                        = DescendantBehavior.fromString(reader.getString());
                } else if ("policy".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.policy = DevOpsPolicyDescriptor.fromJson(reader);
                } else if ("assignedAt".equals(fieldName)) {
                    deserializedDevOpsPolicyAssignmentProperties.assignedAt = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDevOpsPolicyAssignmentProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy