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

com.microsoft.azure.toolkit.lib.cosmos.cassandra.CassandraKeyspace Maven / Gradle / Ivy

The newest version!
/*
 * 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.toolkit.lib.cosmos.cassandra;

import com.azure.resourcemanager.cosmos.fluent.models.CassandraKeyspaceGetResultsInner;
import com.microsoft.azure.toolkit.lib.common.model.AbstractAzResource;
import com.microsoft.azure.toolkit.lib.common.model.AbstractAzResourceModule;
import com.microsoft.azure.toolkit.lib.common.model.Deletable;
import com.microsoft.azure.toolkit.lib.common.model.Region;
import com.microsoft.azure.toolkit.lib.cosmos.CosmosDBAccount;
import com.microsoft.azure.toolkit.lib.cosmos.ICosmosCollection;
import com.microsoft.azure.toolkit.lib.cosmos.ICosmosDatabase;

import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;

public class CassandraKeyspace extends AbstractAzResource implements Deletable, ICosmosDatabase {

    private final CassandraTableModule containerModule;

    protected CassandraKeyspace(@Nonnull String name, @Nonnull String resourceGroupName, @Nonnull CassandraKeyspaceModule module) {
        super(name, resourceGroupName, module);
        this.containerModule = new CassandraTableModule(this);
    }

    protected CassandraKeyspace(@Nonnull CassandraKeyspace account) {
        super(account);
        this.containerModule = new CassandraTableModule(this);
    }

    protected CassandraKeyspace(@Nonnull CassandraKeyspaceGetResultsInner remote, @Nonnull CassandraKeyspaceModule module) {
        super(remote.name(), module);
        this.containerModule = new CassandraTableModule(this);
    }

    @Nonnull
    @Override
    public List> getSubModules() {
        return Collections.singletonList(containerModule);
    }

    public Region getRegion() {
        return getParent().getRegion();
    }

    public CassandraTableModule tables() {
        return this.containerModule;
    }

    @Nonnull
    @Override
    protected String loadStatus(@Nonnull CassandraKeyspaceGetResultsInner remote) {
        return Status.RUNNING;
    }

    @Override
    public List listCollection() {
        return tables().list();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy