Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
를 사용한 Amazon IVS Chat 예제 AWS CLI
다음 코드 예제에서는 Amazon IVS Chat과 AWS Command Line Interface 함께를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.
각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.
주제
작업
다음 코드 예시에서는 create-chat-token
의 사용 방법을 보여줍니다.
- AWS CLI
-
채팅 토큰 생성
다음
create-chat-token
예시에서는 개별 WebSocket을 룸에 연결하는 데 사용되는 암호화된 채팅 토큰을 생성합니다. 토큰은 1분 동안 유효하며 토큰을 통한 연결(세션)은 지정된 기간 동안 유효합니다.aws ivschat create-chat-token \ --roomIdentifier "arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6", \ --userId" "11231234" \ --capabilities "SEND_MESSAGE", \ --sessionDurationInMinutes"
30
출력:
{ "token": "ACEGmnoq#1rstu2...BDFH3vxwy!4hlm!#5", "sessionExpirationTime": "2022-03-16T04:44:09+00:00" "state": "CREATING", "tokenExpirationTime": "2022-03-16T03:45:09+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 3단계: 채팅 클라이언트 인증 및 권한 부여를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateChatToken
을 참조하세요.
-
다음 코드 예시에서는 create-logging-configuration
의 사용 방법을 보여줍니다.
- AWS CLI
-
채팅 LoggingConfiguration 리소스 생성
다음
create-logging-configuration
예시에서는 클라이언트가 전송된 메시지를 저장하고 기록할 수 있는 LoggingConfiguration 리소스를 생성합니다.aws ivschat create-logging-configuration \ --destination-configuration
s3={bucketName=demo-logging-bucket}
\ --name"test-logging-config"
\ --tags"key1=value1, key2=value2"
출력:
{ "arn": "arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ", "createTime": "2022-09-14T17:48:00.653000+00:00", "destinationConfiguration": { "s3": { "bucketName": "demo-logging-bucket" } }, "id": "ABcdef34ghIJ", "name": "test-logging-config", "state": "ACTIVE", "tags": { "key1" : "value1", "key2" : "value2" }, "updateTime": "2022-09-14T17:48:01.104000+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateLoggingConfiguration
을 참조하세요.
-
다음 코드 예시에서는 create-room
의 사용 방법을 보여줍니다.
- AWS CLI
-
룸 생성
다음
create-room
예시에서는 새 룸을 만듭니다.aws ivschat create-room \ --name
"test-room-1"
\ --logging-configuration-identifiers"arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"
\ --maximum-message-length256
\ --maximum-message-rate-per-second5
출력:
{ "arn": "arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6", "id": "g1H2I3j4k5L6", "createTime": "2022-03-16T04:44:09+00:00", "loggingConfigurationIdentifiers": ["arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"], "maximumMessageLength": 256, "maximumMessageRatePerSecond": 5, "name": "test-room-1", "tags": {} "updateTime": "2022-03-16T07:22:09+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 2단계: 채팅룸 생성을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateRoom
을 참조하세요.
-
다음 코드 예시에서는 delete-logging-configuration
의 사용 방법을 보여줍니다.
- AWS CLI
-
채팅 LoggingConfiguration 리소스 삭제
다음
delete-logging-configuration
예시에서는 지정된 ARN에 대한 LoggingConfiguration 리소스를 삭제합니다.aws ivschat delete-logging-configuration \ --identifier
"arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteLoggingConfiguration
을 참조하세요.
-
다음 코드 예시에서는 delete-message
의 사용 방법을 보여줍니다.
- AWS CLI
-
지정된 룸에서 메시지 삭제
다음
delete-message
예시에서는 지정된 룸으로 짝수를 보내 클라이언트가 지정된 메시지를 삭제하도록 합니다. 즉, 뷰에서 해당 메시지를 렌더링 취소하고 클라이언트의 채팅 기록에서 삭제합니다.aws ivschat delete-message \ --roomIdentifier
"arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6"
\ --id"ABC123def456"
\ --reason"Message contains profanity"
출력:
{ "id": "12345689012" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteMessage
를 참조하세요.
-
다음 코드 예시에서는 delete-room
의 사용 방법을 보여줍니다.
- AWS CLI
-
룸 삭제
다음
delete-room
예시에서는 지정된 룸을 삭제합니다. 연결된 클라이언트는 연결 해제됩니다. 성공하면 빈 응답 본문과 함께 HTTP 204가 반환됩니다.aws ivschat delete-room \ --identifier
"arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6"
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteRoom
을 참조하세요.
-
다음 코드 예시에서는 disconnect-user
의 사용 방법을 보여줍니다.
- AWS CLI
-
사용자를 룸에서 연결 해제
다음
disconnect-user
예시에서는 지정된 사용자의 모든 연결을 지정된 룸에서 연결 해제합니다. 성공하면 빈 응답 본문과 함께 HTTP 200이 반환됩니다.aws ivschat disconnect-user \ --roomIdentifier
"arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6"
\ --userId"ABC123def456"
\ --reason"Violated terms of service"
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DisconnectUser
를 참조하세요.
-
다음 코드 예시에서는 get-logging-configuration
의 사용 방법을 보여줍니다.
- AWS CLI
-
LoggingConfiguration 리소스 정보 가져오기
다음
get-logging-configuration
예시에서는 지정된 ARN의 LoggingConfiguration 리소스 정보를 가져옵니다.aws ivschat get-logging-configuration \ --identifier
"arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"
출력:
{ "arn": "arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ", "createTime": "2022-09-14T17:48:00.653000+00:00", "destinationConfiguration": { "s3": { "bucketName": "demo-logging-bucket" } }, "id": "ABcdef34ghIJ", "name": "test-logging-config", "state": "ACTIVE", "tags": { "key1" : "value1", "key2" : "value2" }, "updateTime": "2022-09-14T17:48:01.104000+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetLoggingConfiguration
을 참조하세요.
-
다음 코드 예시에서는 get-room
의 사용 방법을 보여줍니다.
- AWS CLI
-
지정된 룸 가져오기
다음
get-room
예시에서는 지정된 룸의 정보를 가져옵니다.aws ivschat get-room \ --identifier
"arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6"
출력:
{ "arn": "arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6", "createTime": "2022-03-16T04:44:09+00:00", "id": "g1H2I3j4k5L6", "loggingConfigurationIdentifiers": ["arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"], "maximumMessageLength": 256, "maximumMessageRatePerSecond": 5, "name": "test-room-1", "tags": {}, "updateTime": "2022-03-16T07:22:09+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetRoom
을 참조하세요.
-
다음 코드 예시에서는 list-logging-configurations
을 사용하는 방법을 보여 줍니다.
- AWS CLI
-
API 요청이 처리되는 AWS 리전의 사용자에 대한 모든 로깅 구성에 대한 요약 정보를 가져오려면
다음
list-logging-configurations
예제에서는 API 요청이 처리되는 AWS 리전의 사용자에 대한 모든 LoggingConfiguration 리소스에 대한 정보를 나열합니다.aws ivschat list-logging-configurations \ --max-results
2
\ --next-token ""출력:
{ "nextToken": "set-2", "loggingConfigurations": [ { "arn": "arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ", "createTime": "2022-09-14T17:48:00.653000+00:00", "destinationConfiguration": { "s3": { "bucketName": "demo-logging-bucket" } }, "id": "ABcdef34ghIJ", "name": "test-logging-config", "state": "ACTIVE", "tags": { "key1" : "value1", "key2" : "value2" }, "updateTime": "2022-09-14T17:48:01.104000+00:00" } ... ] }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListLoggingConfigurations
를 참조하세요.
-
다음 코드 예시에서는 list-rooms
의 사용 방법을 보여줍니다.
- AWS CLI
-
현재 리전의 모든 룸에 대한 요약 정보 가져오기
다음
list-rooms
예제에서는 요청이 처리되는 AWS 리전의 모든 방에 대한 요약 정보를 가져옵니다. 결과는 updateTime의 내림차순으로 정렬됩니다.aws ivschat list-rooms \ --logging-configuration-identifier
"arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"
\ --max-results10
\ --next-token ""출력:
{ "nextToken": "page3", "rooms": [ { "arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6", "createTime": "2022-03-16T04:44:09+00:00", "id": "g1H2I3j4k5L6", "loggingConfigurationIdentifiers": ["arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"], "name": "test-room-1", "tags": {}, "updateTime": "2022-03-16T07:22:09+00:00" } ] }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListRooms
를 참조하세요.
-
다음 코드 예시에서는 list-tags-for-resource
을 사용하는 방법을 보여 줍니다.
- AWS CLI
-
AWS 리소스의 모든 태그를 나열하려면(예: 룸)
다음
list-tags-for-resource
예시에서는 지정된 리소스 Amazon 리소스 이름(ARN)의 모든 태그를 나열합니다.aws ivschat list-tags-for-resource \ --resource-arn
arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6
출력:
{ "tags": { "key1": "value1", "key2": "value2" } }
자세한 내용은 Amazon Interactive Video Service API 참조의 태그 지정을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListTagsForResource
를 참조하세요.
-
다음 코드 예시에서는 send-event
의 사용 방법을 보여줍니다.
- AWS CLI
-
룸으로 이벤트 보내기
다음
send-event
예시에서는 지정된 이벤트를 지정된 룸으로 보냅니다.aws ivschat send-event \ --roomIdentifier
"arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6"
\ --eventName"SystemMessage"
\ --attributes \ "msgType"="user-notification", \ "msgText"="This chat room will close in 15 minutes."출력:
{ "id": "12345689012" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 SendEvent
를 참조하세요.
-
다음 코드 예시에서는 tag-resource
을 사용하는 방법을 보여 줍니다.
- AWS CLI
-
AWS 리소스에 대한 태그를 추가하거나 업데이트하려면(예: 룸)
다음
tag-resource
예시에서는 지정된 리소스 Amazon 리소스 이름(ARN)의 태그를 추가하거나 업데이트합니다. 성공하면 빈 응답 본문과 함께 HTTP 200이 반환됩니다.aws ivschat tag-resource \ --resource-arn
arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6
\ --tags"tagkey1=tagkeyvalue1, tagkey2=tagkeyvalue2"
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Interactive Video Service API 참조의 태그 지정을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 TagResource
를 참조하세요.
-
다음 코드 예시에서는 untag-resource
을 사용하는 방법을 보여 줍니다.
- AWS CLI
-
AWS 리소스의 태그를 제거하려면(예: 룸)
다음
untag-resource
예시에서는 지정된 리소스 Amazon 리소스 이름(ARN)의 지정된 태그를 제거합니다. 성공하면 빈 응답 본문과 함께 HTTP 200이 반환됩니다.aws ivschat untag-resource \ --resource-arn
arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6
\ --tag-keys"tagkey1, tagkey2"
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Interactive Video Service API 참조의 태그 지정을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UntagResource
를 참조하세요.
-
다음 코드 예시에서는 update-logging-configuration
의 사용 방법을 보여줍니다.
- AWS CLI
-
룸의 로깅 구성 업데이트
다음
update-logging-configuration
예시에서는 LoggingConfiguration 리소스를 지정된 데이터로 업데이트합니다.aws ivschat update-logging-configuration \ --destination-configuration
s3={bucketName=demo-logging-bucket}
\ --identifier"arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"
\ --name"test-logging-config"
출력:
{ "arn": "arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ", "createTime": "2022-09-14T17:48:00.653000+00:00", "destinationConfiguration": { "s3": { "bucketName": "demo-logging-bucket" } }, "id": "ABcdef34ghIJ", "name": "test-logging-config", "state": "ACTIVE", "tags": { "key1" : "value1", "key2" : "value2" }, "updateTime": "2022-09-14T17:48:01.104000+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateLoggingConfiguration
을 참조하세요.
-
다음 코드 예시에서는 update-room
의 사용 방법을 보여줍니다.
- AWS CLI
-
룸의 구성 업데이트
다음
update-room
예시에서는 지정된 룸의 구성을 지정된 데이터로 업데이트합니다.aws ivschat update-room \ --identifier
"arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6"
\ --logging-configuration-identifiers"arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"
\ --name"chat-room-a"
\ --maximum-message-length256
\ --maximum-message-rate-per-second5
출력:
{ "arn": "arn:aws:ivschat:us-west-2:12345689012:room/g1H2I3j4k5L6", "createTime": "2022-03-16T04:44:09+00:00", "id": "g1H2I3j4k5L6", "loggingConfigurationIdentifiers": ["arn:aws:ivschat:us-west-2:123456789012:logging-configuration/ABcdef34ghIJ"], "maximumMessageLength": 256, "maximumMessageRatePerSecond": 5, "name": "chat-room-a", "tags": {}, "updateTime": "2022-03-16T07:22:09+00:00" }
자세한 내용은 Amazon Interactive Video Service 사용자 안내서의 Amazon IVS Chat 시작하기를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateRoom
을 참조하세요.
-