com.microsoft.azure.management.sql.implementation.SqlChildrenOperationsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-sql Show documentation
Show all versions of azure-mgmt-sql Show documentation
This package contains Microsoft Azure Sql Management SDK. A new set of management libraries are now Generally Available. For documentation on how to use the new libraries, please see https://aka.ms/azsdk/java/mgmt
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.management.sql.implementation;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.sql.SqlChildrenOperations;
import com.microsoft.azure.management.sql.SqlServer;
import rx.Completable;
import rx.Observable;
import java.util.List;
import java.util.Objects;
/**
* Implementation for SQL Server children operations.
*
* @param the fluent model type of the child resource
*/
@LangDefinition
public abstract class SqlChildrenOperationsImpl
implements
SqlChildrenOperations,
SqlChildrenOperations.SqlChildrenActionsDefinition {
protected SqlServerManager sqlServerManager;
protected SqlServer sqlServer;
SqlChildrenOperationsImpl(SqlServer parent, SqlServerManager sqlServerManager) {
Objects.requireNonNull(sqlServerManager);
this.sqlServer = parent;
this.sqlServerManager = sqlServerManager;
}
@Override
public FluentModelT get(String name) {
if (this.sqlServer == null) {
return null;
}
return this.getBySqlServer(this.sqlServer, name);
}
@Override
public Observable getAsync(String name) {
if (this.sqlServer == null) {
return null;
}
return this.getBySqlServerAsync(this.sqlServer, name);
}
@Override
public FluentModelT getById(String id) {
Objects.requireNonNull(id);
return this.getBySqlServer(ResourceUtils.groupFromResourceId(id),
ResourceUtils.nameFromResourceId(ResourceUtils.parentRelativePathFromResourceId(id)),
ResourceUtils.nameFromResourceId(id));
}
@Override
public Observable getByIdAsync(String id) {
Objects.requireNonNull(id);
return this.getBySqlServerAsync(ResourceUtils.groupFromResourceId(id),
ResourceUtils.nameFromResourceId(ResourceUtils.parentRelativePathFromResourceId(id)),
ResourceUtils.nameFromResourceId(id));
}
@Override
public void delete(String name) {
if (this.sqlServer != null) {
this.deleteBySqlServer(this.sqlServer.resourceGroupName(), this.sqlServer.name(), name);
}
}
@Override
public Completable deleteAsync(String name) {
if (this.sqlServer == null) {
return null;
}
return this.deleteBySqlServerAsync(this.sqlServer.resourceGroupName(), this.sqlServer.name(), name);
}
@Override
public void deleteById(String id) {
Objects.requireNonNull(id);
this.deleteBySqlServer(ResourceUtils.groupFromResourceId(id),
ResourceUtils.nameFromResourceId(ResourceUtils.parentRelativePathFromResourceId(id)),
ResourceUtils.nameFromResourceId(id));
}
@Override
public Completable deleteByIdAsync(String id) {
Objects.requireNonNull(id);
return this.deleteBySqlServerAsync(ResourceUtils.groupFromResourceId(id),
ResourceUtils.nameFromResourceId(ResourceUtils.parentRelativePathFromResourceId(id)),
ResourceUtils.nameFromResourceId(id));
}
@Override
public List list() {
if (this.sqlServer == null) {
return null;
}
return this.listBySqlServer(this.sqlServer);
}
@Override
public Observable listAsync() {
if (sqlServer == null) {
return null;
}
return this.listBySqlServerAsync(this.sqlServer);
}
}