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

com.azure.resourcemanager.servicebus.implementation.QueueAuthorizationRuleImpl 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

There is a newer version: 2.44.0
Show 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.RegenerateAccessKeyParameters;
import com.azure.resourcemanager.servicebus.models.QueueAuthorizationRule;
import reactor.core.publisher.Mono;

/**
 * Implementation for QueueAuthorizationRule.
 */
class QueueAuthorizationRuleImpl extends AuthorizationRuleBaseImpl
    implements
        QueueAuthorizationRule,
        QueueAuthorizationRule.Definition,
        QueueAuthorizationRule.Update {
    private final String namespaceName;

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

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy