Die AWS Partner Central API-Referenz wurde neu strukturiert. Weitere Informationen zu den unterstützten API-Vorgängen finden Sie in der AWS Partner Central API-Referenz.
Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
Verwenden Sie DisassociateOpportunitymit einem AWS SDK
Die folgenden Code-Beispiele zeigen, wie DisassociateOpportunity verwendet wird.
Beispiele für Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Im folgenden Codebeispiel können Sie diese Aktion im Kontext sehen:
- Java
-
- SDK für Java 2.x
-
Entfernen Sie eine bestehende Verknüpfung zwischen einer Opportunity und verwandten Entitäten.
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.DisassociateOpportunityRequest;
import software.amazon.awssdk.services.partnercentralselling.model.DisassociateOpportunityResponse;
/*
Purpose
PC-API -14 Removing a Solution
PC-API -15 Removing an offer
PC-API -16 Removing a product
entity_type = Solutions | AWSProducts | AWSMarketplaceOffers
*/
public class DisassociateOpportunity {
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 entityIdentifier = "S-0000000";
DisassociateOpportunityResponse response = getResponse(opportunityId, entityType, entityIdentifier );
ReferenceCodesUtils.formatOutput(response);
}
static DisassociateOpportunityResponse getResponse(String opportunityId, String entityType, String entityIdentifier) {
DisassociateOpportunityRequest disassociateOpportunityRequest = DisassociateOpportunityRequest.builder()
.catalog(Constants.CATALOG_TO_USE)
.opportunityIdentifier(opportunityId)
.relatedEntityType(entityType)
.relatedEntityIdentifier(entityIdentifier)
.build();
DisassociateOpportunityResponse response = client.disassociateOpportunity(disassociateOpportunityRequest);
return response;
}
}
- Python
-
- SDK für Python (Boto3)
-
Entfernen Sie eine bestehende Verknüpfung zwischen einer Opportunity und verwandten Entitäten.
#!/usr/bin/env python
"""
Purpose
PC-API -14 Removing a Solution
PC-API -15 Removing an offer
PC-API -16 Removing a product
"""
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 disassociate_opportunity(entity_type, entity_identifier, opportunityIdentifier):
disassociate_opportunity_request ={
"Catalog": CATALOG_TO_USE,
"OpportunityIdentifier" : opportunityIdentifier,
"RelatedEntityType" : entity_type,
"RelatedEntityIdentifier" : entity_identifier
}
try:
# Perform an API call
response = partner_central_client.disassociate_opportunity(**disassociate_opportunity_request)
return response
except ClientError as err:
# Catch all client exceptions
print(err.response)
def usage_demo():
#entity_type = Solutions | AWSProducts | AWSMarketplaceOffers
entity_type = "Solutions"
entity_identifier = "S-0049999"
opportunityIdentifier = "O4397574"
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
print("-" * 88)
print("Get updated Opportunity.")
print("-" * 88)
helper.pretty_print_datetime(disassociate_opportunity(entity_type, entity_identifier, opportunityIdentifier))
if __name__ == "__main__":
usage_demo()
Eine vollständige Liste der AWS SDK-Entwicklerhandbücher und Codebeispiele finden Sie unter. Verwenden AWS Partner Central-API mit einem AWS SDK Dieses Thema enthält auch Informationen zu den ersten Schritten und Details zu früheren SDK-Versionen.