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

add action for audience-manager-cd #39

Merged
merged 10 commits into from
May 12, 2020
Merged

add action for audience-manager-cd #39

merged 10 commits into from
May 12, 2020

Conversation

chiarabdy
Copy link
Contributor

@chiarabdy chiarabdy commented Apr 30, 2020

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@chiarabdy chiarabdy requested a review from moritzraho April 30, 2020 16:03
@codecov
Copy link

codecov bot commented Apr 30, 2020

Codecov Report

Merging #39 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #39   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        18    +1     
  Lines          302       311    +9     
  Branches        39        39           
=========================================
+ Hits           302       311    +9     
Impacted Files Coverage Δ
generators/add-action/analytics/index.js 100.00% <ø> (ø)
generators/add-action/campaign-standard/index.js 100.00% <ø> (ø)
generators/add-action/customer-profile/index.js 100.00% <ø> (ø)
generators/add-action/generic/index.js 100.00% <ø> (ø)
generators/add-action/index.js 100.00% <ø> (ø)
generators/add-action/target/index.js 100.00% <ø> (ø)
lib/constants.js 100.00% <ø> (ø)
generators/add-action/audience-manager-cd/index.js 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd54ad3...3eea407. Read the comment docs.

@meryllblanchet meryllblanchet added the enhancement New feature or request label May 4, 2020
@chiarabdy chiarabdy force-pushed the audienceManager-cd branch from 70ba75f to 9170f4f Compare May 4, 2020 12:28
@chiarabdy chiarabdy force-pushed the audienceManager-cd branch from eb4c498 to e918869 Compare May 5, 2020 09:03
Copy link
Member

@moritzraho moritzraho left a comment

Choose a reason for hiding this comment

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

@chiarabdy Thanks a lot for your PR, it's a nice one!
I've added a few comments regarding a change that has happened where the orgId should not be passed as a default param but is passed through the request header x-gw-ims-org-id.
A part from this and a few nitpicks, not much to say 😄

const audienceManagerClient = await AudienceManagerCD.init(params.orgId, params.apiKey, token)

// get Customer Profile from Audience Manager Customer Data API
const profiles = await audienceManagerClient.getProfile(
Copy link
Member

Choose a reason for hiding this comment

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

some formatting here:

  await audienceManagerClient.getProfile({
    dataSourceId: params.dataSourceId,
    id: params.id
  })

this.props = {
description: 'This is a sample action showcasing how to access the Adobe Audience Manager Customer Data API',
// eslint-disable-next-line quotes
requiredParams: `['apiKey', 'orgId']`,
Copy link
Member

Choose a reason for hiding this comment

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

Ok so two things regarding requiredParams:

  1. you did good adding the requiredParams for default (.env and manifest) variables, but you should also add it for request parameters: so add dataSourceId and id
  2. There is a new change where orgId is passed as a header through x-gw-ims-org-id, could you do the same change as in https://github.com/adobe/generator-aio-app/pull/44/files#diff-33c1a44418497d1f2fddbe457c86e7e3R24-R29 ? That also means that orgId is not a default variable in your case anymore (should not be added to manifest and .env)

Copy link
Contributor Author

@chiarabdy chiarabdy May 11, 2020

Choose a reason for hiding this comment

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

awesome
according to the last changes of orgId from requiredparams to requiredheaders
i will have to change the stub-action.js as well to pass my tests, but in this case the other action templates tests will failed because of the existing orgId as a paramters too
i will push the changes after your pull request been merged

Copy link
Member

Choose a reason for hiding this comment

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

Hi @chiarabdy good point thanks for pointing this out, the PR just got merged now :)

dotenvStub: {
label: 'please provide your Adobe I/O Audience Manager Customer Data integration org id and api key',
vars: [
'AUDIENCE_MANAGER_CD_ORG_ID',
Copy link
Member

Choose a reason for hiding this comment

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

as mentioned above remove org id here

]
},
actionManifestConfig: {
inputs: { LOG_LEVEL: 'debug', orgId: '$AUDIENCE_MANAGER_CD_ORG_ID', apiKey: '$AUDIENCE_MANAGER_CD_API_KEY' },
Copy link
Member

Choose a reason for hiding this comment

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

as mentioned above remove org id here

mockLoggerInstance.error.mockReset()
})

const fakeRequestParams = { orgId: 'fakeId', apiKey: 'fakeKey', __ow_headers: { authorization: 'Bearer fakeToken' } }
Copy link
Member

Choose a reason for hiding this comment

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

you will need to change the tests because the orgId is now passed via __ow_headers: { 'x-gw-ims-org-id' you can take a look at changes done here https://github.com/adobe/generator-aio-app/pull/44/files#diff-380b645bdf12ec16bd303d123d4cba0a it's probably similar for you

Copy link
Member

Choose a reason for hiding this comment

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

this will also need to change accordingly when adding the id and dataSourceId as requiredParams

@chiarabdy chiarabdy force-pushed the audienceManager-cd branch from d90d630 to ab0782d Compare May 11, 2020 09:13
}
})
})
})
Copy link
Member

Choose a reason for hiding this comment

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

newline missing? or bad indentation?

label: '## please provide your Adobe I/O Audience Manager Customer Data integration api key, id and dataSourceId',
vars: [
'AUDIENCE_MANAGER_API_KEY',
'AUDIENCE_MANAGER_ID',
Copy link
Member

Choose a reason for hiding this comment

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

Id and dataSourceId are request parameters, not default parameters you only need AUDIENCE_MANAGER_API_KEY

@chiarabdy chiarabdy force-pushed the audienceManager-cd branch from 74792ce to d148d33 Compare May 11, 2020 16:27
@moritzraho
Copy link
Member

@chiarabdy lgtm !

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

Successfully merging this pull request may close these issues.

3 participants