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

com.azure.resourcemanager.devcenter.models.DevCenterUpdate 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.devcenter.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.fluent.models.DevCenterUpdateProperties;
import java.io.IOException;
import java.util.Map;

/**
 * The devcenter resource for partial updates. Properties not provided in the update request will not be changed.
 */
@Fluent
public final class DevCenterUpdate extends TrackedResourceUpdate {
    /*
     * Managed identity properties
     */
    private ManagedServiceIdentity identity;

    /*
     * Properties of a Dev Center to be updated.
     */
    private DevCenterUpdateProperties innerProperties;

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

    /**
     * Get the identity property: Managed identity properties.
     * 
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Managed identity properties.
     * 
     * @param identity the identity value to set.
     * @return the DevCenterUpdate object itself.
     */
    public DevCenterUpdate withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of a Dev Center to be updated.
     * 
     * @return the innerProperties value.
     */
    private DevCenterUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DevCenterUpdate withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DevCenterUpdate withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * Get the encryption property: Encryption settings to be used for server-side encryption for proprietary content
     * (such as catalogs, logs, customizations).
     * 
     * @return the encryption value.
     */
    public Encryption encryption() {
        return this.innerProperties() == null ? null : this.innerProperties().encryption();
    }

    /**
     * Set the encryption property: Encryption settings to be used for server-side encryption for proprietary content
     * (such as catalogs, logs, customizations).
     * 
     * @param encryption the encryption value to set.
     * @return the DevCenterUpdate object itself.
     */
    public DevCenterUpdate withEncryption(Encryption encryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevCenterUpdateProperties();
        }
        this.innerProperties().withEncryption(encryption);
        return this;
    }

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

    /**
     * Set the displayName property: The display name of the devcenter.
     * 
     * @param displayName the displayName value to set.
     * @return the DevCenterUpdate object itself.
     */
    public DevCenterUpdate withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevCenterUpdateProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the projectCatalogSettings property: Dev Center settings to be used when associating a project with a
     * catalog.
     * 
     * @return the projectCatalogSettings value.
     */
    public DevCenterProjectCatalogSettings projectCatalogSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().projectCatalogSettings();
    }

    /**
     * Set the projectCatalogSettings property: Dev Center settings to be used when associating a project with a
     * catalog.
     * 
     * @param projectCatalogSettings the projectCatalogSettings value to set.
     * @return the DevCenterUpdate object itself.
     */
    public DevCenterUpdate withProjectCatalogSettings(DevCenterProjectCatalogSettings projectCatalogSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevCenterUpdateProperties();
        }
        this.innerProperties().withProjectCatalogSettings(projectCatalogSettings);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeJsonField("identity", this.identity);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedDevCenterUpdate.withTags(tags);
                } else if ("location".equals(fieldName)) {
                    deserializedDevCenterUpdate.withLocation(reader.getString());
                } else if ("identity".equals(fieldName)) {
                    deserializedDevCenterUpdate.identity = ManagedServiceIdentity.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedDevCenterUpdate.innerProperties = DevCenterUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDevCenterUpdate;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy