Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
기회의 관련 엔터티 업데이트
다음 코드 예제는 다음과 같은 작업을 수행하는 방법을 보여줍니다.
이전 개체의 연결을 해제합니다.
새 개체를 연결합니다.
- Java
-
- SDK for Java 2.x
-
참고
GitHub에 더 많은 내용이 있습니다. 전체 예제를 찾아 시나리오
리포지토리에서를 설정하고 실행하는 방법을 알아봅니다. 기회의 관련 엔터티 업데이트
package org.example; import static org.example.utils.Constants.*; import org.example.utils.Constants; import org.example.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.partnercentralselling.PartnerCentralSellingClient; import software.amazon.awssdk.services.partnercentralselling.model.AssociateOpportunityRequest; import software.amazon.awssdk.services.partnercentralselling.model.AssociateOpportunityResponse; import software.amazon.awssdk.services.partnercentralselling.model.DisassociateOpportunityRequest; import software.amazon.awssdk.services.partnercentralselling.model.DisassociateOpportunityResponse; /* Purpose PC-API -17 Replacing a solution */ public class ReplaceSolution { static PartnerCentralSellingClient client = PartnerCentralSellingClient.builder() .region(Region.US_EAST_1) .credentialsProvider(DefaultCredentialsProvider.create()) .httpClient(ApacheHttpClient.builder().build()) .build(); public static void main(String[] args) { String opportunityId = args.length > 0 ? args[0] : OPPORTUNITY_ID; String entityType = "Solutions"; String originalEntityIdentifier = "S-0000000"; String newEntityIdentifier = "S-0011111"; disassociateOppornitityResponse(opportunityId, entityType, originalEntityIdentifier ); AssociateOpportunityResponse associateOpportunityResponse = associateOpportunityResponse(opportunityId, entityType, newEntityIdentifier ); ReferenceCodesUtils.formatOutput(associateOpportunityResponse); } private static AssociateOpportunityResponse associateOpportunityResponse(String opportunityId, String entityType, String entityIdentifier) { AssociateOpportunityRequest associateOpportunityRequest = AssociateOpportunityRequest.builder() .catalog(Constants.CATALOG_TO_USE) .opportunityIdentifier(opportunityId) .relatedEntityType(entityType) .relatedEntityIdentifier(entityIdentifier) .build(); AssociateOpportunityResponse response = client.associateOpportunity(associateOpportunityRequest); return response; } private static DisassociateOpportunityResponse disassociateOppornitityResponse(String opportunityId, String entityType, String entityIdentifier) { PartnerCentralSellingClient client = PartnerCentralSellingClient.builder() .region(Region.US_EAST_1) .credentialsProvider(DefaultCredentialsProvider.create()) .httpClient(ApacheHttpClient.builder().build()) .build(); DisassociateOpportunityRequest disassociateOpportunityRequest = DisassociateOpportunityRequest.builder() .catalog(Constants.CATALOG_TO_USE) .opportunityIdentifier(opportunityId) .relatedEntityType(entityType) .relatedEntityIdentifier(entityIdentifier) .build(); DisassociateOpportunityResponse response = client.disassociateOpportunity(disassociateOpportunityRequest); return response; } }
-
API 세부 정보는 AWS SDK for Java 2.x API 참조의 다음 주제를 참조하세요.
-
- Python
-
- SDK for Python (Boto3)
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. 기회의 연결된 엔터티 업데이트
#!/usr/bin/env python """ Purpose PC-API -17 Replacing a solution """ import logging import boto3 import utils.helpers as helper from botocore.client import ClientError from utils.constants import CATALOG_TO_USE serviceName = "partnercentral-selling" partner_central_client = boto3.client( service_name=serviceName, region_name='us-east-1' ) def replace_solution(original_entity_identifier, new_entity_identifier, opportunityIdentifier): disassociate_opportunity_request ={ "Catalog": CATALOG_TO_USE, "OpportunityIdentifier" : opportunityIdentifier, "RelatedEntityType" : "Solutions", "RelatedEntityIdentifier" : original_entity_identifier } associate_opportunity_request ={ "Catalog": CATALOG_TO_USE, "OpportunityIdentifier" : opportunityIdentifier, "RelatedEntityType" : "Solutions", "RelatedEntityIdentifier" : new_entity_identifier } try: # Perform an API call response = partner_central_client.disassociate_opportunity(**disassociate_opportunity_request) response = partner_central_client.associate_opportunity(**associate_opportunity_request) return response except ClientError as err: # Catch all client exceptions print(err.response) def usage_demo(): original_entity_identifier = "S-0049999" new_entity_identifier = "S-0050014" opportunityIdentifier = "O4397574" logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") print("-" * 88) print("Replacing a solution.") print("-" * 88) helper.pretty_print_datetime(replace_solution(original_entity_identifier, new_entity_identifier, opportunityIdentifier)) if __name__ == "__main__": usage_demo()
-
API 세부 정보는 AWS SDK for Python (Boto3) API 참조의 다음 주제를 참조하세요.
-
시나리오
Amazon Personalize