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

Resource Link #67

Merged
merged 3 commits into from
Jan 17, 2020
Merged

Resource Link #67

merged 3 commits into from
Jan 17, 2020

Conversation

tobywf
Copy link
Contributor

@tobywf tobywf commented Dec 13, 2019

Issue #, if available: #62

Description of changes: Allow resource authors to attach template links to the schema that consumers of the schema/resources can use to generate links directly to the resource. An example might be EC2. The console link is:

https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#Instances:instanceId=i-xxxxxx

In this case, the service link might look like this:

"serviceLink": {
    "templateUri": "/ec2/home?region=${awsRegion}#Instances:instanceId=${instanceId}",
    "mappings": {
        "instanceId": "/InstanceId"
    }
},

Where awsRegion is a "global" variable (so far, the only one), and instanceId is a variable defined via a JSON pointer to a property in a resource blob (returned by e.g. READ) and not in the schema. The relative URI is debatable, but works well for the console currently. Other users outside of the console would have to maintain a mapping of console endpoints by region. The other benefit is that it lets us clearly figure out which links are AWS-internal.

For non-AWS services, an absolute, HTTPS URI can be used.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tobywf tobywf requested a review from Matt-Butler December 13, 2019 20:53
@tobywf tobywf self-assigned this Dec 13, 2019
@tobywf tobywf added the enhancement New feature or request label Dec 13, 2019
"serviceLink": {
"$comment": "This is an example of a relative, AWS-internal service link. For external links, use an absolute URI.",
"templateUri": "/tps/v2/home?region=${awsRegion}#Report:tpsCode=${TPSCode}",
"mappings": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this section? We can only pre-fill fields from the schema anyway, could the tokens in the URL just be the json-pointers directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we did consider this, but this way it might be possible to use existing templating engines, or simple regex replace. might be good for the console team to create a PoC to see how difficult/easy both would be.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

AWS::DAX::ParameterGroup is a good candidate for a proof-of-concept:

/dynamodb/home#cache-parameter-group:selected=${lowercasedResourceId}

@benkehoe
Copy link

Does this support other partitions, like China? Additionally, what if there is more than one kind of link that a provider wants to define?

@tobywf
Copy link
Contributor Author

tobywf commented Dec 20, 2019

Yes, partitions are not an issue for AWS links as they have to be relative. For external links, they can go off the region. If there's really a need for the partition, we can add that as a global variable later.

1:1 seems to make sense to keep things simple. I don't think we're keen on displaying multiple links in the stack resources tab either, could lead to a confusing UX. I'm also not aware of any use-cases for multiple links. And while that's a somewhat weak argument as people do build cool stuff with extensible systems, predicting use-cases is hard and I'm leaning towards simplicity.

@tobywf tobywf marked this pull request as ready for review December 20, 2019 19:33
@tobywf
Copy link
Contributor Author

tobywf commented Dec 20, 2019

Happy with the state of this and think it's ready for inclusion!

@aws-cloudformation aws-cloudformation deleted a comment from PatMyron Dec 23, 2019
@tobywf tobywf requested review from PatMyron and Matt-Butler January 9, 2020 19:08
@PatMyron
Copy link
Contributor

PatMyron commented Jan 17, 2020

only concerns are the discoverability of how mappings works and things like ${awsRegion} if more get supported, but we can improve that while adding more

@tobywf tobywf merged commit 1fd31cd into aws-cloudformation:master Jan 17, 2020
@tobywf tobywf deleted the deep-links branch January 17, 2020 19:57
@tobywf tobywf changed the title Service Link Resource Link Jan 17, 2020
PatMyron added a commit that referenced this pull request Feb 21, 2020
PatMyron added a commit to aws-cloudformation/aws-cloudformation-resource-providers-accessanalyzer that referenced this pull request Feb 21, 2020
PatMyron added a commit to aws-cloudformation/aws-cloudformation-resource-providers-accessanalyzer that referenced this pull request Feb 21, 2020
PatMyron added a commit to aws-cloudformation/aws-cloudformation-resource-providers-accessanalyzer that referenced this pull request Mar 5, 2020
PatMyron added a commit that referenced this pull request Mar 5, 2020
cortez7 pushed a commit that referenced this pull request Sep 3, 2020
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.

5 participants