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

package com.azure.resourcemanager.relay.models;

import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.resourcemanager.relay.fluent.models.AuthorizationRuleInner;
import java.util.List;

/** An immutable client-side representation of AuthorizationRule. */
public interface AuthorizationRule {
    /**
     * Gets the id property: Fully qualified resource Id for the resource.
     *
     * @return the id value.
     */
    String id();

    /**
     * Gets the name property: The name of the resource.
     *
     * @return the name value.
     */
    String name();

    /**
     * Gets the type property: The type of the resource.
     *
     * @return the type value.
     */
    String type();

    /**
     * Gets the rights property: The rights associated with the rule.
     *
     * @return the rights value.
     */
    List<AccessRights> rights();

    /**
     * Gets the name of the resource group.
     *
     * @return the name of the resource group.
     */
    String resourceGroupName();

    /**
     * Gets the inner com.azure.resourcemanager.relay.fluent.models.AuthorizationRuleInner object.
     *
     * @return the inner object.
     */
    AuthorizationRuleInner innerModel();

    /** The entirety of the AuthorizationRule definition. */
    interface Definition
        extends DefinitionStages.Blank,
            DefinitionStages.WithParentResource,
            DefinitionStages.WithRights,
            DefinitionStages.WithCreate {
    }
    /** The AuthorizationRule definition stages. */
    interface DefinitionStages {
        /** The first stage of the AuthorizationRule definition. */
        interface Blank extends WithParentResource {
        }
        /** The stage of the AuthorizationRule definition allowing to specify parent resource. */
        interface WithParentResource {
            /**
             * Specifies resourceGroupName, namespaceName.
             *
             * @param resourceGroupName Name of the Resource group within the Azure subscription.
             * @param namespaceName The namespace name.
             * @return the next definition stage.
             */
            WithRights withExistingNamespace(String resourceGroupName, String namespaceName);
        }
        /** The stage of the AuthorizationRule definition allowing to specify rights. */
        interface WithRights {
            /**
             * Specifies the rights property: The rights associated with the rule..
             *
             * @param rights The rights associated with the rule.
             * @return the next definition stage.
             */
            WithCreate withRights(List<AccessRights> rights);
        }
        /**
         * The stage of the AuthorizationRule definition which contains all the minimum required properties for the
         * resource to be created, but also allows for any other optional properties to be specified.
         */
        interface WithCreate {
            /**
             * Executes the create request.
             *
             * @return the created resource.
             */
            AuthorizationRule create();

            /**
             * Executes the create request.
             *
             * @param context The context to associate with this operation.
             * @return the created resource.
             */
            AuthorizationRule create(Context context);
        }
    }
    /**
     * Begins update for the AuthorizationRule resource.
     *
     * @return the stage of resource update.
     */
    AuthorizationRule.Update update();

    /** The template for AuthorizationRule update. */
    interface Update extends UpdateStages.WithRights {
        /**
         * Executes the update request.
         *
         * @return the updated resource.
         */
        AuthorizationRule apply();

        /**
         * Executes the update request.
         *
         * @param context The context to associate with this operation.
         * @return the updated resource.
         */
        AuthorizationRule apply(Context context);
    }
    /** The AuthorizationRule update stages. */
    interface UpdateStages {
        /** The stage of the AuthorizationRule update allowing to specify rights. */
        interface WithRights {
            /**
             * Specifies the rights property: The rights associated with the rule..
             *
             * @param rights The rights associated with the rule.
             * @return the next definition stage.
             */
            Update withRights(List<AccessRights> rights);
        }
    }
    /**
     * Refreshes the resource to sync with Azure.
     *
     * @return the refreshed resource.
     */
    AuthorizationRule refresh();

    /**
     * Refreshes the resource to sync with Azure.
     *
     * @param context The context to associate with this operation.
     * @return the refreshed resource.
     */
    AuthorizationRule refresh(Context context);

    /**
     * Primary and secondary connection strings to the namespace.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return namespace/Relay Connection String.
     */
    AccessKeys listKeys();

    /**
     * Primary and secondary connection strings to the namespace.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return namespace/Relay Connection String along with {@link Response}.
     */
    Response<AccessKeys> listKeysWithResponse(Context context);

    /**
     * Regenerates the primary or secondary connection strings to the namespace.
     *
     * @param parameters Parameters supplied to regenerate authorization rule.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return namespace/Relay Connection String.
     */
    AccessKeys regenerateKeys(RegenerateAccessKeyParameters parameters);

    /**
     * Regenerates the primary or secondary connection strings to the namespace.
     *
     * @param parameters Parameters supplied to regenerate authorization rule.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return namespace/Relay Connection String along with {@link Response}.
     */
    Response<AccessKeys> regenerateKeysWithResponse(RegenerateAccessKeyParameters parameters, Context context);
}
