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

Support for AWS SSO + custom attributes to configure SNS platform app #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarcPerezPro
Copy link

@MarcPerezPro MarcPerezPro commented Jun 24, 2021

This commit adds the possibility to pass an AWS SNS client, which can be initialized with AWS SSO credentials. It also makes the code unit testable by providing a client with stub_responses. I updated the Unit Tests in this PR.

We also needed to configure the SNS platform app with various attributes like EventEndpointCreated, so I added a parameter for that. The full list of SNS platform application attributes can be found here.

Our use-case :

sns_app_arn = aws_sns(
  aws_sns_client: Aws::SNS::Client.new,
  platform: 'FCM', # Firebase Cloud Messaging
  platform_fcm_server_key: platform_fcm_server_key,
  platform_name: platform_name,
  update_if_exists: true, # In case we need to rerun this lane.
  attributes_override: {
    EventEndpointCreated: "arn:aws:sns:#{region}:#{account}:bFanCreateEvents",
    EventEndpointUpdated: "arn:aws:sns:#{region}:#{account}:bFanUpdateEvents",
    EventEndpointDeleted: "arn:aws:sns:#{region}:#{account}:bFanDeleteEvents"
  }
)

@MarcPerezPro MarcPerezPro force-pushed the feature/attributes_override branch 2 times, most recently from 1bd8f6c to c2e3503 Compare June 25, 2021 20:56
@MarcPerezPro MarcPerezPro changed the title DRAFT attributes_override + AWS SSO Support Support for AWS SSO + custom attributes to configure SNS platform app Jun 25, 2021
@MarcPerezPro MarcPerezPro marked this pull request as ready for review June 25, 2021 21:05
Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like these changes! I think my one question is if :access_key, :secret_access_key, and :region should be optional / conflict with :client 🤷‍♂️ Thoughts?

lib/fastlane/plugin/aws_sns/actions/aws_sns_action.rb Outdated Show resolved Hide resolved
lib/fastlane/plugin/aws_sns/actions/aws_sns_action.rb Outdated Show resolved Hide resolved
lib/fastlane/plugin/aws_sns/actions/aws_sns_action.rb Outdated Show resolved Hide resolved
@MarcPerezPro
Copy link
Author

I really like these changes! I think my one question is if :access_key, :secret_access_key, and :region should be optional / conflict with :client 🤷‍♂️ Thoughts?

Hey Josh,
I am a big fan of your work on Fastlane ❤️

I read the code from config_item.rb and tried to modernize the available_options. I made the :access_key, :secret_access_key, and :region conflict with :aws_sns_client.
Let me know if I got something wrong.

Also I'd love to know how you test individual Actions, I tried to update my smoke tests based on an official actions spec file. I think I'll get the hang of it with time.

@joshdholtz
Copy link
Member

@return-main Hey! So sorry I missed this response 😱 Are you still using this and interested in getting this merged? 😇

I haven't personally used this in a while so I don't have a good testing environment setup for it but I'll get something setup if this is still something you think should be merged in! 😊

This commit adds the possibility to pass an AWS SNS client, which can be initialized with AWS SSO credentials. It also makes the code unit testable by providing a client with stub_responses (I'll make a separate PR for that).
We also needed to configure the SNS platform app with various attributes like EventEndpointCreated, so I added a parameter for that. The full list of SNS platform application attributes can be found here: https://docs.aws.amazon.com/sns/latest/api/API_SetPlatformApplicationAttributes.html .
@MarcPerezPro
Copy link
Author

MarcPerezPro commented Mar 7, 2022

Hi @joshdholtz
No worries, I know you've been busy with your family 😄

I put this in our production fastlane/Pluginfile in the meantime:

# Replace with
# gem 'fastlane-plugin-aws_sns'
# when https://github.com/fastlane-community/fastlane-plugin-aws_sns/pull/7 is merged
gem 'fastlane-plugin-aws_sns', git: 'https://github.com/return-main/fastlane-plugin-aws_sns.git', branch: 'feature/attributes_override'

We are still interested in getting it merged, so I retested my code and squashed the commits for #7 and #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants