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

com.azure.resourcemanager.eventgrid.implementation.PartnerDestinationImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for EventGrid Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure EventGrid Management Client. Package tag package-2021-10-preview.

There is a newer version: 1.2.0-beta.7
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.eventgrid.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.PartnerDestinationInner;
import com.azure.resourcemanager.eventgrid.models.PartnerDestination;
import com.azure.resourcemanager.eventgrid.models.PartnerDestinationActivationState;
import com.azure.resourcemanager.eventgrid.models.PartnerDestinationProvisioningState;
import com.azure.resourcemanager.eventgrid.models.PartnerDestinationUpdateParameters;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;

public final class PartnerDestinationImpl
    implements PartnerDestination, PartnerDestination.Definition, PartnerDestination.Update {
    private PartnerDestinationInner innerObject;

    private final com.azure.resourcemanager.eventgrid.EventGridManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public String location() {
        return this.innerModel().location();
    }

    public Map tags() {
        Map inner = this.innerModel().tags();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public UUID partnerRegistrationImmutableId() {
        return this.innerModel().partnerRegistrationImmutableId();
    }

    public String endpointServiceContext() {
        return this.innerModel().endpointServiceContext();
    }

    public OffsetDateTime expirationTimeIfNotActivatedUtc() {
        return this.innerModel().expirationTimeIfNotActivatedUtc();
    }

    public PartnerDestinationProvisioningState provisioningState() {
        return this.innerModel().provisioningState();
    }

    public PartnerDestinationActivationState activationState() {
        return this.innerModel().activationState();
    }

    public String endpointBaseUrl() {
        return this.innerModel().endpointBaseUrl();
    }

    public String messageForActivation() {
        return this.innerModel().messageForActivation();
    }

    public Region region() {
        return Region.fromName(this.regionName());
    }

    public String regionName() {
        return this.location();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public PartnerDestinationInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.eventgrid.EventGridManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String partnerDestinationName;

    private PartnerDestinationUpdateParameters updatePartnerDestinationUpdateParameters;

    public PartnerDestinationImpl withExistingResourceGroup(String resourceGroupName) {
        this.resourceGroupName = resourceGroupName;
        return this;
    }

    public PartnerDestination create() {
        this.innerObject = serviceManager.serviceClient()
            .getPartnerDestinations()
            .createOrUpdate(resourceGroupName, partnerDestinationName, this.innerModel(), Context.NONE);
        return this;
    }

    public PartnerDestination create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getPartnerDestinations()
            .createOrUpdate(resourceGroupName, partnerDestinationName, this.innerModel(), context);
        return this;
    }

    PartnerDestinationImpl(String name, com.azure.resourcemanager.eventgrid.EventGridManager serviceManager) {
        this.innerObject = new PartnerDestinationInner();
        this.serviceManager = serviceManager;
        this.partnerDestinationName = name;
    }

    public PartnerDestinationImpl update() {
        this.updatePartnerDestinationUpdateParameters = new PartnerDestinationUpdateParameters();
        return this;
    }

    public PartnerDestination apply() {
        this.innerObject = serviceManager.serviceClient()
            .getPartnerDestinations()
            .update(resourceGroupName, partnerDestinationName, updatePartnerDestinationUpdateParameters, Context.NONE);
        return this;
    }

    public PartnerDestination apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getPartnerDestinations()
            .update(resourceGroupName, partnerDestinationName, updatePartnerDestinationUpdateParameters, context);
        return this;
    }

    PartnerDestinationImpl(PartnerDestinationInner innerObject,
        com.azure.resourcemanager.eventgrid.EventGridManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.partnerDestinationName
            = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "partnerDestinations");
    }

    public PartnerDestination refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getPartnerDestinations()
            .getByResourceGroupWithResponse(resourceGroupName, partnerDestinationName, Context.NONE)
            .getValue();
        return this;
    }

    public PartnerDestination refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getPartnerDestinations()
            .getByResourceGroupWithResponse(resourceGroupName, partnerDestinationName, context)
            .getValue();
        return this;
    }

    public Response activateWithResponse(Context context) {
        return serviceManager.partnerDestinations()
            .activateWithResponse(resourceGroupName, partnerDestinationName, context);
    }

    public PartnerDestination activate() {
        return serviceManager.partnerDestinations().activate(resourceGroupName, partnerDestinationName);
    }

    public PartnerDestinationImpl withRegion(Region location) {
        this.innerModel().withLocation(location.toString());
        return this;
    }

    public PartnerDestinationImpl withRegion(String location) {
        this.innerModel().withLocation(location);
        return this;
    }

    public PartnerDestinationImpl withTags(Map tags) {
        if (isInCreateMode()) {
            this.innerModel().withTags(tags);
            return this;
        } else {
            this.updatePartnerDestinationUpdateParameters.withTags(tags);
            return this;
        }
    }

    public PartnerDestinationImpl withPartnerRegistrationImmutableId(UUID partnerRegistrationImmutableId) {
        this.innerModel().withPartnerRegistrationImmutableId(partnerRegistrationImmutableId);
        return this;
    }

    public PartnerDestinationImpl withEndpointServiceContext(String endpointServiceContext) {
        this.innerModel().withEndpointServiceContext(endpointServiceContext);
        return this;
    }

    public PartnerDestinationImpl withExpirationTimeIfNotActivatedUtc(OffsetDateTime expirationTimeIfNotActivatedUtc) {
        this.innerModel().withExpirationTimeIfNotActivatedUtc(expirationTimeIfNotActivatedUtc);
        return this;
    }

    public PartnerDestinationImpl withActivationState(PartnerDestinationActivationState activationState) {
        this.innerModel().withActivationState(activationState);
        return this;
    }

    public PartnerDestinationImpl withEndpointBaseUrl(String endpointBaseUrl) {
        this.innerModel().withEndpointBaseUrl(endpointBaseUrl);
        return this;
    }

    public PartnerDestinationImpl withMessageForActivation(String messageForActivation) {
        this.innerModel().withMessageForActivation(messageForActivation);
        return this;
    }

    private boolean isInCreateMode() {
        return this.innerModel().id() == null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy