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

com.azure.resourcemanager.resources.models.DeploymentStacksTemplateLink 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.resources.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;

/**
 * Entity representing the reference to the template.
 */
@Fluent
public final class DeploymentStacksTemplateLink implements JsonSerializable {
    /*
     * The URI of the template to deploy. Use either the uri or id property, but not both.
     */
    private String uri;

    /*
     * The resourceId of a Template Spec. Use either the id or uri property, but not both.
     */
    private String id;

    /*
     * The relativePath property can be used to deploy a linked template at a location relative to the parent. If the
     * parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the
     * parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs.
     */
    private String relativePath;

    /*
     * The query string (for example, a SAS token) to be used with the templateLink URI.
     */
    private String queryString;

    /*
     * If included, must match the ContentVersion in the template.
     */
    private String contentVersion;

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

    /**
     * Get the uri property: The URI of the template to deploy. Use either the uri or id property, but not both.
     * 
     * @return the uri value.
     */
    public String uri() {
        return this.uri;
    }

    /**
     * Set the uri property: The URI of the template to deploy. Use either the uri or id property, but not both.
     * 
     * @param uri the uri value to set.
     * @return the DeploymentStacksTemplateLink object itself.
     */
    public DeploymentStacksTemplateLink withUri(String uri) {
        this.uri = uri;
        return this;
    }

    /**
     * Get the id property: The resourceId of a Template Spec. Use either the id or uri property, but not both.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: The resourceId of a Template Spec. Use either the id or uri property, but not both.
     * 
     * @param id the id value to set.
     * @return the DeploymentStacksTemplateLink object itself.
     */
    public DeploymentStacksTemplateLink withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the relativePath property: The relativePath property can be used to deploy a linked template at a location
     * relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in
     * the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent
     * and relativePath URIs.
     * 
     * @return the relativePath value.
     */
    public String relativePath() {
        return this.relativePath;
    }

    /**
     * Set the relativePath property: The relativePath property can be used to deploy a linked template at a location
     * relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in
     * the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent
     * and relativePath URIs.
     * 
     * @param relativePath the relativePath value to set.
     * @return the DeploymentStacksTemplateLink object itself.
     */
    public DeploymentStacksTemplateLink withRelativePath(String relativePath) {
        this.relativePath = relativePath;
        return this;
    }

    /**
     * Get the queryString property: The query string (for example, a SAS token) to be used with the templateLink URI.
     * 
     * @return the queryString value.
     */
    public String queryString() {
        return this.queryString;
    }

    /**
     * Set the queryString property: The query string (for example, a SAS token) to be used with the templateLink URI.
     * 
     * @param queryString the queryString value to set.
     * @return the DeploymentStacksTemplateLink object itself.
     */
    public DeploymentStacksTemplateLink withQueryString(String queryString) {
        this.queryString = queryString;
        return this;
    }

    /**
     * Get the contentVersion property: If included, must match the ContentVersion in the template.
     * 
     * @return the contentVersion value.
     */
    public String contentVersion() {
        return this.contentVersion;
    }

    /**
     * Set the contentVersion property: If included, must match the ContentVersion in the template.
     * 
     * @param contentVersion the contentVersion value to set.
     * @return the DeploymentStacksTemplateLink object itself.
     */
    public DeploymentStacksTemplateLink withContentVersion(String contentVersion) {
        this.contentVersion = contentVersion;
        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("uri", this.uri);
        jsonWriter.writeStringField("id", this.id);
        jsonWriter.writeStringField("relativePath", this.relativePath);
        jsonWriter.writeStringField("queryString", this.queryString);
        jsonWriter.writeStringField("contentVersion", this.contentVersion);
        return jsonWriter.writeEndObject();
    }

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

                if ("uri".equals(fieldName)) {
                    deserializedDeploymentStacksTemplateLink.uri = reader.getString();
                } else if ("id".equals(fieldName)) {
                    deserializedDeploymentStacksTemplateLink.id = reader.getString();
                } else if ("relativePath".equals(fieldName)) {
                    deserializedDeploymentStacksTemplateLink.relativePath = reader.getString();
                } else if ("queryString".equals(fieldName)) {
                    deserializedDeploymentStacksTemplateLink.queryString = reader.getString();
                } else if ("contentVersion".equals(fieldName)) {
                    deserializedDeploymentStacksTemplateLink.contentVersion = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDeploymentStacksTemplateLink;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy