function-storage コマンド

Cleanroomに保存される関数ディレクトリを管理するためのコマンド群です。

関数ディレクトリの仕様については ../../user-files/index を参照してください。

function-storage upload

関数ディレクトリをCleanroomにアップロードします。

使用方法

apc function-storage upload \
  --source <ソースディレクトリ> \
  --profile <プロファイル名>

apc function-storage upload \
  --source ./my-function \
  --profile acompany

アップロードした関数のIDである function-idFunctionStoragePath として出力されます。 このfunction-idは cleanroom deploy コマンドの --source オプションなどで使用します。

引数

なし

オプション

--profile <プロファイル名>

認証情報のプロファイル名を指定します。

--source <ソースディレクトリ>

関数ディレクトリのパスを指定します。

正常終了時の出力例
$ apc function-storage upload --source ./my-function --profile acompany
Uploading function with the following parameters:
    Source: ./my-function
Function uploaded successfully.
FunctionStoragePath: fs://0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw

# 既存の関数の場合
$ apc function-storage upload --source ./my-function --profile acompany
Uploading function with the following parameters:
    Source: ./my-function
Function already exists.
FunctionStoragePath: fs://0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw
異常終了時の出力例
# 存在しないディレクトリを指定した場合
$ apc function-storage upload --source ./nonexistent-function --profile acompany
Uploading function with the following parameters:
    Source: ./nonexistent-function
Error during function preparation: [Errno 2] No such file or directory: './nonexistent-function'

# 認証エラーの場合
$ apc function-storage upload --source ./my-function --profile invalid_profile
Exception: Authentication failed. Please check your credentials.

# サーバー接続エラーの場合
$ apc function-storage upload --source ./my-function --profile acompany
Exception: Connection failed. Please check your server configuration.

function-storage delete

Cleanroomから関数ディレクトリを削除します。

使用方法

apc function-storage delete <function-id> \
  --profile <プロファイル名>

apc function-storage delete 0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw \
  --profile acompany

引数

<function-id>

削除する関数のIDを指定します。

オプション

--profile <プロファイル名>

認証情報のプロファイル名を指定します。

正常終了時の出力例
$ apc function-storage delete 0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw --profile acompany
Deleting FunctionStorage:
    FunctionStoragePath: 0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw
Function deleted successfully.
異常終了時の出力例
# 存在しないfunction-idを指定した場合
$ apc function-storage delete nonexistent_function_id --profile acompany
Deleting FunctionStorage:
    FunctionStoragePath: nonexistent_function_id
Error during function deletion: Function not found

# 認証エラーの場合
$ apc function-storage delete 0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw --profile invalid_profile
Exception: Authentication failed. Please check your credentials.

# サーバー接続エラーの場合
$ apc function-storage delete 0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw --profile acompany
Exception: Connection failed. Please check your server configuration.

function-storage list

Cleanroom内の関数ディレクトリ一覧を表示します。

使用方法

apc function-storage list \
  --profile <プロファイル名>

apc function-storage list --profile acompany

引数

なし

オプション

--profile <プロファイル名>

認証情報のプロファイル名を指定します。

正常終了時の出力例
$ apc function-storage list --profile acompany
[
    {
        "function_storage_path": "fs://0qSLHMR-O5zFEi0upILG9wKZLZlaztAnwlEFAGN9FKw"
    },
    {
        "function_storage_path": "fs://1rTMINS-P6aGFj1vqJMH0xLaMabcuBowmfFBAHO0GLx"
    },
    {
        "function_storage_path": "fs://2sSNJOT-Q7bHGk2wrKNI1yMbNbcdvCpxngGCBIP1HMy"
    }
]
異常終了時の出力例
# 認証エラーの場合
$ apc function-storage list --profile invalid_profile
Exception: Authentication failed. Please check your credentials.

# サーバー接続エラーの場合
$ apc function-storage list --profile acompany
Exception: Connection failed. Please check your server configuration.

# 権限不足の場合
$ apc function-storage list --profile acompany
Exception: Access denied. Insufficient permissions to list functions.