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

com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2021-09.

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.securityinsights.models;

import com.azure.core.annotation.Fluent;
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.util.Objects;
import java.util.UUID;

/**
 * Information on the user an incident is assigned to.
 */
@Fluent
public final class IncidentOwnerInfo implements JsonSerializable {
    /*
     * The email of the user the incident is assigned to.
     */
    private String email;

    /*
     * The name of the user the incident is assigned to.
     */
    private String assignedTo;

    /*
     * The object id of the user the incident is assigned to.
     */
    private UUID objectId;

    /*
     * The user principal name of the user the incident is assigned to.
     */
    private String userPrincipalName;

    /*
     * The type of the owner the incident is assigned to.
     */
    private OwnerType ownerType;

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

    /**
     * Get the email property: The email of the user the incident is assigned to.
     * 
     * @return the email value.
     */
    public String email() {
        return this.email;
    }

    /**
     * Set the email property: The email of the user the incident is assigned to.
     * 
     * @param email the email value to set.
     * @return the IncidentOwnerInfo object itself.
     */
    public IncidentOwnerInfo withEmail(String email) {
        this.email = email;
        return this;
    }

    /**
     * Get the assignedTo property: The name of the user the incident is assigned to.
     * 
     * @return the assignedTo value.
     */
    public String assignedTo() {
        return this.assignedTo;
    }

    /**
     * Set the assignedTo property: The name of the user the incident is assigned to.
     * 
     * @param assignedTo the assignedTo value to set.
     * @return the IncidentOwnerInfo object itself.
     */
    public IncidentOwnerInfo withAssignedTo(String assignedTo) {
        this.assignedTo = assignedTo;
        return this;
    }

    /**
     * Get the objectId property: The object id of the user the incident is assigned to.
     * 
     * @return the objectId value.
     */
    public UUID objectId() {
        return this.objectId;
    }

    /**
     * Set the objectId property: The object id of the user the incident is assigned to.
     * 
     * @param objectId the objectId value to set.
     * @return the IncidentOwnerInfo object itself.
     */
    public IncidentOwnerInfo withObjectId(UUID objectId) {
        this.objectId = objectId;
        return this;
    }

    /**
     * Get the userPrincipalName property: The user principal name of the user the incident is assigned to.
     * 
     * @return the userPrincipalName value.
     */
    public String userPrincipalName() {
        return this.userPrincipalName;
    }

    /**
     * Set the userPrincipalName property: The user principal name of the user the incident is assigned to.
     * 
     * @param userPrincipalName the userPrincipalName value to set.
     * @return the IncidentOwnerInfo object itself.
     */
    public IncidentOwnerInfo withUserPrincipalName(String userPrincipalName) {
        this.userPrincipalName = userPrincipalName;
        return this;
    }

    /**
     * Get the ownerType property: The type of the owner the incident is assigned to.
     * 
     * @return the ownerType value.
     */
    public OwnerType ownerType() {
        return this.ownerType;
    }

    /**
     * Set the ownerType property: The type of the owner the incident is assigned to.
     * 
     * @param ownerType the ownerType value to set.
     * @return the IncidentOwnerInfo object itself.
     */
    public IncidentOwnerInfo withOwnerType(OwnerType ownerType) {
        this.ownerType = ownerType;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("email", this.email);
        jsonWriter.writeStringField("assignedTo", this.assignedTo);
        jsonWriter.writeStringField("objectId", Objects.toString(this.objectId, null));
        jsonWriter.writeStringField("userPrincipalName", this.userPrincipalName);
        jsonWriter.writeStringField("ownerType", this.ownerType == null ? null : this.ownerType.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("email".equals(fieldName)) {
                    deserializedIncidentOwnerInfo.email = reader.getString();
                } else if ("assignedTo".equals(fieldName)) {
                    deserializedIncidentOwnerInfo.assignedTo = reader.getString();
                } else if ("objectId".equals(fieldName)) {
                    deserializedIncidentOwnerInfo.objectId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("userPrincipalName".equals(fieldName)) {
                    deserializedIncidentOwnerInfo.userPrincipalName = reader.getString();
                } else if ("ownerType".equals(fieldName)) {
                    deserializedIncidentOwnerInfo.ownerType = OwnerType.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIncidentOwnerInfo;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy