// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.deploymentmanager.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.deploymentmanager.fluent.models.SasProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Defines the properties to access the artifacts using an Azure Storage SAS URI. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("Sas")
@Fluent
public final class SasAuthentication extends Authentication {
    /*
     * The SAS properties
     */
    @JsonProperty(value = "properties")
    private SasProperties innerProperties;

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

    /**
     * Get the innerProperties property: The SAS properties.
     *
     * @return the innerProperties value.
     */
    private SasProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the sasUri property: The SAS URI to the Azure Storage blob container. Any offset from the root of the
     * container to where the artifacts are located can be defined in the artifactRoot.
     *
     * @return the sasUri value.
     */
    public String sasUri() {
        return this.innerProperties() == null ? null : this.innerProperties().sasUri();
    }

    /**
     * Set the sasUri property: The SAS URI to the Azure Storage blob container. Any offset from the root of the
     * container to where the artifacts are located can be defined in the artifactRoot.
     *
     * @param sasUri the sasUri value to set.
     * @return the SasAuthentication object itself.
     */
    public SasAuthentication withSasUri(String sasUri) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SasProperties();
        }
        this.innerProperties().withSasUri(sasUri);
        return this;
    }

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