readOnlyProperties not being remembered
@ericzbeard 已經在處理了。
開始於 2022年10月13日。
評估
這個 Issue 還沒有評估資料。
描述
I have a few readOnlyProperties that aren't being set or returned when performing a delete.
My create handler looks as follows and I'm outputting the progress event before returning it:
@resource.handler(Action.CREATE)
def create_handler(
session: Optional[SessionProxy],
request: ResourceHandlerRequest,
callback_context: MutableMapping[str, Any],
) -> ProgressEvent:
model = request.desiredResourceState
awsAccountId = request.awsAccountId
region = request.region
logicalResourceIdentifier = request.logicalResourceIdentifier
LOG.debug("CREATE")
LOG.debug(callback_context)
LOG.debug(request.desiredResourceState)
try:
if isinstance(session, SessionProxy):
progress = handle_create(
aws_account_id=awsAccountId,
region=region,
agw_client=session.client("apigateway"),
lambda_client=session.client("lambda"),
dynamodb_resource=session.resource("dynamodb"),
iam_client=session.client("iam"),
model=model,
callback_context=callback_context
)
LOG.debug(progress)
return progress
else:
LOG.error("No session available")
raise TypeError
except TypeError as e:
raise exceptions.InternalFailure(f"was not expecting type {e}")
And in my logs I can see that I am setting my readOnlyProperties. EG ApiId
ProgressEvent(status=<OperationStatus.SUCCESS: 'SUCCESS'>, errorCode=None, message='', callbackContext={}, callbackDelaySeconds=0, resourceModel=ResourceModel(DefaultSender=DefaultSender(EmailAddress='[email protected]', Name=None), SenderMode='MULTIPLE', ApiId='is6k89ctyh', Templates=None, CognitoTemplates=None, Endpoint='https://1234567.execute-api.us-east-1.amazonaws.com/test', CognitoCustomMessageArn='arn:aws:lambda:us-east-1:1234567890:function:CustomMessagesLambda', Tags=None), resourceModels=None, nextToken=None)
When I DELETE the stack containing the resource I get an error because ApiId is set to None. Somewhere along the way it's being forgotten.
@resource.handler(Action.DELETE)
def delete_handler(
session: Optional[SessionProxy],
request: ResourceHandlerRequest,
callback_context: MutableMapping[str, Any],
) -> ProgressEvent:
model = request.previousResourceState
awsAccountId = request.awsAccountId
region = request.region
logicalResourceIdentifier = request.logicalResourceIdentifier
LOG.debug("DELETE")
LOG.debug(request)
try:
if isinstance(session, SessionProxy):
progress = handle_delete(
aws_account_id=awsAccountId,
region=region,
agw_client=session.client("apigateway"),
lambda_client=session.client("lambda"),
dynamodb_client=session.client("dynamodb"),
iam_client=session.client("iam"),
model=model,
callback_context=callback_context
)
return progress
else:
LOG.error("No session available")
raise TypeError
except TypeError as e:
raise exceptions.InternalFailure(f"was not expecting type {e}")
As you can see above I'm logging the entire request, which you can see here:
BaseResourceHandlerRequest(clientRequestToken='e3aa83a2-9bc8-4a35-d8b2-1234567890', desiredResourceState=ResourceModel(DefaultSender=DefaultSender(EmailAddress='[email protected]', Name=None), SenderMode='MULTIPLE', ApiId=None, Templates=None, CognitoTemplates=None, Endpoint='https://1234567.execute-api.us-east-1.amazonaws.com/test', CognitoCustomMessageArn=None, Tags=None), previousResourceState=None, desiredResourceTags=None, previousResourceTags=None, systemTags=None, previousSystemTags=None, awsAccountId='1234567890', logicalResourceIdentifier='NotificationsApi', typeConfiguration=None, nextToken=None, region='us-east-1', awsPartition='aws', stackId='arn:aws:cloudformation:us-east-1:1234567890:stack/drj-notifications-api-test/5ddc1250-2b04-11ec-9b2e-1234567890')
My Configuration JSON file looks as follows:
{
"typeName": "DRJ::Notifications::Api",
"description": "DRJ Notifications Api Resource",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
"definitions": {
"DefaultSender": {
"type": "object",
"properties": {
"EmailAddress": {
"type": "string"
},
"Name": {
"type": "string"
}
},
"required": [
"EmailAddress"
],
"additionalProperties": false
},
"Template": {
"type": "object",
"properties": {
"TemplateId": {
"type": "string"
},
"TemplateDescription": {
"type": "string"
},
"Subject": {
"type": "string"
},
"HtmlPart": {
"type": "string"
},
"TextPart": {
"type": "string"
}
},
"required": [
"Subject",
"HtmlPart",
"TextPart",
"TemplateId"
],
"additionalProperties": false
},
"CognitoTemplate": {
"type": "object",
"properties": {
"Subject": {
"type": "string"
},
"HtmlPart": {
"type": "string"
},
"TextPart": {
"type": "string"
}
},
"required": [
"Subject",
"HtmlPart",
"TextPart"
],
"additionalProperties": false
},
"CognitoTemplates": {
"type": "object",
"properties": {
"SignUp": {
"$ref": "#/definitions/CognitoTemplate"
},
"AdminCreateUser": {
"$ref": "#/definitions/CognitoTemplate"
},
"ResendCode": {
"$ref": "#/definitions/CognitoTemplate"
},
"ForgotPassword": {
"$ref": "#/definitions/CognitoTemplate"
},
"UpdateUserAttribute": {
"$ref": "#/definitions/CognitoTemplate"
},
"VerifyUserAttribute": {
"$ref": "#/definitions/CognitoTemplate"
}
},
"required": [],
"additionalProperties": false
},
"Tag": {
"description": "A key-value pair to associate with a resource.",
"type": "object",
"properties": {
"Key": {
"type": "string",
"description": "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
"minLength": 1,
"maxLength": 128
},
"Value": {
"type": "string",
"description": "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
"minLength": 0,
"maxLength": 256
}
},
"required": [
"Key",
"Value"
],
"additionalProperties": false
}
},
"properties": {
"DefaultSender" : {
"$ref": "#/definitions/DefaultSender"
},
"SenderMode": {
"type": "string",
"enum": [
"MULTIPLE",
"SINGLE"
]
},
"ApiId" : {
"type": "string"
},
"Templates": {
"type": "array",
"items": {
"$ref": "#/definitions/Template"
}
},
"CognitoTemplates": {
"$ref": "#/definitions/CognitoTemplates"
},
"Endpoint": {
"type": "string"
},
"CognitoCustomMessageArn": {
"type": "string"
},
"Tags": {
"description": "An array of key-value pairs to apply to this resource.",
"type": "array",
"uniqueItems": true,
"insertionOrder": false,
"items": {
"$ref": "#/definitions/Tag"
}
}
},
"additionalProperties": false,
"required": [
"DefaultSender"
],
"readOnlyProperties": [
"/properties/Endpoint",
"/properties/ApiId",
"/properties/CognitoCustomMessageArn"
],
"primaryIdentifier": [
"/properties/Endpoint"
],
"handlers": {
"create": {
"permissions": [
"iam:*",
"dynamodb:*",
"apigateway:*",
"lambda:*"
]
},
"read": {
"permissions": [
"iam:*",
"dynamodb:*",
"apigateway:*",
"lambda:*" ]
},
"update": {
"permissions": [
"iam:*",
"dynamodb:*",
"apigateway:*",
"lambda:*" ]
},
"delete": {
"permissions": [
"iam:*",
"dynamodb:*",
"apigateway:*",
"lambda:*" ]
},
"list": {
"permissions": [
"iam:*",
"dynamodb:*",
"apigateway:*",
"lambda:*" ]
}
}
}
- 主要語言
- Python
- 星號
- 107
- 分支
- 46
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
aws-cloudformation/cloudformation-cli-python-plugin 的其他 Issue
-
Support UV未關閉
難度 2/5 1-3 小時 新手友好度 78/100
-
Repo alive?未關閉
難度 5/5 一週以上 新手友好度 20/100
aws-cloudformation/cloudformation-cli-python-plugin#270 · 1 則留言 · 1 個 reaction ·
-
難度 3/5 1-2 天 新手友好度 45/100
-
難度 3/5 1-2 天 新手友好度 35/100
aws-cloudformation/cloudformation-cli-python-plugin#268 · 1 則留言 · 2 個 reaction ·
-
難度 3/5 1-2 天 新手友好度 35/100
aws-cloudformation/cloudformation-cli-python-plugin#264 · 1 則留言 ·
查看 aws-cloudformation/cloudformation-cli-python-plugin 的全部 Issue
相似的 Issue
-
needs-human needs-triage
難度 2/5 1-3 小時 新手友好度 76/100
gke-labs/kube-agents#2400 · 1 則留言 ·
維護者通常 1 天內回覆
-
Device Details tables: FS/SF columns contradict each other (nfet_01v8 Vt row, pfet_01v8 Idsat row)未關閉
難度 2/5 1-3 小時 新手友好度 75/100
google/skywater-pdk#450 ·
-
Drained trajectory arrays are overwritten when the sequence buffer is reused可能已有人在做 @sylvesterkaczmarek 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
google-deepmind/bsuite#56 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
LearningCircuit/local-deep-research#7206 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
chingu-voyages/V62-tier3-team-33#285 ·
維護者通常 1 天內回覆