AWS SDK와 CreateGraph 함께 사용 - AWS SDK 코드 예제

Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

AWS SDK와 CreateGraph 함께 사용

다음 코드 예시는 CreateGraph의 사용 방법을 보여 줍니다.

Java
SDK for Java 2.x
참고

GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

/** * Executes the process of creating a new Neptune graph. * * @param client the Neptune graph client used to interact with the Neptune service * @param graphName the name of the graph to be created * @throws NeptuneGraphException if an error occurs while creating the graph */ public static void executeCreateGraph(NeptuneGraphClient client, String graphName) { try { // Create the graph request CreateGraphRequest request = CreateGraphRequest.builder() .graphName(graphName) .provisionedMemory(16) .build(); // Create the graph CreateGraphResponse response = client.createGraph(request); // Extract the graph name and ARN String createdGraphName = response.name(); String graphArn = response.arn(); String graphEndpoint = response.endpoint(); System.out.println("Graph created successfully!"); System.out.println("Graph Name: " + createdGraphName); System.out.println("Graph ARN: " + graphArn); System.out.println("Graph Endpoint: " +graphEndpoint ); } catch (NeptuneGraphException e) { System.err.println("Failed to create graph: " + e.awsErrorDetails().errorMessage()); } finally { client.close(); } }
  • API 세부 정보는 API 참조의 CreateGraphAWS SDK for Java 2.x 를 참조하세요.