選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

將密碼元件新增至藍圖

焦點模式

在本頁面

將密碼元件新增至藍圖 - Amazon CodeCatalyst

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

密碼可用於儲存 CodeCatalyst 可在工作流程中參照的敏感資料。您可以將密碼新增至自訂藍圖,並在工作流程中參考它。如需詳細資訊,請參閱 使用秘密遮罩資料

若要匯入 Amazon CodeCatalyst 藍圖區域類型

在您的blueprint.ts檔案中,新增下列內容:

import { Secret, SecretDefinition } from '@amazon-codecatalyst/blueprint-component.secrets'

建立密碼

下列範例會建立 UI 元件,提示使用者輸入密碼值和選用說明:

export interface Options extends ParentOptions { ... mySecret: SecretDefinition; } export class Blueprint extends ParentBlueprint { constructor(options_: Options) { new Secret(this, options.secret); }

秘密元件需要name. 下面的代碼是所需的最小默認形狀:

{ ... "secret": { "name": "secretName" }, }

參考工作流程中的密碼

下列範例藍圖會建立機密和參考密碼值的工作流程。如需詳細資訊,請參閱 在工作流程中參考秘密

export interface Options extends ParentOptions { ... /** * * @validationRegex /^\w+$/ */ username: string; password: SecretDefinition; } export class Blueprint extends ParentBlueprint { constructor(options_: Options) { const password = new Secret(this, options_.password); const workflowBuilder = new WorkflowBuilder(this, { Name: 'my_workflow', }); workflowBuilder.addBuildAction({ actionName: 'download_files', input: { Sources: ['WorkflowSource'], }, output: { Artifacts: [{ Name: 'download', Files: ['file1'] }], }, steps: [ `curl -u ${options_.username}:${password.reference} https://example.com`, ], }); new Workflow( this, repo, workflowBuilder.getDefinition(), ); }

若要進一步瞭解如何在中使用密碼 CodeCatalyst,請參閱使用秘密遮罩資料

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。