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

com.azure.resourcemanager.securityinsights.models.TeamProperties 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.core.util.logging.ClientLogger;
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.List;
import java.util.Objects;
import java.util.UUID;

/**
 * Describes team properties.
 */
@Fluent
public final class TeamProperties implements JsonSerializable {
    /*
     * The name of the team
     */
    private String teamName;

    /*
     * The description of the team
     */
    private String teamDescription;

    /*
     * List of member IDs to add to the team
     */
    private List memberIds;

    /*
     * List of group IDs to add their members to the team
     */
    private List groupIds;

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

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

    /**
     * Set the teamName property: The name of the team.
     * 
     * @param teamName the teamName value to set.
     * @return the TeamProperties object itself.
     */
    public TeamProperties withTeamName(String teamName) {
        this.teamName = teamName;
        return this;
    }

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

    /**
     * Set the teamDescription property: The description of the team.
     * 
     * @param teamDescription the teamDescription value to set.
     * @return the TeamProperties object itself.
     */
    public TeamProperties withTeamDescription(String teamDescription) {
        this.teamDescription = teamDescription;
        return this;
    }

    /**
     * Get the memberIds property: List of member IDs to add to the team.
     * 
     * @return the memberIds value.
     */
    public List memberIds() {
        return this.memberIds;
    }

    /**
     * Set the memberIds property: List of member IDs to add to the team.
     * 
     * @param memberIds the memberIds value to set.
     * @return the TeamProperties object itself.
     */
    public TeamProperties withMemberIds(List memberIds) {
        this.memberIds = memberIds;
        return this;
    }

    /**
     * Get the groupIds property: List of group IDs to add their members to the team.
     * 
     * @return the groupIds value.
     */
    public List groupIds() {
        return this.groupIds;
    }

    /**
     * Set the groupIds property: List of group IDs to add their members to the team.
     * 
     * @param groupIds the groupIds value to set.
     * @return the TeamProperties object itself.
     */
    public TeamProperties withGroupIds(List groupIds) {
        this.groupIds = groupIds;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (teamName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property teamName in model TeamProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(TeamProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("teamName", this.teamName);
        jsonWriter.writeStringField("teamDescription", this.teamDescription);
        jsonWriter.writeArrayField("memberIds", this.memberIds,
            (writer, element) -> writer.writeString(Objects.toString(element, null)));
        jsonWriter.writeArrayField("groupIds", this.groupIds,
            (writer, element) -> writer.writeString(Objects.toString(element, null)));
        return jsonWriter.writeEndObject();
    }

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

                if ("teamName".equals(fieldName)) {
                    deserializedTeamProperties.teamName = reader.getString();
                } else if ("teamDescription".equals(fieldName)) {
                    deserializedTeamProperties.teamDescription = reader.getString();
                } else if ("memberIds".equals(fieldName)) {
                    List memberIds = reader.readArray(
                        reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())));
                    deserializedTeamProperties.memberIds = memberIds;
                } else if ("groupIds".equals(fieldName)) {
                    List groupIds = reader.readArray(
                        reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())));
                    deserializedTeamProperties.groupIds = groupIds;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTeamProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy