X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-cluster-admin-karaf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fadmin%2Fcommand%2FRemoveShardReplicaCommand.java;fp=opendaylight%2Fmd-sal%2Fsal-cluster-admin-karaf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fadmin%2Fcommand%2FRemoveShardReplicaCommand.java;h=e4a786432b7af6195202ed1697af85e2118c10be;hb=40fd067185aafea2a7da7e4fd0b1111dc2bbb9bd;hp=0000000000000000000000000000000000000000;hpb=3404a29b4ee3b146a5ff98889bcf1afdebb65c3f;p=controller.git diff --git a/opendaylight/md-sal/sal-cluster-admin-karaf-cli/src/main/java/org/opendaylight/controller/cluster/datastore/admin/command/RemoveShardReplicaCommand.java b/opendaylight/md-sal/sal-cluster-admin-karaf-cli/src/main/java/org/opendaylight/controller/cluster/datastore/admin/command/RemoveShardReplicaCommand.java new file mode 100644 index 0000000000..e4a786432b --- /dev/null +++ b/opendaylight/md-sal/sal-cluster-admin-karaf-cli/src/main/java/org/opendaylight/controller/cluster/datastore/admin/command/RemoveShardReplicaCommand.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.admin.command; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ClusterAdminService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.DataStoreType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveShardReplicaInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "cluster-admin", name = "remove-shard-replica", description = "Run a remove-shard-replica") +public class RemoveShardReplicaCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcConsumerRegistry; + @Argument(index = 0, name = "shard-name", required = true) + private String shardName; + @Argument(index = 1, name = "data-store-type", required = true, description = "config / operational") + private String dataStoreType; + @Argument(index = 2, name = "member-name", required = true) + private String memberName; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcConsumerRegistry.getRpcService(ClusterAdminService.class) + .removeShardReplica(new RemoveShardReplicaInputBuilder() + .setShardName(shardName) + .setDataStoreType(DataStoreType.forName(dataStoreType).orElse(null)) + .setMemberName(memberName) + .build()); + } +}