Se reestructuró la referencia de la Centro de socios de AWS API. Para obtener más información sobre las operaciones de API compatibles, consulte la referencia de la Centro de socios de AWS API.
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
GetAwsOpportunitySummaryÚselo con un AWS SDK
Los siguientes ejemplos de código muestran cómo utilizar GetAwsOpportunitySummary.
- Java
-
- SDK para Java 2.x
-
Recupera un resumen de una AWS oportunidad.
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.GetAwsOpportunitySummaryRequest;
import software.amazon.awssdk.services.partnercentralselling.model.GetAwsOpportunitySummaryResponse;
/*
* Purpose
* PC-API-25 Retrieves a summary of an AWS Opportunity.
*/
public class GetAwsOpportunitySummary {
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;
GetAwsOpportunitySummaryResponse response = getResponse(opportunityId);
ReferenceCodesUtils.formatOutput(response);
}
public static GetAwsOpportunitySummaryResponse getResponse(String opportunityId) {
GetAwsOpportunitySummaryRequest getOpportunityRequest = GetAwsOpportunitySummaryRequest.builder()
.catalog(Constants.CATALOG_TO_USE)
.relatedOpportunityIdentifier(opportunityId)
.build();
GetAwsOpportunitySummaryResponse response = client.getAwsOpportunitySummary(getOpportunityRequest);
return response;
}
}
- Python
-
- SDK para Python (Boto3)
-
Recupera un resumen de una AWS oportunidad.
#!/usr/bin/env python
"""
Purpose
PC-API-25 Retrieves a summary of an AWS Opportunity. LifeCycle.ReviewStatus=Approved
"""
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 get_opportunity(identifier):
get_opportunity_request ={
"Catalog": CATALOG_TO_USE,
"RelatedOpportunityIdentifier": identifier
}
try:
# Perform an API call
response = partner_central_client.get_aws_opportunity_summary(**get_opportunity_request)
return response
except ClientError as err:
# Catch all client exceptions
print(err.response)
def usage_demo():
identifier = "O5465588"
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
print("-" * 88)
print("Get AWS Opportunity summary.")
print("-" * 88)
helper.pretty_print_datetime(get_opportunity(identifier))
if __name__ == "__main__":
usage_demo()
Para obtener una lista completa de las guías para desarrolladores del AWS SDK y ejemplos de código, consulte. Utilización AWS La API de Partner Central con un AWS SDK En este tema también se incluye información sobre cómo empezar a utilizar el SDK y detalles sobre sus versiones anteriores.