Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting values returned by CloudFrontClient methods when using "aws/aws-sdk-php:^3.0" #1815

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

phansys
Copy link
Member

@phansys phansys commented Sep 22, 2020

Subject

Fix getting values returned by CloudFrontClient methods when using "aws/aws-sdk-php:^3.0".

The method CloudFrontClient::getInvalidation() from SDK v2 returns the following array structure:

[
    'Id' => '<string>',
    'Status' => '<string>',
    'CreateTime' => <DateTime>,
    'InvalidationBatch' => [
        'Paths' => [
            'Items' => ['<string>', ...],
            'Quantity' => <integer>,
        ],
        'CallerReference' => '<string>',
    ],
    'RequestId' => '<>',
]

while the SDK v3 returns the following:

[
    'Invalidation' => [
        'CreateTime' => <DateTime>,
        'Id' => '<string>',
        'InvalidationBatch' => [
            'CallerReference' => '<string>',
            'Paths' => [
                'Items' => ['<string>', ...],
                'Quantity' => <integer>,
            ],
        ],
        'Status' => '<string>',
    ],
]

the same occurs with the method CloudFrontClient::createInvalidation(), but we are currently trying to deal with the structure returned by the SDK v3 without being aware of this difference.

I am targeting this branch, because these changes respect BC.

Follow up of #1814.

Changelog

### Fixed
- Fixed getting values returned by `CloudFrontClient::createInvalidation()` and `CloudFrontClient::getInvalidation()` methods when using "aws/aws-sdk-php:^3.0".

### Deprecated
- Deprecated method signature for `CloudFront::__construct()`;
- Deprecated methods `CloudFront::setClient()` and `CloudFront::getStatusList()`;
- Deprecated returning `false` or any value not present in the `CDNInterface::STATUS_*` constants from `CloudFront::getFlushStatus()`.

@phansys phansys changed the title Fix getting values returned by CloudFrontClient methods when using … Fix getting values returned by CloudFrontClient methods when using "aws/aws-sdk-php:^3.0" Sep 22, 2020
@phansys phansys requested a review from a team September 22, 2020 03:17
@phansys phansys added the patch label Sep 22, 2020
@phansys phansys marked this pull request as ready for review September 22, 2020 03:17
wbloszyk
wbloszyk previously approved these changes Sep 22, 2020
wbloszyk
wbloszyk previously approved these changes Sep 23, 2020
@greg0ire
Copy link
Contributor

Fix getting values returned by CloudFrontClient methods when using "aws/aws-sdk-php:^3.0".

What is wrong, and how did you fix that?

@phansys
Copy link
Member Author

phansys commented Oct 17, 2020

What is wrong, and how did you fix that?

I just extended the PR description in order to explain this. Please, let me know if you think more context is required.

@phansys phansys requested a review from greg0ire October 17, 2020 12:05
src/CDN/CloudFront.php Outdated Show resolved Hide resolved
src/CDN/CloudFront.php Outdated Show resolved Hide resolved
src/CDN/CloudFront.php Outdated Show resolved Hide resolved
src/CDN/CloudFront.php Outdated Show resolved Hide resolved
src/CDN/CloudFront.php Outdated Show resolved Hide resolved
src/CDN/CloudFront.php Show resolved Hide resolved
src/CDN/CloudFrontVersion3.php Outdated Show resolved Hide resolved
src/CDN/CloudFrontVersion3.php Outdated Show resolved Hide resolved
src/CDN/CloudFrontVersion3.php Outdated Show resolved Hide resolved
src/Resources/config/media.xml Outdated Show resolved Hide resolved
@greg0ire
Copy link
Contributor

how did you fix that

For anyone reading this, this PR introduces a new client for v3, and uses it in DI based on the existence of a class that exists in only one version of the package.

n4huel
n4huel previously approved these changes Oct 29, 2020
@franmomu
Copy link
Member

how did you fix that

For anyone reading this, this PR introduces a new client for v3, and uses it in DI based on the existence of a class that exists in only one version of the package.

Based on this, can we add a test for this DI change?

@phansys
Copy link
Member Author

phansys commented Oct 30, 2020

Based on this, can we add a test for this DI change?

The tests about the DI behavior were added.

@VincentLanglet VincentLanglet merged commit 8b4d771 into sonata-project:3.x Oct 30, 2020
@VincentLanglet
Copy link
Member

Thanks

@phansys phansys deleted the aws_3 branch October 30, 2020 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants