

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Managed Service for Apache Flink API コードの例
<a name="api-examples"></a>

このトピックには、Apache Flink 用 Managed Service アクションのリクエストブロックの例が含まれています。

( AWS Command Line Interface AWS CLI) でアクションの入力として JSON を使用するには、JSON ファイルにリクエストを保存します。次に、 `--cli-input-json` パラメータを使用してファイル名をアクションに渡します。

次の例は、アクションを備えた JSON ファイルを使用する方法を示しています。

```
$ aws kinesisanalyticsv2 start-application --cli-input-json file://start.json
```

で JSON を使用する方法の詳細については AWS CLI、 *AWS Command Line Interface ユーザーガイド*[の「CLI スケルトンの生成」および「CLI 入力 JSON パラメータ](https://docs.aws.amazon.com/cli/latest/userguide/generate-cli-skeleton.html)」を参照してください。

**Topics**
+ [AddApplicationCloudWatchLoggingOption](#api-examples-addapplicationcloudwatchloggingoption)
+ [AddApplicationInput](#api-examples-addapplicationinput)
+ [AddApplicationInputProcessingConfiguration](#api-examples-addapplicationinputprocessingconfiguration)
+ [AddApplicationOutput](#api-examples-addapplicationoutput)
+ [AddApplicationReferenceDataSource](#api-examples-addapplicationreferencedatasource)
+ [AddApplicationVpcConfiguration](#api-examples-AddApplicationVpcConfiguration)
+ [CreateApplication](#api-examples-createapplication)
+ [CreateApplicationSnapshot](#api-examples-createapplicationsnapshot)
+ [DeleteApplication](#api-examples-deleteapplication)
+ [DeleteApplicationCloudWatchLoggingOption](#api-examples-deleteapplicationcloudwatchloggingoption)
+ [DeleteApplicationInputProcessingConfiguration](#api-examples-deleteapplicationinputprocessingconfiguration)
+ [DeleteApplicationOutput](#api-examples-deleteapplicationoutput)
+ [DeleteApplicationReferenceDataSource](#api-examples-deleteapplicationreferencedatasource)
+ [DeleteApplicationSnapshot](#api-examples-deleteapplicationsnapshot)
+ [DeleteApplicationVpcConfiguration](#api-examples-DeleteApplicationVpcConfiguration)
+ [DescribeApplication](#api-examples-describeapplication)
+ [DescribeApplicationSnapshot](#api-examples-describeapplicationsnapshot)
+ [DiscoverInputSchema](#api-examples-discoverinputschema)
+ [ListApplications](#api-examples-listapplications)
+ [ListApplicationSnapshots](#api-examples-listapplicationsnapshots)
+ [StartApplication](#api-examples-startapplication)
+ [StopApplication](#api-examples-stopapplication)
+ [UpdateApplication](#api-examples-updateapplication)

## AddApplicationCloudWatchLoggingOption
<a name="api-examples-addapplicationcloudwatchloggingoption"></a>

次の「[AddApplicationCloudWatchLoggingOption](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_AddApplicationCloudWatchLoggingOption.html)」アクションのリクエストコード例では、Amazon CloudWatch ロギングオプションを Apache Flink アプリケーション用 Managed Service に追加します。

```
{
    "ApplicationName": "MyApplication",
    "CloudWatchLoggingOption": {
        "LogStreamARN": "arn:aws:logs:us-east-1:123456789123:log-group:my-log-group:log-stream:My-LogStream"
    },
    "CurrentApplicationVersionId": 2
}
```

## AddApplicationInput
<a name="api-examples-addapplicationinput"></a>

次の「[AddApplicationInput](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_AddApplicationInput.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service にアプリケーション入力を追加します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 2,
   "Input": { 
      "InputParallelism": { 
         "Count": 2
      },
      "InputSchema": { 
         "RecordColumns": [ 
            { 
               "Mapping": "$.TICKER",
               "Name": "TICKER_SYMBOL",
               "SqlType": "VARCHAR(50)"
            },
            {
                "SqlType": "REAL",
                "Name": "PRICE",
                "Mapping": "$.PRICE"
            }
         ],
         "RecordEncoding": "UTF-8",
         "RecordFormat": { 
            "MappingParameters": { 
               "JSONMappingParameters": { 
                  "RecordRowPath": "$"
               }
            },
            "RecordFormatType": "JSON"
         }
      },
      "KinesisStreamsInput": { 
         "ResourceARN": "arn:aws:kinesis:us-east-1:012345678901:stream/ExampleInputStream"
      }
   }
}
```

## AddApplicationInputProcessingConfiguration
<a name="api-examples-addapplicationinputprocessingconfiguration"></a>

次の「[AddApplicationInputProcessingConfiguration](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_AddApplicationInputProcessingConfiguration.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service にアプリケーション入力処理設定を追加します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 2,
   "InputId": "2.1",
   "InputProcessingConfiguration": { 
      "InputLambdaProcessor": { 
         "ResourceARN": "arn:aws:lambda:us-east-1:012345678901:function:MyLambdaFunction"
      }
   }
}
```

## AddApplicationOutput
<a name="api-examples-addapplicationoutput"></a>

次の「[AddApplicationOutput](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_AddApplicationOutput.html)」アクションのリクエストコード例では、Kinesis データストリームをアプリケーション出力として Apache Flink アプリケーション用 Managed Service に追加します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 2,
   "Output": { 
      "DestinationSchema": { 
         "RecordFormatType": "JSON"
      },
      "KinesisStreamsOutput": { 
         "ResourceARN": "arn:aws:kinesis:us-east-1:012345678901:stream/ExampleOutputStream"
      },
      "Name": "DESTINATION_SQL_STREAM"
   }
}
```

## AddApplicationReferenceDataSource
<a name="api-examples-addapplicationreferencedatasource"></a>

次の「[AddApplicationReferenceDataSource](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_AddApplicationReferenceDataSource.html)」アクションのリクエストコード例では、CSV アプリケーション参照データソースを Apache Flink アプリケーション用 Managed Service に追加します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 5,
   "ReferenceDataSource": { 
      "ReferenceSchema": { 
         "RecordColumns": [ 
            { 
               "Mapping": "$.TICKER",
               "Name": "TICKER",
               "SqlType": "VARCHAR(4)"
            },
            { 
               "Mapping": "$.COMPANYNAME",
               "Name": "COMPANY_NAME",
               "SqlType": "VARCHAR(40)"
            },
         ],
         "RecordEncoding": "UTF-8",
         "RecordFormat": { 
            "MappingParameters": { 
               "CSVMappingParameters": { 
                  "RecordColumnDelimiter": " ",
                  "RecordRowDelimiter": "\r\n"
               }
            },
            "RecordFormatType": "CSV"
         }
      },
      "S3ReferenceDataSource": { 
         "BucketARN": "arn:aws:s3:::amzn-s3-demo-bucket",
         "FileKey": "TickerReference.csv"
      },
      "TableName": "string"
   }
}
```

## AddApplicationVpcConfiguration
<a name="api-examples-AddApplicationVpcConfiguration"></a>

次の「[AddApplicationVpcConfiguration](https://docs.aws.amazon.com/managed-flink/latest/apiv2/API_AddApplicationVpcConfiguration.html)」アクションのリクエストコード例では、既存のアプリケーションに VPC 設定を追加します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 9,
   "VpcConfiguration": { 
      "SecurityGroupIds": [ "sg-0123456789abcdef0" ],
      "SubnetIds": [ "subnet-0123456789abcdef0" ]
   }
}
```

## CreateApplication
<a name="api-examples-createapplication"></a>

次の「[CreateApplication](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_CreateApplication.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service を作成します。

```
{
  "ApplicationName":"MyApplication",
  "ApplicationDescription":"My-Application-Description",
  "RuntimeEnvironment":"FLINK-1_15",
  "ServiceExecutionRole":"arn:aws:iam::123456789123:role/myrole",
  "CloudWatchLoggingOptions":[
    {
      "LogStreamARN":"arn:aws:logs:us-east-1:123456789123:log-group:my-log-group:log-stream:My-LogStream"
    }
  ],
  "ApplicationConfiguration": {
    "EnvironmentProperties":
      {"PropertyGroups": 
        [
          {"PropertyGroupId": "ConsumerConfigProperties",
            "PropertyMap": 
              {"aws.region": "us-east-1",
              "flink.stream.initpos": "LATEST"}
          },
          {"PropertyGroupId": "ProducerConfigProperties",
            "PropertyMap": 
              {"aws.region": "us-east-1"}
          },
        ]
      },
    "ApplicationCodeConfiguration":{
      "CodeContent":{
        "S3ContentLocation":{
          "BucketARN":"arn:aws:s3:::amzn-s3-demo-bucket",
          "FileKey":"myflink.jar",
          "ObjectVersion":"AbCdEfGhIjKlMnOpQrStUvWxYz12345"
        }
      },
      "CodeContentType":"ZIPFILE"
    },
      "FlinkApplicationConfiguration":{
      "ParallelismConfiguration":{
        "ConfigurationType":"CUSTOM",
        "Parallelism":2,
        "ParallelismPerKPU":1,
        "AutoScalingEnabled":true
      }
    }
  }
}
```

## CreateApplicationSnapshot
<a name="api-examples-createapplicationsnapshot"></a>

次の「[CreateApplicationSnapshot](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_CreateApplicationSnapshot.html)」アクションのリクエストコード例では、アプリケーション状態のスナップショットを作成します。

```
{
   "ApplicationName": "MyApplication",
   "SnapshotName": "MySnapshot"
}
```

## DeleteApplication
<a name="api-examples-deleteapplication"></a>

次の「[DeleteApplication](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DeleteApplication.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service を削除します。

```
{"ApplicationName": "MyApplication",
"CreateTimestamp": 12345678912}
```

## DeleteApplicationCloudWatchLoggingOption
<a name="api-examples-deleteapplicationcloudwatchloggingoption"></a>

次の「[DeleteApplicationCloudWatchLoggingOption](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DeleteApplicationCloudWatchLoggingOption.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service から Amazon CloudWatch ロギングオプションを削除します。

```
{
    "ApplicationName": "MyApplication",
    "CloudWatchLoggingOptionId": "3.1"
    "CurrentApplicationVersionId": 3
}
```

## DeleteApplicationInputProcessingConfiguration
<a name="api-examples-deleteapplicationinputprocessingconfiguration"></a>

次の「[DeleteApplicationInputProcessingConfiguration](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DeleteApplicationInputProcessingConfiguration.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service から入力処理設定を削除します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 4,
   "InputId": "2.1"
}
```

## DeleteApplicationOutput
<a name="api-examples-deleteapplicationoutput"></a>

次の「[DeleteApplicationOutput](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DeleteApplicationOutput.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service からアプリケーション出力を削除します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 4,
   "OutputId": "4.1"
}
```

## DeleteApplicationReferenceDataSource
<a name="api-examples-deleteapplicationreferencedatasource"></a>

次の「[DeleteApplicationReferenceDataSource](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DeleteApplicationReferenceDataSource.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service からアプリケーション参照データソースを削除します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 5,
   "ReferenceId": "5.1"
}
```

## DeleteApplicationSnapshot
<a name="api-examples-deleteapplicationsnapshot"></a>

次の「[DeleteApplicationSnapshot](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DeleteApplicationSnapshot.html)」アクションのリクエストコード例では、アプリケーションの状態のスナップショットを削除します。

```
{
   "ApplicationName": "MyApplication",
   "SnapshotCreationTimestamp": 12345678912,
   "SnapshotName": "MySnapshot"
}
```

## DeleteApplicationVpcConfiguration
<a name="api-examples-DeleteApplicationVpcConfiguration"></a>

「[以下のDeleteApplicationVpcConfiguration](https://docs.aws.amazon.com/managed-flink/latest/apiv2/API_DeleteApplicationVpcConfiguration.html)」アクションのリクエストコード例では、アプリケーションから既存の VPC 設定を削除します。

```
{
   "ApplicationName": "MyApplication",
   "CurrentApplicationVersionId": 9,
   "VpcConfigurationId": "1.1"
}
```

## DescribeApplication
<a name="api-examples-describeapplication"></a>

次の「[DescribeApplication](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DescribeApplication.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service に関する詳細を返します。

```
{"ApplicationName": "MyApplication"}
```

## DescribeApplicationSnapshot
<a name="api-examples-describeapplicationsnapshot"></a>

次の「[DescribeApplicationSnapshot](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DescribeApplicationSnapshot.html)」アクションのリクエストコード例では、アプリケーションの状態のスナップショットに関する詳細を返します。

```
{
   "ApplicationName": "MyApplication",
   "SnapshotName": "MySnapshot"
}
```

## DiscoverInputSchema
<a name="api-examples-discoverinputschema"></a>

次の「[DiscoverInputSchema](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DiscoverInputSchema.html)」アクションのリクエストコード例では、ストリーミングソースからスキーマを生成します。

```
{
   "InputProcessingConfiguration": { 
      "InputLambdaProcessor": { 
         "ResourceARN": "arn:aws:lambda:us-east-1:012345678901:function:MyLambdaFunction"
      }
   },
   "InputStartingPositionConfiguration": { 
      "InputStartingPosition": "NOW"
   },
   "ResourceARN": "arn:aws:kinesis:us-east-1:012345678901:stream/ExampleInputStream",
   "S3Configuration": { 
      "BucketARN": "string",
      "FileKey": "string"
   },
   "ServiceExecutionRole": "string"
}
```

次の「[DiscoverInputSchema](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_DiscoverInputSchema.html)」アクションのリクエストコード例では、参照ソースからスキーマを生成します。

```
{
   "S3Configuration": { 
      "BucketARN": "arn:aws:s3:::amzn-s3-demo-bucket",
      "FileKey": "TickerReference.csv"
   },
   "ServiceExecutionRole": "arn:aws:iam::123456789123:role/myrole"
}
```

## ListApplications
<a name="api-examples-listapplications"></a>

以下の「[ListApplications](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_ListApplications.html)」アクションのリクエストコード例では、アカウント内の Apache Flink アプリケーション用 Managed Service のリストを返します。

```
{
   "ExclusiveStartApplicationName": "MyApplication",
   "Limit": 50
}
```

## ListApplicationSnapshots
<a name="api-examples-listapplicationsnapshots"></a>

以下の「[ListApplicationSnapshots](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_ListApplicationSnapshots.html)」アクションのリクエストコード例では、アプリケーションの状態のスナップショットのリストを返します。

```
{"ApplicationName": "MyApplication",
   "Limit": 50,
   "NextToken": "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123"
}
```

## StartApplication
<a name="api-examples-startapplication"></a>

次の「[StartApplication](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_StartApplication.html)」アクションのリクエストコード例では、Apache Flink 用 Managed Service を起動し、最新のスナップショット (存在する場合) からアプリケーションの状態をロードします。

```
{
    "ApplicationName": "MyApplication",
    "RunConfiguration": {
        "ApplicationRestoreConfiguration": { 
         "ApplicationRestoreType": "RESTORE_FROM_LATEST_SNAPSHOT"
         }
    }
}
```

## StopApplication
<a name="api-examples-stopapplication"></a>

次の「[API\$1StopApplication](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_StopApplication.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service を停止します。

```
{"ApplicationName": "MyApplication"}
```

## UpdateApplication
<a name="api-examples-updateapplication"></a>

次の「[UpdateApplication](https://docs.aws.amazon.com/managed-service-for-apache-flink/latest/apiv2/API_UpdateApplication.html)」アクションのリクエストコード例では、Apache Flink アプリケーション用 Managed Service を更新して、アプリケーションコードの場所を変更します。

```
{"ApplicationName": "MyApplication",
"CurrentApplicationVersionId": 1,
"ApplicationConfigurationUpdate": { 
      "ApplicationCodeConfigurationUpdate": { 
         "CodeContentTypeUpdate": "ZIPFILE",
         "CodeContentUpdate": { 
            "S3ContentLocationUpdate": { 
               "BucketARNUpdate": "arn:aws:s3:::amzn-s3-demo-bucket",
               "FileKeyUpdate": "my_new_code.zip",
               "ObjectVersionUpdate": "2"
         }
      }
   }
}
```