

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

# 適用於 GraphQL 的 Amazon Neptune 公用程式
<a name="tools-graphql"></a>

適用於 [GraphQL](https://graphql.org/) 的 Amazon Neptune 公用程式是開放原始碼 Node.js 命令列工具，可協助您為 Neptune 屬性圖資料庫建立和維護 GraphQL API (它尚未使用 RDF 資料)。它是一種無程式碼方式，可以為 GraphQL 查詢建立 GraphQL 解析程式，而這些查詢具有可變數量的輸入參數並會傳回可變數量的巢狀欄位。

它已作為一個開放原始碼專案發行，此專案位於 [https://github.com/aws/amazon-neptune-for-graphql](https://github.com/aws/amazon-neptune-for-graphql) 中。

您可以像這樣使用 NPM 安裝公用程式 (如需詳細資訊，請參閱[安裝和設定](tools-graphql-setup.md))：

```
npm i @aws/neptune-for-graphql -g
```

此公用程式可以探索現有 Neptune 屬性圖的圖形結構描述，包括節點，邊緣，屬性和邊緣基數。然後，它會產生 GraphQL 結構描述，其中包含將 GraphQL 類型映射至資料庫節點和邊緣所需的指令，並自動產生解析程式碼。解析程式碼旨在透過僅傳回 GraphQL 查詢所請求的資料來將延遲降至最低。

您也可以從現有的 GraphQL 結構描述和空白的 Neptune 資料庫開始，然後讓公用程式推斷將該 GraphQL 結構描述映射至資料 (要載入至資料庫) 節點和邊緣所需的指令。或者，您可以從 GraphQL 結構描述和您已經建立或修改的指令開始。

公用程式能夠建立管道所需的所有 AWS 資源，包括 AWS AppSync API、IAM 角色、資料來源、結構描述和解析程式，以及查詢 Neptune 的 AWS Lambda 函數。

**注意**  
這裡的命令列範例假設使用 Linux 主控台。如果您使用的是 Windows，請將行尾的反斜線 (「\$1」) 取代為插入號 (「^」)。

**Topics**
+ [安裝和設定適用於 GraphQL 的 Amazon Neptune 公用程式](tools-graphql-setup.md)
+ [掃描現有 Neptune 資料庫中的資料](tools-graphql-scan-existing.md)
+ [從沒有指令的 GraphQL 結構描述開始](tools-graphql-start-from-schema.md)
+ [使用 GraphQL 結構描述的指令](tools-graphql-schema-with-directives.md)
+ [GraphQL 公用程式的命令列引數](tools-graphql-cmd-line-args.md)

# 安裝和設定適用於 GraphQL 的 Amazon Neptune 公用程式
<a name="tools-graphql-setup"></a>

如果您將要使用公用程式搭配現有的 Neptune 資料庫，您需要它才能連線到資料庫端點。根據預設，Neptune 資料庫只能從其所在的 VPC 內存取。

因為公用程式是 Node.js 命令列工具，所以您必須安裝 Node.js (第 18 版或更新版本) 才能執行公用程式。若要在與 Neptune 資料庫相同的 VPC 中的 EC2 執行個體上安裝 Node.js，請遵循[這裡的指示](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html)。要執行公用程式的大小下限執行個體為 t2.micro。在建立執行個體期間，從**常見安全群組**下拉式功能表中選取 Neptune 資料庫 VPC。

若要在 EC2 執行個體或本機電腦上安裝公用程式本身，請使用 NPM：

```
npm i @aws/neptune-for-graphql -g
```

然後，您可以執行公用程式的 help 命令來檢查它是否正確安裝：

```
neptune-for-graphql --help
```

您也可以[安裝 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)來管理 AWS 資源。

# 掃描現有 Neptune 資料庫中的資料
<a name="tools-graphql-scan-existing"></a>

無論您是否熟悉 GraphQL，下面的命令都是建立 GraphQL API 的最快方法。這假設您已依照[安裝一節](tools-graphql-setup.md)中所述安裝並設定 GraphQL 的 Neptune 公用程式，以便它可以連線到 Neptune 資料庫的端點。

```
neptune-for-graphql \
  --input-graphdb-schema-neptune-endpoint (your neptune database endpoint):(port number) \
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name (your new GraphQL API name) \
  --output-resolver-query-https
```

公用程式會分析資料庫以探索其中節點，邊緣和屬性的結構描述。根據該結構描述，它會透過相關聯的查詢和變動推斷 GraphQL 結構描述。然後，它會建立一個 AppSync GraphQL API 和所需的 AWS 資源來使用它。這些資源包括一對 IAM 角色，以及一個包含 GraphQL 解析程式碼的 Lambda 函數。

公用程式完成時，您會在 AppSync 主控台中找到新的 GraphQL API，其位於您在命令中指派的名稱下方。若要對其進行測試，請使用功能表上的 AppSync **查詢**選項。

如果您在將更多資料新增至資料庫之後再次執行相同的命令，將會相應地更新 AppSync API 和 Lambda 程式碼。

若要釋放與命令相關聯的所有資源，請執行：

```
neptune-for-graphql \
  --remove-aws-pipeline-name (your new GraphQL API name from above)
```

# 從沒有指令的 GraphQL 結構描述開始
<a name="tools-graphql-start-from-schema"></a>

您可以從空白的 Neptune 資料庫開始，並使用沒有指令的 GraphQL 結構描述來建立資料並進行查詢。以下命令會自動建立 AWS 資源來執行此操作：

```
neptune-for-graphql \
  --input-schema-file (your GraphQL schema file)
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name (name for your new GraphQL API) \
  --create-update-aws-pipeline-neptune-endpoint (your Neptune database endpoint):(port number) \
  --output-resolver-query-https
```

GraphQL 結構描述檔案必須包含 GraphQL 結構描述類型，如以下 TODO 範例所示。公用程式會分析您的結構描述，並根據您的類型建立延伸版本。它會針對圖形資料庫中儲存的節點新增查詢和變動，而且如果你的結構描述具有巢狀類型，它會新增類型 (儲存為資料庫中的邊緣) 之間的關係。

公用程式會建立 AppSync GraphQL API，以及所有必要 AWS 的資源。其中包括一對 IAM 角色，以及一個包含 GraphQL 解析程式碼的 Lambda 函數。命令完成時，您可以找到新的 GraphQL API，具有您在 AppSync 主控台中指定的名稱。若要對其進行測試，請使用 AppSync 功能表中的**查詢**。

以下範例說明其運作方式。

## Todo 範例，從沒有指令的 GraphQL 結構描述開始
<a name="tools-graphql-todo-example"></a>

在這個範例中，我們從一個沒有指令的 Todo GraphQL 結構描述開始，你可以在 *???samples???* 目錄中找到該結構描述。它包括以下兩種類型：

```
type Todo {
  name: String
  description: String
  priority: Int
  status: String
  comments: [Comment]
}

type Comment {
  content: String
}
```

此命令會處理空白 Neptune 資料庫的 Todo 結構描述和端點，以建立 GraphQL API in AWS AppSync：

```
neptune-for-graphql /
  --input-schema-file ./samples/todo.schema.graphql \
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name TodoExample \
  --create-update-aws-pipeline-neptune-endpoint (empty Neptune database endpoint):(port number) \
  --output-resolver-query-https
```

公用程式會在稱為 `TodoExample.source.graphql` 的輸出資料夾中建立新的檔案，並在 AppSync 中建立 GraphQL API。公用程式會推斷以下事項：
+ 在 Todo 類型中，它已針對新的 CommentEdge 類型新增 `@relationship`。這會指示解析程式使用稱為 CommentEdge 的圖形資料庫邊緣，將 Todo 連線至 Comment。
+ 它已新增稱為 TodoInput 的新輸入來協助查詢和變動。
+ 它已針對每個類型新增兩個查詢 (Todo、Comment)：一個用於使用 `id` 或輸入中列出的任何類型欄位來擷取單一類型，而另一個用於擷取多個值，同時使用該類型的輸入進行篩選。
+ 它已針對每種類型新增三個變動：create、update 和 delete。要刪除的類型是使用 `id` 或該類型的輸入來指定。這些變動會影響 Neptune 資料庫中儲存的資料。
+ 它已針對連線新增兩個變動：connect 和 delete。它們會採取 Neptune 所使用的來源和目標頂點的節點 ID 作為輸入，而且連線是資料庫中的邊緣。

解析程式透過名稱辨識查詢和變動，但您可以自訂它們，如[下面](tools.md)所示。

以下是 `TodoExample.source.graphql` 檔案的內容：

```
type Todo {
  _id: ID! @id
  name: String
  description: String
  priority: Int
  status: String
  comments(filter: CommentInput, options: Options): [Comment] @relationship(type: "CommentEdge", direction: OUT)
  bestComment: Comment @relationship(type: "CommentEdge", direction: OUT)
  commentEdge: CommentEdge
}

type Comment {
  _id: ID! @id
  content: String
}

input Options {
  limit: Int
}

input TodoInput {
  _id: ID @id
  name: String
  description: String
  priority: Int
  status: String
}

type CommentEdge {
  _id: ID! @id
}

input CommentInput {
  _id: ID @id
  content: String
}

input Options {
  limit: Int
}

type Query {
  getNodeTodo(filter: TodoInput, options: Options): Todo
  getNodeTodos(filter: TodoInput): [Todo]
  getNodeComment(filter: CommentInput, options: Options): Comment
  getNodeComments(filter: CommentInput): [Comment]
}

type Mutation {
  createNodeTodo(input: TodoInput!): Todo
  updateNodeTodo(input: TodoInput!): Todo
  deleteNodeTodo(_id: ID!): Boolean
  connectNodeTodoToNodeCommentEdgeCommentEdge(from_id: ID!, to_id: ID!): CommentEdge
  deleteEdgeCommentEdgeFromTodoToComment(from_id: ID!, to_id: ID!): Boolean
  createNodeComment(input: CommentInput!): Comment
  updateNodeComment(input: CommentInput!): Comment
  deleteNodeComment(_id: ID!): Boolean
}

schema {
  query: Query
  mutation: Mutation
}
```

現在，您可以建立和查詢資料。以下是用來測試新 GraphQL API (在此情況下，命名為 `TodoExampleAPI`) 的 AppSync **查詢**主控台的快照。在中間視窗中，Explorer 會為您顯示查詢和變動的清單，您可以從中挑選查詢、輸入參數和傳回欄位。此螢幕擷取畫面顯示如何使用 `createNodeTodo` 變動建立 Todo 節點類型：

![\[顯示 AppSync 查詢主控台建立 Todo 節點的螢幕擷取畫面\]](http://docs.aws.amazon.com/zh_tw/neptune/latest/userguide/images/todoCreate.png)


此螢幕擷取畫面顯示如何使用 `getNodeTodos` 查詢來查詢所有 Todo 節點：

![\[顯示 AppSync 查詢主控台查詢 Todo 節點的螢幕擷取畫面\]](http://docs.aws.amazon.com/zh_tw/neptune/latest/userguide/images/todoGetTodos.png)


在使用 `createNodeComment` 建立了註解之後，您可以使用 `connectNodeTodoToNodeCommentEdgeCommentEdge` 變動，透過指定其 ID 來連線它們。以下是要擷取 Todos 及其附加註解的巢狀查詢：

![\[此螢幕擷取畫面顯示巢狀查詢在 AppSync 查詢主控台中擷取 Todos 及其附加的註解\]](http://docs.aws.amazon.com/zh_tw/neptune/latest/userguide/images/todoNestedQuery.png)


如果您想要依照[使用指令](tools-graphql-schema-with-directives.md)中所述對 `TodoExample.source.graphql` 檔案進行變更，則可以使用已編輯的結構描述作為輸入，然後再次執行公用程式。公用程式接著會相應地修改 GraphQL API。

# 使用 GraphQL 結構描述的指令
<a name="tools-graphql-schema-with-directives"></a>

您可以使用如下的命令，從已有指令的 GraphQL 結構描述開始：

```
neptune-for-graphql \
  --input-schema-file (your GraphQL schema file with directives) \
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name (name for your new GraphQL API) \
  --create-update-aws-pipeline-neptune-endpoint  (empty Neptune database endpoint):(port number) \
  --output-resolver-query-https
```

您可以修改公用程式已建立的指令，或將您自己的指令新增至 GraphQL 結構描述。以下是一些使用指令的方法：

## 執行公用程式，以便它不會產生變動
<a name="tools-graphql-no-mutations"></a>

若要防止公用程式在 GraphQL API 中產生變動，請在 `neptune-for-graphql` 命令中使用 `--output-schema-no-mutations` 選項。

## `@alias` 指令
<a name="tools-graphql-alias-directive"></a>

`@alias` 指令可以套用至 GraphQL 結構描述類型或欄位。它會在圖形資料庫與 GraphQL 結構描述之間映射不同的名稱。語法是：

```
@alias(property: (property name))
```

在下面範例中，`airport` 是映射到 `Airport` GraphQL 類型的圖形資料庫節點標籤，而 `desc` 是映射到 `description` 欄位的圖形節點屬性 (請參閱[航線範例](tools-graphql.md))：

```
type Airport @alias(property: "airport") {
  city: String
  description: String @alias(property: "desc")
}
```

請注意，標準 GraphQL 格式會要求 Pascal 大小寫類型名稱和駝峰式大小寫欄位名稱。

## `@relationship` 指令
<a name="tools-graphql-relationship-directive"></a>

`@relationship` 指令會將巢狀 GraphQL 類型映射到圖形資料庫邊緣。語法是：

```
@relationship(edgeType: (edge name), direction: (IN or OUT))
```

以下為範例命令：

```
type Airport @alias(property: "airport") {
  ...
  continentContainsIn: Continent @relationship(edgeType: "contains", direction: IN)
  countryContainsIn: Country @relationship(edgeType: "contains", direction: IN)
  airportRoutesOut(filter: AirportInput, options: Options): [Airport] @relationship(edgeType: "route", direction: OUT)
  airportRoutesIn(filter: AirportInput, options: Options): [Airport] @relationship(edgeType: "route", direction: IN)
}
```

您可以在 [Todo 範例](tools-graphql-start-from-schema.md#tools-graphql-todo-example)和[航線範例](tools-graphql.md)中找到 `@relationship` 指令。

## `@graphQuery` 和 `@cypher` 指令
<a name="tools-graphql-graphquery-cypher-directives"></a>

您可以定義 OpenCypher 查詢來解析欄位值、新增查詢或新增變動。例如，這會將新的 `outboundRoutesCount` 欄位新增至 `Airport` 類型，以對傳出路由進行計數：

```
type Airport @alias(property: "airport") {
  ...
  outboundRoutesCount: Int @graphQuery(statement: "MATCH (this)-[r:route]->(a) RETURN count(r)")
}
```

以下是新查詢和變動的範例

```
type Query {
  getAirportConnection(fromCode: String!, toCode: String!): Airport \
    @cypher(statement: \
      "MATCH (:airport{code: '$fromCode'})-[:route]->(this:airport)-[:route]->(:airport{code:'$toCode'})")
}

type Mutation {
  createAirport(input: AirportInput!): Airport @graphQuery(statement: "CREATE (this:airport {$input}) RETURN this")
  addRoute(fromAirportCode:String, toAirportCode:String, dist:Int): Route \
    @graphQuery(statement: \
     "MATCH (from:airport{code:'$fromAirportCode'}), (to:airport{code:'$toAirportCode'}) \
      CREATE (from)-[this:route{dist:$dist}]->(to) \
      RETURN this")
}
```

請注意，如果您省略了 `RETURN`，解析程式會假設關鍵字 `this` 是傳回範圍。

您也可以使用 Gemlin 查詢來新增查詢或變動：

```
type Query {
  getAirportWithGremlin(code:String): Airport \
    @graphQuery(statement: "g.V().has('airport', 'code', '$code').elementMap()")  # single node
  getAirportsWithGremlin: [Airport] \
    @graphQuery(statement: "g.V().hasLabel('airport').elementMap().fold()")       # list of nodes
  getCountriesCount: Int \
    @graphQuery(statement: "g.V().hasLabel('country').count()")                   # scalar
}
```

目前，Gemlin 查詢限於傳回純量值或 `elementMap()` (若為單一節點) 或 `elementMap().fold()` (若為節點清單) 的查詢。

## `@id` 指令
<a name="tools-graphql-id-directive"></a>

`@id` 指令會辨識映射到 `id` 圖形資料庫實體的欄位。圖形資料庫 (例如 Amazon Neptune) 對於在大量匯入期間指派或自動產生的節點和邊緣，永遠都有唯一的 `id`。例如：

```
type Airport {
  _id: ID! @id
  city: String
  code: String
}
```

## 保留類型、查詢和變動名稱
<a name="tools-graphql-reserved-names"></a>

公用程式會自動產生查詢和變動，以建立運作的 GraphQL API。這些名稱的模式由解析程式辨識別並保留。以下是類型 `Airport` 和連線類型 `Route` 的範例：

`Options` 類型是保留的。

```
input Options {
  limit: Int
}
```

`filter` 和 `options` 函數參數是保留的。

```
type Query {
  getNodeAirports(filter: AirportInput, options: Options): [Airport]
}
```

查詢名稱的 getNode 字首是保留的，並且變動名稱 (例如 `createNode`、`updateNode`、`deleteNode`、`connectNode`、`deleteNode`、`updateEdge` 和 `deleteEdge`) 的字首是保留的。

```
type Query {
  getNodeAirport(id: ID, filter: AirportInput): Airport
  getNodeAirports(filter: AirportInput): [Airport]
}

type Mutation {
  createNodeAirport(input: AirportInput!): Airport
  updateNodeAirport(id: ID!, input: AirportInput!): Airport
  deleteNodeAirport(id: ID!): Boolean
  connectNodeAirportToNodeAirportEdgeRout(from: ID!, to: ID!, edge: RouteInput!): Route
  updateEdgeRouteFromAirportToAirport(from: ID!, to: ID!, edge: RouteInput!): Route
  deleteEdgeRouteFromAirportToAirport(from: ID!, to: ID!): Boolean
}
```

## 將變更套用至 GraphQL 結構描述
<a name="tools-graphql-apply-schema-changes"></a>

您可以修改 GraphQL 來源結構描述，然後再次執行公用程式，從 Neptune 資料庫取得最新的結構描述。每次公用程式在資料庫中發現新的結構描述時，就會產生新的 GraphQL 結構描述。

您也可以手動編輯 GraphQL 來源結構描述，並使用來源結構描述做為輸入，而不是 Neptune 資料庫端點，來重新執行公用程式。

最後，您可以使用以下 JSON 格式將變更放入檔案中：

```
[
  {
    "type": "(GraphQL type name)",
    "field": "(GraphQL field name)",
    "action": "(remove or add)",
    "value": "(value)"
  }
]
```

例如：

```
[
  {
    "type": "Airport",
    "field": "outboundRoutesCountAdd",
    "action": "add",
    "value":"outboundRoutesCountAdd: Int @graphQuery(statement: \"MATCH (this)-[r:route]->(a) RETURN count(r)\")"
  },
  {
    "type": "Mutation",
    "field": "deleteNodeVersion",
    "action": "remove",
    "value": ""
  },
  {
    "type": "Mutation",
    "field": "createNodeVersion",
    "action": "remove",
    "value": ""
  }
]
```

然後，當您在命令中使用 `--input-schema-changes-file` 參數，在此檔案上執行公用程式時，公用程式會立即套用您的變更。

# GraphQL 公用程式的命令列引數
<a name="tools-graphql-cmd-line-args"></a>
+ **`--help, -h`** – 將 GraphQL 公用程式的說明文字傳回至主控台。

   
+ **`--input-schema (schema text)`** – 要用作輸入的 GraphQL 結構描述 (含或不含指令)。

   
+ **`--input-schema-file (file URL)`** – 檔案的 URL，此檔案包含要用作輸入的 GraphQL 結構描述。

   
+ **`--input-schema-changes-file (file URL)`** – 檔案的 URL，此檔案包含您要對 GraphQL 結構描述進行的變更。如果您多次針對 Neptune 資料庫執行公用程式，並且還手動變更 GraphQL 來源結構描述，也許新增自訂查詢，您的手動變更將會失去。若要避免這種情況，請將您的變更放入變更檔案中，並使用此引數傳遞它。

  變更檔案會使用下列 JSON 格式：

  ```
  [
    {
      "type": "(GraphQL type name)",
      "field": "(GraphQL field name)",
      "action": "(remove or add)",
      "value": "(value)"
    }
  ]
  ```

  如需詳細資訊，請參閱 [Todo 範例](tools-graphql-start-from-schema.md#tools-graphql-todo-example)。

   
+ **`--input-graphdb-schema (schema text)`** – 您可以透過文字形式表示 graphdb 結構描述以用作輸入，而不是針對 Neptune 資料庫執行公用程式。graphdb 結構描述具有如下的 JSON 格式：

  ```
  {
    "nodeStructures": [
      { "label":"nodelabel1",
        "properties": [
          { "name":"name1", "type":"type1" }
        ]
      },
      { "label":"nodelabel2",
        "properties": [
            { "name":"name2", "type":"type1" }
        ]
      }
    ],
    "edgeStructures": [
      {
        "label":"label1",
        "directions": [
          { "from":"nodelabel1", "to":"nodelabel2", "relationship":"ONE-ONE|ONE-MANY|MANY-MANY"  }
        ],
        "properties": [
          { "name":"name1", "type":"type1" }
        ]
      }
    ]
  }
  ```

   
+ **`--input-graphdb-schema-file (file URL)`** – 您可以將 graphdb 結構描述儲存在要用作輸入的檔案中，而不是針對 Neptune 資料庫執行公用程式。如需 graphdb 結構描述檔案的 JSON 格式範例，請參閱上述 `--input-graphdb-schema`。

   
+ **`--input-graphdb-schema-neptune-endpoint (endpoint URL)`** – 公用程式應從中擷取 graphdb 結構描述的 Neptune 資料庫端點。

   
+ **`--output-schema-file (file name)`** – GraphQL 結構描述的輸出檔案名稱。如果未指定，則預設值為 `output.schema.graphql`，除非已使用 `--create-update-aws-pipeline-name` 設定管道名稱，在此情況下預設檔案名稱為 `(pipline name).schema.graphql`。

   
+ **`--output-source-schema-file (file name)`** – GraphQL 結構描述 (含指令) 的輸出檔案名稱。如果未指定，則預設值為 `output.source.schema.graphql`，除非已使用 `--create-update-aws-pipeline-name` 設定管道名稱，在此情況下預設名稱為 `(pipeline name).source.schema.graphql`。

   
+ **`--output-schema-no-mutations`** – 如果存在此引數，則公用程式不會在 GraphQL API 中產生任何變動，只會產生查詢。

   
+ **`--output-neptune-schema-file (file name)`** – 公用程式探索的 Neptune graphdb 結構描述的輸出檔案名稱。如果未指定，則預設值為 `output.graphdb.json`，除非已使用 `--create-update-aws-pipeline-name` 設定管道名稱，在此情況下預設檔案名稱為 `(pipeline name).graphdb.json`。

   
+ **`--output-js-resolver-file (file name)`** – 解析程式碼副本的輸出檔案名稱。如果未指定，則預設值為 `output.resolver.graphql.js`，除非已使用 `--create-update-aws-pipeline-name` 設定管道名稱，在此情況下檔案名稱為 `(pipeline name).resolver.graphql.js`。

  此檔案會壓縮在程式碼套件中，此程式碼套件會上傳至執行解析程式的 Lambda 函數。

   
+ **`--output-resolver-query-sdk`** – 此引數指定公用程式的 Lambda 函數應該使用 Neptune 資料 SDK 查詢 Neptune，該 SDK 已從 Neptune [引擎版本 1.2.1.0.R5](engine-releases-1.2.1.0.R5.md) 開始可供使用 (這是預設值)。不過，如果公用程式偵測到較舊的 Neptune 引擎版本，則其會建議改用 HTTPS Lambda 選項，您可以使用 `--output-resolver-query-https` 引數調用該選項。

   
+ **`--output-resolver-query-https`** – 此引數指定公用程式的 Lambda 函數應該使用 Neptune HTTPS API 查詢 Neptune。

  

   
+ **`--create-update-aws-pipeline`**   –   此引數會觸發建立資源以供 AWS GraphQL API 使用，包括 AppSync GraphQL API 和執行解析程式的 Lambda。

   
+ **`--create-update-aws-pipeline-name (pipeline name)`** – 此引數會設定管道的名稱，例如 AppSync 的 `pipeline-name` API 或 Lambda 函數的 `pipeline-name` 函數。如果未指定名稱，則 `--create-update-aws-pipeline` 會使用 `Neptune ` 資料庫名稱。
+ **`--create-update-aws-pipeline-region (AWS region)`**   –   此引數會設定在其中建立 GraphQL API 管道 AWS 的區域。如果未指定，則預設區域為 `us-east-1` 或 Neptune 資料庫所在的區域 (從資料庫端點擷取的區域)。
+ **`--create-update-aws-pipeline-neptune-endpoint (endpoint URL)`** – 此引數會設定 Lambda 函數用來查詢資料庫的 Neptune 資料庫端點。如果未設定，則會使用 `--input-graphdb-schema-neptune-endpoint` 所設定的端點。
+ **`--remove-aws-pipeline-name (pipeline name)`** – 此引數會移除使用 `--create-update-aws-pipeline` 建立的管道。要移除的資源會列示在名為 `(pipeline name).resources.json` 的檔案中。
+ **`--output-aws-pipeline-cdk`** – 此引數會觸發建立 CDK 檔案，此檔案可以用來為 GraphQL API 建立 AWS 資源，包括 AppSync GraphQL API 和執行解析程式的 Lambda 函數。
+ **`--output-aws-pipeline-cdk-neptume-endpoint (endpoint URL)`** – 此引數會設定 Lambda 函數用來查詢 Neptune 資料庫的 Neptune 資料庫端點。如果未設定，則會使用 `--input-graphdb-schema-neptune-endpoint` 所設定的端點。
+ **`--output-aws-pipeline-cdk-name (pipeline name)`** – 此引數會設定管道名稱，供 AppSync API 和 Lambda pipeline-name 函數使用。如果未指定，則 `--create-update-aws-pipeline` 會使用 Neptune 資料庫名稱。
+ **`--output-aws-pipeline-cdk-region (AWS region)`**   –   這會設定在其中建立 GraphQL API 管道 AWS 的區域。如果未指定，則其會預設為 `us-east-1` 或 Neptune 資料庫所在的區域 (從資料庫端點擷取的區域)。
+ **`--output-aws-pipeline-cdk-file (file name)`** – 這會設定 CDK 檔案名稱。如果未設定，則預設值為 `(pipeline name)-cdk.js`。