aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 77 forks source link

Add-CONNPhoneNumberContactFlow cmdlet does not accept ARN for the PhoneNumberId parameter properly #328

Closed btgann closed 11 months ago

btgann commented 11 months ago

Describe the bug

When running the following command the ARN is not processed properly. The "/" is replaced with "%2F"

Add-CONNPhoneNumberContactFlow -PhoneNumberId "arn:aws:connect:us-west-2:111111111111:instance/2efd0b3b-3eb4-4fd6-bf18-cc3590a7c70f/phone-number/fb033ec3-57f4-419e-a4e1-43f4c77420f3" -ContactFlowId "d43590ee-f461-48b8-bd79-6a5269806e90" -InstanceId "2efd0b3b-3eb4-4fd6-bf18-cc3590a7c70f"

From the API documentation If the number is claimed to a traffic distribution group, and you are calling this API using an instance in the AWS Region where the traffic distribution group was created, you can use either a full phone number ARN or UUID value for the PhoneNumberId URI request parameter. However, if the number is claimed to a traffic distribution group and you are calling this API using an instance in the alternate AWS Region associated with the traffic distribution group, you must provide a full phone number ARN. If a UUID is provided in this scenario, you will receive a ResourceNotFoundException.

Expected Behavior

The arn should be passed to the API with the correct forward slash.

Current Behavior

The command fails and in cloudwatch the input parameters are: "requestParameters": { "ContactFlowId": "d43590ee-f461-48b8-bd79-6a5269806e90", "InstanceId": "2efd0b3b-3eb4-4fd6-bf18-cc3590a7c70f", "PhoneNumberId": "arn:aws:connect:us-west-2:619986601134:instance%2F2efd0b3b-3eb4-4fd6-bf18-cc3590a7c70f%2Fphone-number%2Ffb033ec3-57f4-419e-a4e1-43f4c77420f3" }

The forward slashes in the ARN are replaced with %2F

Reproduction Steps

Amazon Connect Global Resiliency is required to be enabled in the AWS Account Create Amazon Connect Instance in US-EAST-1 Create a replica instance in US-WEST-2 Create a traffic distribution group Assign a phone number to the traffic distribution group Use the command Add-CONNPhoneNumberContactFlow -PhoneNumberId "arn:aws:connect:us-west-2:111111111111:instance/2efd0b3b-3eb4-4fd6-bf18-cc3590a7c70f/phone-number/fb033ec3-57f4-419e-a4e1-43f4c77420f3" -ContactFlowId "d43590ee-f461-48b8-bd79-6a5269806e90" -InstanceId "2efd0b3b-3eb4-4fd6-bf18-cc3590a7c70f" To assign the phone number to a contact flow in the replica instance. PhoneNumberId = arn of the phone number assigned to the traffic distribution group in US-West-2 instance ContactFlowId = valid contact flow id in US-West-2 instance InstanceId = US-West-2 instance ID

Possible Solution

No response

Additional Information/Context

AWS.Tools.S3 4.1.54

AWS Tools for PowerShell version used

AWS.Tools.S3 4.1.371

PowerShell version used

Name Value


PSVersion 5.1.19041.3031 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.3031 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

Operating System and version

Linux

ashishdhingra commented 11 months ago

@btgann Good afternoon. Thanks for reporting the issue. Could you please share the below information:

Phone number ARN could be retrieved using AWS CLI command aws connect list-phone-numbers --instance-id <<instance-id>> --region us-east-1.

I was unable to use Copy-CONNInstance to configure replica for global resilience and create traffic distribution group, due to some account limitations. Per the API documentation AssociatePhoneNumberContactFlow, If the number is claimed to a traffic distribution group, and you are calling this API using an instance in the AWS Region where the traffic distribution group was created, you can use either a full phone number ARN or UUID value for the PhoneNumberId URI request parameter..

So I tried executing below without creating traffice distribution group (as required by API to use full phone number ARN):

content-type:application/json host:connect.us-east-1.amazonaws.com x-amz-date:20230719T211720Z x-amz-security-token:<>

content-type;host;x-amz-date;x-amz-security-token <> ... botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameterException) when calling the AssociatePhoneNumberContactFlow operation: Invalid request parameter: PhoneNumberId

An error occurred (InvalidParameterException) when calling the AssociatePhoneNumberContactFlow operation: Invalid request parameter: PhoneNumberId



So AWS CLI also appears to escape the phone number ARN. Hence, I was just curious if the corresponding AWS CLI command works for you, or, fails with the same error as PowerShell CmdLet. It would also be helpful if you could execute the AWS CLI command with `--debug` option to see what is happening behind the scenes.

When I simply use the `PhoneNumberId` (not the full ARN), `Add-CONNPhoneNumberContactFlow` appears to work fine.

Thanks,
Ashish
github-actions[bot] commented 11 months ago

This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

github-actions[bot] commented 11 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.