///<summary>/// Add communication to a case, including optional attachment set ID and CC email addresses.///</summary>///<param name="caseId">Id for the support case.</param>///<param name="body">Body text of the communication.</param>///<param name="attachmentSetId">Optional Id for an attachment set.</param>///<param name="ccEmailAddresses">Optional list of CC email addresses.</param>///<returns>True if successful.</returns>publicasync Task<bool> AddCommunicationToCase(string caseId, string body,
string? attachmentSetId = null, List<string>? ccEmailAddresses = null){var response = await _amazonSupport.AddCommunicationToCaseAsync(
new AddCommunicationToCaseRequest()
{
CaseId = caseId,
CommunicationBody = body,
AttachmentSetId = attachmentSetId,
CcEmailAddresses = ccEmailAddresses
});
return response.Result;
}
aws support add-communication-to-case \
--case-id "case-12345678910-2013-c4c1d2bf33c5cf47" \
--communication-body "I'm attaching a set of images to this case." \
--cc-email-addresses "myemail@example.com" \
--attachment-set-id "as-2f5a6faa2a4a1e600-mu-nk5xQlBr70-G1cUos5LZkd38KOAHZa9BMDVzNEXAMPLE"
publicstaticvoidaddAttachSupportCase(SupportClient supportClient, String caseId, String attachmentSetId){try{
AddCommunicationToCaseRequest caseRequest = AddCommunicationToCaseRequest.builder()
.caseId(caseId)
.attachmentSetId(attachmentSetId)
.communicationBody("Please refer to attachment for details.")
.build();
AddCommunicationToCaseResponse response = supportClient.addCommunicationToCase(caseRequest);
if (response.result())
System.out.println("You have successfully added a communication to an AWS Support case");
else
System.out.println("There was an error adding the communication to an AWS Support case");
} catch (SupportException e) {
System.out.println(e.getLocalizedMessage());
System.exit(1);
}
}
import{ AddCommunicationToCaseCommand } from"@aws-sdk/client-support";
import{ client } from"../libs/client.js";
exportconst main = async () => {let attachmentSetId;
try{// Add a communication to a case.const response = await client.send(
new AddCommunicationToCaseCommand({communicationBody: "Adding an attachment.",
// Set value to an existing support case id.caseId: "CASE_ID",
// Optional. Set value to an existing attachment set id to add attachments to the case.
attachmentSetId,
}),
);
console.log(response);
return response;
} catch (err) {console.error(err);
}
};
suspendfunaddAttachSupportCase(
caseIdVal: String?,
attachmentSetIdVal: String?,
){val caseRequest =
AddCommunicationToCaseRequest {
caseId = caseIdVal
attachmentSetId = attachmentSetIdVal
communicationBody = "Please refer to attachment for details."
}
SupportClient { region = "us-west-2" }.use { supportClient ->
val response = supportClient.addCommunicationToCase(caseRequest)
if (response.result) {
println("You have successfully added a communication to an AWS Support case")
} else{
println("There was an error adding the communication to an AWS Support case")
}
}
}
Add-ASACommunicationToCase-CaseId"case-12345678910-2013-c4c1d2bf33c5cf47"-CommunicationBody"Some text about the case"
範例 2:將電子郵件通訊的內文新增至指定的案例,以及電子郵件 CC 行中包含的一或多個電子郵件地址。
Add-ASACommunicationToCase-CaseId"case-12345678910-2013-c4c1d2bf33c5cf47"-CcEmailAddress@("email1@address.com", "email2@address.com") -CommunicationBody"Some text about the case"
classSupportWrapper:"""Encapsulates Support actions."""def__init__(self, support_client):"""
:param support_client: A Boto3 Support client.
"""
self.support_client = support_client
@classmethoddeffrom_client(cls):"""
Instantiates this class from a Boto3 client.
"""
support_client = boto3.client("support")
return cls(support_client)
defadd_communication_to_case(self, attachment_set_id, case_id):"""
Add a communication and an attachment set to a case.
:param attachment_set_id: The ID of an existing attachment set.
:param case_id: The ID of the case.
"""try:
self.support_client.add_communication_to_case(
caseId=case_id,
communicationBody="This is an example communication added to a support case.",
attachmentSetId=attachment_set_id,
)
except ClientError as err:
if err.response["Error"]["Code"] == "SubscriptionRequiredException":
logger.info(
"You must have a Business, Enterprise On-Ramp, or Enterprise Support ""plan to use the AWS Support API. \n\tPlease upgrade your subscription to run these ""examples."
)
else:
logger.error(
"Couldn't add communication. Here's why: %s: %s",
err.response["Error"]["Code"],
err.response["Error"]["Message"],
)
raise
///<summary>/// Add communication to a case, including optional attachment set ID and CC email addresses.///</summary>///<param name="caseId">Id for the support case.</param>///<param name="body">Body text of the communication.</param>///<param name="attachmentSetId">Optional Id for an attachment set.</param>///<param name="ccEmailAddresses">Optional list of CC email addresses.</param>///<returns>True if successful.</returns>publicasync Task<bool> AddCommunicationToCase(string caseId, string body,
string? attachmentSetId = null, List<string>? ccEmailAddresses = null){var response = await _amazonSupport.AddCommunicationToCaseAsync(
new AddCommunicationToCaseRequest()
{
CaseId = caseId,
CommunicationBody = body,
AttachmentSetId = attachmentSetId,
CcEmailAddresses = ccEmailAddresses
});
return response.Result;
}