跳转到主要内容

Stacklet平台客户端

项目描述

Stacklet CLI

安装

$ pip install stacklet.client.platform

配置

要开始,使用auto-configure命令通过提供与Stacklet平台实例相关的前缀或URL来初始化CLI配置

# Using a complete console URL
stacklet-admin auto-configure --url https://console.myorg.stacklet.io

# Using a base domain
stacklet-admin auto-configure --url myorg.stacklet.io

# Using just a deployment prefix (assumes a .stacklet.io suffix)
stacklet-admin auto-configure --prefix myorg

这将在~/.stacklet/config.json中创建一个配置文件。

登录

使用单点登录

使用不带参数的login命令开始SSO登录

stacklet-admin login

这将在浏览器中打开一个窗口并通过SSO登录。登录成功后,窗口可能会自动关闭。

不使用单点登录

login命令提供用户名以绕过SSO

stacklet-admin login --username test-user

这会提示输入密码。也可以使用--password参数来避免提示,但这是一种不太安全的选择,因为它可以通过命令历史和进程列表暴露密码。

运行命令

命令被分组到命令组中,例如,可以通过运行以下命令找到所有与帐户相关的命令

stacklet-admin account --help
Usage: stacklet-admin account [OPTIONS] COMMAND [ARGS]...

  Query against and Run mutations against Account objects in Stacklet.

  Define a custom config file with the --config option

  Specify a different output format with the --output option

  Example:

      $ stacklet account --output json list

Options:
  -v                           Verbosity level, increase verbosity by
                               appending v, e.g. -vvv

  --api TEXT                   If set, --cognito-user-pool-id, --cognito-
                               client-id, --cognito-region, and --api must
                               also be set.

  --cognito-region TEXT        If set, --cognito-user-pool-id, --cognito-
                               client-id, --cognito-region, and --api must
                               also be set.

  --cognito-client-id TEXT     If set, --cognito-user-pool-id, --cognito-
                               client-id, --cognito-region, and --api must
                               also be set.

  --cognito-user-pool-id TEXT  If set, --cognito-user-pool-id, --cognito-
                               client-id, --cognito-region, and --api must
                               also be set.

  --output [|plain|json|yaml]  Ouput type
  --config TEXT
  --help                       Show this message and exit.

Commands:
  add     Add an account to Stacklet
  list    List cloud accounts in Stacklet
  remove  Remove an account from Stacklet
  show    Show an account in Stacklet

然后运行命令

stacklet-admin account list
data:
  accounts:
    edges:
    - node:
        description: null
        email: sonny@stacklet.io
        id: account:aws:123456789012
        key: '123456789012'
        name: Sandbox Sonny
        path: null
        provider: AWS
        securityContext: arn:aws:iam::123456789012:role/dev-stacklet-execution
        shortName: null
        tags: null
        variables: null
    pageInfo:
      endCursor: eJxTMlQCAADtAHY=
      hasNextPage: false
      hasPreviousPage: false
      startCursor: eJxTMlQCAADtAHY=

分页

对于使用分页的命令,可以通过运行以下命令来选择下一页

stacklet-admin account list --after "eJxTMlQCAADtAHY="
data:
  accounts:
    edges: []
    pageInfo:
      endCursor: ''
      hasNextPage: false
      hasPreviousPage: true
      startCursor: ''

--after 的值应该是响应中 pageInfo 部分下的 endCursor 键的值。对于多页结果,继续使用 endCursor 值来遍历页面。此外,使用 --before 选项来返回上一页。

--first--last 是用于选择响应中前 n 个或后 n 个结果的数字选项。例如,要返回第一个账户

stacklet-admin account list --first 1

返回最后一个账户

stacklet-admin account list --last 1

开发

安装

$ just install

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

stacklet_client_platform-0.1.4.tar.gz (27.9 kB 查看哈希值)

上传时间

构建分布

stacklet_client_platform-0.1.4-py3-none-any.whl (38.6 kB 查看哈希值)

上传时间 Python 3

由以下组织支持