Version 4 (V4) of the AWS SDK for .NET is in preview! To see information about this new version in preview, see the AWS SDK for .NET (version 4 preview) Developer Guide.
Please note that V4 of the SDK is in preview, therefore its content is subject to change.
Partner Central examples using AWS SDK for .NET
The following code examples show you how to perform actions and implement common scenarios by using the AWS SDK for .NET with Partner Central.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use CreateOpportunity
.
- AWS SDK for .NET
-
Create an opportunity.
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // PDX-License-Identifier: Apache-2.0 using System; using Newtonsoft.Json; using Amazon; using Amazon.Runtime; using Amazon.PartnerCentralSelling; using Amazon.PartnerCentralSelling.Model; namespace AWSExample { class Program { static readonly string catalogToUse = "AWS"; static async Task Main(string[] args) { // Initialize credentials from .aws/credentials file var credentials = new Amazon.Runtime.CredentialManagement.SharedCredentialsFile(); if (credentials.TryGetProfile("default", out var profile)) { AWSCredentials awsCredentials = profile.GetAWSCredentials(credentials); var client = new AmazonPartnerCentralSellingClient(awsCredentials); var request = new CreateOpportunityRequest { Catalog = catalogToUse, Origin = "Partner Referral", Customer = new Customer { Account = new Account { Address = new Address { CountryCode = "US", PostalCode = "99502", StateOrRegion = "Alaska" }, CompanyName = "TestCompanyName", Duns = "123456789", WebsiteUrl = "www.test.io", Industry = "Automotive" }, Contacts = new List<Contact> { new Contact { Email = "test@test.io", FirstName = "John ", LastName = "Doe", Phone = "+14444444444", BusinessTitle = "test title" } } }, LifeCycle = new LifeCycle { ReviewStatus = "Submitted", TargetCloseDate = "2024-12-30" }, Marketing = new Marketing { Source = "None" }, OpportunityType = "Net New Business", PrimaryNeedsFromAws = new List<string> { "Co-Sell - Architectural Validation" }, Project = new Project { Title = "Moin Test UUID", CustomerBusinessProblem = "Sandbox is not working as expected", CustomerUseCase = "AI Machine Learning and Analytics", DeliveryModels = new List<string> { "SaaS or PaaS" }, ExpectedCustomerSpend = new List<ExpectedCustomerSpend> { new ExpectedCustomerSpend { Amount = "2000.0", CurrencyCode = "USD", Frequency = "Monthly", TargetCompany = "Ibexlabs" } }, SalesActivities = new List<string> { "Initialized discussions with customer" } } }; try { var response = await client.CreateOpportunityAsync(request); Console.WriteLine(response.HttpStatusCode); string formattedJson = JsonConvert.SerializeObject(response, Formatting.Indented); Console.WriteLine(formattedJson); } catch (ValidationException ex) { Console.WriteLine("Validation error: " + ex.Message); } catch (AmazonPartnerCentralSellingException e) { Console.WriteLine("Failed:"); Console.WriteLine(e.RequestId); Console.WriteLine(e.ErrorCode); Console.WriteLine(e.Message); } } else { Console.WriteLine("Profile not found."); } } } }
-
For API details, see CreateOpportunity in AWS SDK for .NET API Reference.
-