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

com.azure.resourcemanager.servicebus.implementation.NamespaceAuthorizationRuleImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure ServiceBus Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.servicebus.implementation;

import com.azure.resourcemanager.servicebus.ServiceBusManager;
import com.azure.resourcemanager.servicebus.fluent.models.AccessKeysInner;
import com.azure.resourcemanager.servicebus.fluent.models.SBAuthorizationRuleInner;
import com.azure.resourcemanager.servicebus.models.NamespaceAuthorizationRule;
import com.azure.resourcemanager.servicebus.models.RegenerateAccessKeyParameters;
import reactor.core.publisher.Mono;

/**
 * Implementation for NamespaceAuthorizationRule.
 */
class NamespaceAuthorizationRuleImpl extends
    AuthorizationRuleBaseImpl
    implements NamespaceAuthorizationRule, NamespaceAuthorizationRule.Definition, NamespaceAuthorizationRule.Update {

    NamespaceAuthorizationRuleImpl(String resourceGroupName, String namespaceName, String name,
        SBAuthorizationRuleInner inner, ServiceBusManager manager) {
        super(name, inner, manager);
        this.withExistingParentResource(resourceGroupName, namespaceName);
    }

    @Override
    public String namespaceName() {
        return this.parentName;
    }

    @Override
    protected Mono getInnerAsync() {
        return this.manager()
            .serviceClient()
            .getNamespaces()
            .getAuthorizationRuleAsync(this.resourceGroupName(), this.namespaceName(), this.name());
    }

    @Override
    protected Mono createChildResourceAsync() {
        final NamespaceAuthorizationRule self = this;
        return this.manager()
            .serviceClient()
            .getNamespaces()
            .createOrUpdateAuthorizationRuleAsync(this.resourceGroupName(), this.namespaceName(), this.name(),
                this.innerModel())
            .map(inner -> {
                setInner(inner);
                return self;
            });
    }

    @Override
    protected Mono getKeysInnerAsync() {
        return this.manager()
            .serviceClient()
            .getNamespaces()
            .listKeysAsync(this.resourceGroupName(), this.namespaceName(), this.name());
    }

    @Override
    protected Mono
        regenerateKeysInnerAsync(RegenerateAccessKeyParameters regenerateAccessKeyParameters) {
        return this.manager()
            .serviceClient()
            .getNamespaces()
            .regenerateKeysAsync(this.resourceGroupName(), this.namespaceName(), this.name(),
                regenerateAccessKeyParameters);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy