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

com.azure.resourcemanager.security.implementation.SecurityConnectorImpl Maven / Gradle / Ivy

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

package com.azure.resourcemanager.security.implementation;

import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.security.fluent.models.SecurityConnectorInner;
import com.azure.resourcemanager.security.models.CloudName;
import com.azure.resourcemanager.security.models.CloudOffering;
import com.azure.resourcemanager.security.models.EnvironmentData;
import com.azure.resourcemanager.security.models.SecurityConnector;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class SecurityConnectorImpl
    implements SecurityConnector, SecurityConnector.Definition, SecurityConnector.Update {
    private SecurityConnectorInner innerObject;

    private final com.azure.resourcemanager.security.SecurityManager 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 String hierarchyIdentifier() {
        return this.innerModel().hierarchyIdentifier();
    }

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

    public CloudName environmentName() {
        return this.innerModel().environmentName();
    }

    public List offerings() {
        List inner = this.innerModel().offerings();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public EnvironmentData environmentData() {
        return this.innerModel().environmentData();
    }

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

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

    private com.azure.resourcemanager.security.SecurityManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String securityConnectorName;

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

    public SecurityConnector create() {
        this.innerObject = serviceManager.serviceClient()
            .getSecurityConnectors()
            .createOrUpdateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public SecurityConnector create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getSecurityConnectors()
            .createOrUpdateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), context)
            .getValue();
        return this;
    }

    SecurityConnectorImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerObject = new SecurityConnectorInner();
        this.serviceManager = serviceManager;
        this.securityConnectorName = name;
    }

    public SecurityConnectorImpl update() {
        return this;
    }

    public SecurityConnector apply() {
        this.innerObject = serviceManager.serviceClient()
            .getSecurityConnectors()
            .updateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public SecurityConnector apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getSecurityConnectors()
            .updateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), context)
            .getValue();
        return this;
    }

    SecurityConnectorImpl(SecurityConnectorInner innerObject,
        com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.securityConnectorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "securityConnectors");
    }

    public SecurityConnector refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getSecurityConnectors()
            .getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, Context.NONE)
            .getValue();
        return this;
    }

    public SecurityConnector refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getSecurityConnectors()
            .getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, context)
            .getValue();
        return this;
    }

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

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

    public SecurityConnectorImpl withTags(Map tags) {
        this.innerModel().withTags(tags);
        return this;
    }

    public SecurityConnectorImpl withHierarchyIdentifier(String hierarchyIdentifier) {
        this.innerModel().withHierarchyIdentifier(hierarchyIdentifier);
        return this;
    }

    public SecurityConnectorImpl withEnvironmentName(CloudName environmentName) {
        this.innerModel().withEnvironmentName(environmentName);
        return this;
    }

    public SecurityConnectorImpl withOfferings(List offerings) {
        this.innerModel().withOfferings(offerings);
        return this;
    }

    public SecurityConnectorImpl withEnvironmentData(EnvironmentData environmentData) {
        this.innerModel().withEnvironmentData(environmentData);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy