Skip to content

Commit 1e79ad0

Browse files
authored
Merge pull request #40 from leonardoviveiros/master
Fixed misleading comment about stars in resources, and added link to docs
2 parents 53b1372 + d49eb6a commit 1e79ad0

File tree

4 files changed

+47
-13
lines changed

4 files changed

+47
-13
lines changed

blueprints/dotnet/src/APIGatewayAuthorizerHandler/AuthPolicyBuilder.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,20 @@ public AuthPolicyBuilder(string principalId, string awsAccountId, ApiOptions api
5858
{
5959
PrincipalId = principalId;
6060
AwsAccountId = awsAccountId;
61-
62-
// Replace the placeholder value with a default API Gateway API id, or '*' for all APIs.
61+
62+
// Replace the placeholder value with a default API Gateway API id to be used in the policy.
63+
// Beware of using '*' since it will not simply mean any API Gateway API id, because stars will greedily expand over '/' or other separators.
64+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
6365
_restApiId = string.IsNullOrWhiteSpace(apiOptions?.RestApiId) ? "<<restApiId>>" : apiOptions.RestApiId;
6466

65-
// Replace the placeholder value with a default region where the API is deployed, or '*' for all regions.
67+
// Replace the placeholder value with a default region to be used in the policy.
68+
// Beware of using '*' since it will not simply mean any region, because stars will greedily expand over '/' or other separators.
69+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
6670
_region = string.IsNullOrWhiteSpace(apiOptions?.Region) ? "<<region>>" : apiOptions.Region;
6771

68-
// Replace the placeholder value with a default stage name used in the policy, or '*' for all stages.
72+
// Replace the placeholder value with a default stage to be used in the policy.
73+
// Beware of using '*' since it will not simply mean any stage, because stars will greedily expand over '/' or other separators.
74+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
6975
_stage = string.IsNullOrWhiteSpace(apiOptions?.Stage) ? "<<stage>>" : apiOptions.Stage;
7076
}
7177

blueprints/go/main.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,21 @@ func NewAuthorizerResponse(principalID string, AccountID string) *AuthorizerResp
155155
Version: "2012-10-17",
156156
},
157157
},
158-
Region: "<<region>>", // Replace the placeholder value with the region where the API is deployed, or '*' for all regions.
158+
// Replace the placeholder value with a default region to be used in the policy.
159+
// Beware of using '*' since it will not simply mean any region, because stars will greedily expand over '/' or other separators.
160+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
161+
Region: "<<region>>",
159162
AccountID: AccountID,
160-
APIID: "<<restApiId>>", // Replace the placeholder value with an API Gateway API id, or '*' for all APIs.
161-
Stage: "<<stage>>", // Replace the placeholder value with the name of the stage used in the policy, or '*' for all stages.
163+
164+
// Replace the placeholder value with a default API Gateway API id to be used in the policy.
165+
// Beware of using '*' since it will not simply mean any API Gateway API id, because stars will greedily expand over '/' or other separators.
166+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
167+
APIID: "<<restApiId>>",
168+
169+
// Replace the placeholder value with a default stage to be used in the policy.
170+
// Beware of using '*' since it will not simply mean any stage, because stars will greedily expand over '/' or other separators.
171+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
172+
Stage: "<<stage>>",
162173
}
163174
}
164175

blueprints/nodejs/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,26 @@ function AuthPolicy(principal, awsAccountId, apiOptions) {
140140
this.denyMethods = [];
141141

142142
if (!apiOptions || !apiOptions.restApiId) {
143-
this.restApiId = "<<restApiId>>"; // Replace the placeholder value with a default API Gateway API id, or '*' for all APIs.
143+
// Replace the placeholder value with a default API Gateway API id to be used in the policy.
144+
// Beware of using '*' since it will not simply mean any API Gateway API id, because stars will greedily expand over '/' or other separators.
145+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
146+
this.restApiId = "<<restApiId>>";
144147
} else {
145148
this.restApiId = apiOptions.restApiId;
146149
}
147150
if (!apiOptions || !apiOptions.region) {
148-
this.region = "<<region>>"; // Replace the placeholder value with a default region where the API is deployed, or '*' for all regions.
151+
// Replace the placeholder value with a default region to be used in the policy.
152+
// Beware of using '*' since it will not simply mean any region, because stars will greedily expand over '/' or other separators.
153+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
154+
this.region = "<<region>>";
149155
} else {
150156
this.region = apiOptions.region;
151157
}
152158
if (!apiOptions || !apiOptions.stage) {
153-
this.stage = "<<stage>>"; // Replace the placeholder value with a default stage name used in the policy, or '*' for all stages.
159+
// Replace the placeholder value with a default stage to be used in the policy.
160+
// Beware of using '*' since it will not simply mean any stage, because stars will greedily expand over '/' or other separators.
161+
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details.
162+
this.stage = "<<stage>>";
154163
} else {
155164
this.stage = apiOptions.stage;
156165
}

blueprints/python/api-gateway-authorizer-python.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,19 @@ class AuthPolicy(object):
100100

101101

102102
restApiId = "<<restApiId>>"
103-
"""Replace the placeholder value with an API Gateway API id, or '*' for all APIs."""
103+
""" Replace the placeholder value with a default API Gateway API id to be used in the policy.
104+
Beware of using '*' since it will not simply mean any API Gateway API id, because stars will greedily expand over '/' or other separators.
105+
See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details. """
106+
104107
region = "<<region>>"
105-
"""Replace the placeholder value with the region where the API is deployed, or '*' for all regions."""
108+
""" Replace the placeholder value with a default region to be used in the policy.
109+
Beware of using '*' since it will not simply mean any region, because stars will greedily expand over '/' or other separators.
110+
See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details. """
111+
106112
stage = "<<stage>>"
107-
"""Replace the placeholder value with the name of the stage used in the policy, or '*' for all stages."""
113+
""" Replace the placeholder value with a default stage to be used in the policy.
114+
Beware of using '*' since it will not simply mean any stage, because stars will greedily expand over '/' or other separators.
115+
See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html for more details. """
108116

109117
def __init__(self, principal, awsAccountId):
110118
self.awsAccountId = awsAccountId

0 commit comments

Comments
 (0)