
com.azure.resourcemanager.databricks.implementation.AccessConnectorImpl 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.databricks.implementation;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner;
import com.azure.resourcemanager.databricks.models.AccessConnector;
import com.azure.resourcemanager.databricks.models.AccessConnectorProperties;
import com.azure.resourcemanager.databricks.models.AccessConnectorUpdate;
import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity;
import java.util.Collections;
import java.util.Map;
public final class AccessConnectorImpl implements AccessConnector, AccessConnector.Definition, AccessConnector.Update {
private AccessConnectorInner innerObject;
private final com.azure.resourcemanager.databricks.AzureDatabricksManager 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 ManagedServiceIdentity identity() {
return this.innerModel().identity();
}
public SystemData systemData() {
return this.innerModel().systemData();
}
public AccessConnectorProperties properties() {
return this.innerModel().properties();
}
public Region region() {
return Region.fromName(this.regionName());
}
public String regionName() {
return this.location();
}
public String resourceGroupName() {
return resourceGroupName;
}
public AccessConnectorInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.databricks.AzureDatabricksManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String connectorName;
private AccessConnectorUpdate updateParameters;
public AccessConnectorImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public AccessConnector create() {
this.innerObject = serviceManager.serviceClient()
.getAccessConnectors()
.createOrUpdate(resourceGroupName, connectorName, this.innerModel(), Context.NONE);
return this;
}
public AccessConnector create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getAccessConnectors()
.createOrUpdate(resourceGroupName, connectorName, this.innerModel(), context);
return this;
}
AccessConnectorImpl(String name, com.azure.resourcemanager.databricks.AzureDatabricksManager serviceManager) {
this.innerObject = new AccessConnectorInner();
this.serviceManager = serviceManager;
this.connectorName = name;
}
public AccessConnectorImpl update() {
this.updateParameters = new AccessConnectorUpdate();
return this;
}
public AccessConnector apply() {
this.innerObject = serviceManager.serviceClient()
.getAccessConnectors()
.update(resourceGroupName, connectorName, updateParameters, Context.NONE);
return this;
}
public AccessConnector apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getAccessConnectors()
.update(resourceGroupName, connectorName, updateParameters, context);
return this;
}
AccessConnectorImpl(AccessConnectorInner innerObject,
com.azure.resourcemanager.databricks.AzureDatabricksManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.connectorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accessConnectors");
}
public AccessConnector refresh() {
this.innerObject = serviceManager.serviceClient()
.getAccessConnectors()
.getByResourceGroupWithResponse(resourceGroupName, connectorName, Context.NONE)
.getValue();
return this;
}
public AccessConnector refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getAccessConnectors()
.getByResourceGroupWithResponse(resourceGroupName, connectorName, context)
.getValue();
return this;
}
public AccessConnectorImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public AccessConnectorImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public AccessConnectorImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateParameters.withTags(tags);
return this;
}
}
public AccessConnectorImpl withIdentity(ManagedServiceIdentity identity) {
if (isInCreateMode()) {
this.innerModel().withIdentity(identity);
return this;
} else {
this.updateParameters.withIdentity(identity);
return this;
}
}
public AccessConnectorImpl withProperties(AccessConnectorProperties properties) {
this.innerModel().withProperties(properties);
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy