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

com.coreos.jetcd.Auth Maven / Gradle / Ivy

There is a newer version: 0.0.2
Show newest version
/**
 * Copyright 2017 The jetcd authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.coreos.jetcd;

import com.coreos.jetcd.auth.AuthDisableResponse;
import com.coreos.jetcd.auth.AuthEnableResponse;
import com.coreos.jetcd.auth.AuthRoleAddResponse;
import com.coreos.jetcd.auth.AuthRoleDeleteResponse;
import com.coreos.jetcd.auth.AuthRoleGetResponse;
import com.coreos.jetcd.auth.AuthRoleGrantPermissionResponse;
import com.coreos.jetcd.auth.AuthRoleListResponse;
import com.coreos.jetcd.auth.AuthRoleRevokePermissionResponse;
import com.coreos.jetcd.auth.AuthUserAddResponse;
import com.coreos.jetcd.auth.AuthUserChangePasswordResponse;
import com.coreos.jetcd.auth.AuthUserDeleteResponse;
import com.coreos.jetcd.auth.AuthUserGetResponse;
import com.coreos.jetcd.auth.AuthUserGrantRoleResponse;
import com.coreos.jetcd.auth.AuthUserListResponse;
import com.coreos.jetcd.auth.AuthUserRevokeRoleResponse;
import com.coreos.jetcd.auth.Permission;
import com.coreos.jetcd.data.ByteSequence;
import com.coreos.jetcd.internal.impl.CloseableClient;
import java.util.concurrent.CompletableFuture;

/**
 * Interface of auth talking to etcd.
 */
public interface Auth extends CloseableClient {

  /**
   * enables auth of an etcd cluster.
   */
  CompletableFuture authEnable();

  /**
   * disables auth of an etcd cluster.
   */
  CompletableFuture authDisable();

  /**
   * adds a new user to an etcd cluster.
   */
  CompletableFuture userAdd(ByteSequence user, ByteSequence password);

  /**
   * deletes a user from an etcd cluster.
   */
  CompletableFuture userDelete(ByteSequence user);

  /**
   * changes a password of a user.
   */
  CompletableFuture userChangePassword(ByteSequence user,
      ByteSequence password);

  /**
   * gets a detailed information of a user.
   */
  CompletableFuture userGet(ByteSequence user);

  /**
   * gets a list of all users.
   */
  CompletableFuture userList();

  /**
   * grants a role to a user.
   */
  CompletableFuture userGrantRole(ByteSequence user, ByteSequence role);

  /**
   * revokes a role of a user.
   */
  CompletableFuture userRevokeRole(ByteSequence user,
      ByteSequence role);

  /**
   * adds a new role to an etcd cluster.
   */
  CompletableFuture roleAdd(ByteSequence user);

  /**
   * grants a permission to a role.
   */
  CompletableFuture roleGrantPermission(ByteSequence role,
      ByteSequence key,
      ByteSequence rangeEnd, Permission.Type permType);

  /**
   * gets a detailed information of a role.
   */
  CompletableFuture roleGet(ByteSequence role);

  /**
   * gets a list of all roles.
   */
  CompletableFuture roleList();

  /**
   * revokes a permission from a role.
   */
  CompletableFuture roleRevokePermission(ByteSequence role,
      ByteSequence key,
      ByteSequence rangeEnd);

  /**
   * RoleDelete deletes a role.
   */
  CompletableFuture roleDelete(ByteSequence role);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy