Skip to content

Commit

Permalink
Add boolean coercion to string (#1)
Browse files Browse the repository at this point in the history
* Add boolean coercion to string

* Minor fixes

* Minor fixes

* Update cf actions
  • Loading branch information
jsoucheiron authored May 22, 2024
1 parent fd7fade commit 5e3114b
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 20 deletions.
76 changes: 76 additions & 0 deletions pycfmodel/cloudformation_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,7 @@
"cases:DeleteDomain",
"cases:DeleteField",
"cases:DeleteLayout",
"cases:DeleteRelatedItem",
"cases:DeleteTemplate",
"cases:GetCase",
"cases:GetCaseAuditEvents",
Expand Down Expand Up @@ -3490,9 +3491,11 @@
"connect:AssociateUserProficiencies",
"connect:BatchAssociateAnalyticsDataSet",
"connect:BatchDisassociateAnalyticsDataSet",
"connect:BatchGetAttachedFileMetadata",
"connect:BatchGetFlowAssociation",
"connect:BatchPutContact",
"connect:ClaimPhoneNumber",
"connect:CompleteAttachedFileUpload",
"connect:CreateAgentStatus",
"connect:CreateContactFlow",
"connect:CreateContactFlowModule",
Expand All @@ -3518,6 +3521,7 @@
"connect:CreateViewVersion",
"connect:CreateVocabulary",
"connect:DeactivateEvaluationForm",
"connect:DeleteAttachedFile",
"connect:DeleteContactEvaluation",
"connect:DeleteContactFlow",
"connect:DeleteContactFlowModule",
Expand Down Expand Up @@ -3579,6 +3583,7 @@
"connect:DisassociateTrafficDistributionGroupUser",
"connect:DisassociateUserProficiencies",
"connect:DismissUserContact",
"connect:GetAttachedFile",
"connect:GetContactAttributes",
"connect:GetCurrentMetricData",
"connect:GetCurrentUserData",
Expand Down Expand Up @@ -3654,6 +3659,7 @@
"connect:SearchUsers",
"connect:SearchVocabularies",
"connect:SendChatIntegrationEvent",
"connect:StartAttachedFileUpload",
"connect:StartChatContact",
"connect:StartContactEvaluation",
"connect:StartContactRecording",
Expand Down Expand Up @@ -3760,6 +3766,7 @@
"controltower:GetLandingZoneOperation",
"controltower:GetLandingZoneStatus",
"controltower:ListBaselines",
"controltower:ListControlOperations",
"controltower:ListDirectoryGroups",
"controltower:ListDriftDetails",
"controltower:ListEnabledBaselines",
Expand Down Expand Up @@ -6403,6 +6410,7 @@
"events:UpdateArchive",
"events:UpdateConnection",
"events:UpdateEndpoint",
"events:UpdateEventBus",
"evidently:BatchEvaluateFeature",
"evidently:CreateExperiment",
"evidently:CreateFeature",
Expand Down Expand Up @@ -7305,15 +7313,21 @@
"grafana:AssociateLicense",
"grafana:CreateWorkspace",
"grafana:CreateWorkspaceApiKey",
"grafana:CreateWorkspaceServiceAccount",
"grafana:CreateWorkspaceServiceAccountToken",
"grafana:DeleteWorkspace",
"grafana:DeleteWorkspaceApiKey",
"grafana:DeleteWorkspaceServiceAccount",
"grafana:DeleteWorkspaceServiceAccountToken",
"grafana:DescribeWorkspace",
"grafana:DescribeWorkspaceAuthentication",
"grafana:DescribeWorkspaceConfiguration",
"grafana:DisassociateLicense",
"grafana:ListPermissions",
"grafana:ListTagsForResource",
"grafana:ListVersions",
"grafana:ListWorkspaceServiceAccountTokens",
"grafana:ListWorkspaceServiceAccounts",
"grafana:ListWorkspaces",
"grafana:TagResource",
"grafana:UntagResource",
Expand Down Expand Up @@ -10454,6 +10468,7 @@
"medical-imaging:DeleteDatastore",
"medical-imaging:DeleteImageSet",
"medical-imaging:GetDICOMImportJob",
"medical-imaging:GetDICOMInstance",
"medical-imaging:GetDatastore",
"medical-imaging:GetImageFrame",
"medical-imaging:GetImageSet",
Expand Down Expand Up @@ -11544,8 +11559,13 @@
"payments:DeletePaymentInstrument",
"payments:GetPaymentInstrument",
"payments:GetPaymentStatus",
"payments:ListPaymentInstruments",
"payments:ListPaymentPreferences",
"payments:ListTagsForResource",
"payments:MakePayment",
"payments:TagResource",
"payments:UntagResource",
"payments:UpdatePaymentInstrument",
"payments:UpdatePaymentPreferences",
"pca-connector-ad:CreateConnector",
"pca-connector-ad:CreateDirectoryRegistration",
Expand Down Expand Up @@ -12110,6 +12130,7 @@
"quicksight:DescribeIAMPolicyAssignment",
"quicksight:DescribeIngestion",
"quicksight:DescribeIpRestriction",
"quicksight:DescribeKeyRegistration",
"quicksight:DescribeNamespace",
"quicksight:DescribeRefreshSchedule",
"quicksight:DescribeRoleCustomPermission",
Expand Down Expand Up @@ -12209,6 +12230,7 @@
"quicksight:UpdateIAMPolicyAssignment",
"quicksight:UpdateIdentityPropagationConfig",
"quicksight:UpdateIpRestriction",
"quicksight:UpdateKeyRegistration",
"quicksight:UpdatePublicSharingSettings",
"quicksight:UpdateRefreshSchedule",
"quicksight:UpdateResourcePermissions",
Expand Down Expand Up @@ -14255,6 +14277,9 @@
"ses:BatchGetMetricData",
"ses:CancelExportJob",
"ses:CloneReceiptRuleSet",
"ses:CreateAddonInstance",
"ses:CreateAddonSubscription",
"ses:CreateArchive",
"ses:CreateConfigurationSet",
"ses:CreateConfigurationSetEventDestination",
"ses:CreateConfigurationSetTrackingOptions",
Expand All @@ -14268,10 +14293,17 @@
"ses:CreateEmailTemplate",
"ses:CreateExportJob",
"ses:CreateImportJob",
"ses:CreateIngressPoint",
"ses:CreateReceiptFilter",
"ses:CreateReceiptRule",
"ses:CreateReceiptRuleSet",
"ses:CreateRelay",
"ses:CreateRuleSet",
"ses:CreateTemplate",
"ses:CreateTrafficPolicy",
"ses:DeleteAddonInstance",
"ses:DeleteAddonSubscription",
"ses:DeleteArchive",
"ses:DeleteConfigurationSet",
"ses:DeleteConfigurationSetEventDestination",
"ses:DeleteConfigurationSetTrackingOptions",
Expand All @@ -14284,18 +14316,30 @@
"ses:DeleteEmailTemplate",
"ses:DeleteIdentity",
"ses:DeleteIdentityPolicy",
"ses:DeleteIngressPoint",
"ses:DeleteReceiptFilter",
"ses:DeleteReceiptRule",
"ses:DeleteReceiptRuleSet",
"ses:DeleteRelay",
"ses:DeleteRuleSet",
"ses:DeleteSuppressedDestination",
"ses:DeleteTemplate",
"ses:DeleteTrafficPolicy",
"ses:DeleteVerifiedEmailAddress",
"ses:DescribeActiveReceiptRuleSet",
"ses:DescribeConfigurationSet",
"ses:DescribeReceiptRule",
"ses:DescribeReceiptRuleSet",
"ses:GetAccount",
"ses:GetAccountSendingEnabled",
"ses:GetAddonInstance",
"ses:GetAddonSubscription",
"ses:GetArchive",
"ses:GetArchiveExport",
"ses:GetArchiveMessage",
"ses:GetArchiveMessageContent",
"ses:GetArchiveSearch",
"ses:GetArchiveSearchResults",
"ses:GetBlacklistReports",
"ses:GetConfigurationSet",
"ses:GetConfigurationSetEventDestinations",
Expand All @@ -14319,11 +14363,20 @@
"ses:GetIdentityPolicies",
"ses:GetIdentityVerificationAttributes",
"ses:GetImportJob",
"ses:GetIngressPoint",
"ses:GetMessageInsights",
"ses:GetRelay",
"ses:GetRuleSet",
"ses:GetSendQuota",
"ses:GetSendStatistics",
"ses:GetSuppressedDestination",
"ses:GetTemplate",
"ses:GetTrafficPolicy",
"ses:ListAddonInstances",
"ses:ListAddonSubscriptions",
"ses:ListArchiveExports",
"ses:ListArchiveSearches",
"ses:ListArchives",
"ses:ListConfigurationSets",
"ses:ListContactLists",
"ses:ListContacts",
Expand All @@ -14337,12 +14390,16 @@
"ses:ListIdentities",
"ses:ListIdentityPolicies",
"ses:ListImportJobs",
"ses:ListIngressPoints",
"ses:ListReceiptFilters",
"ses:ListReceiptRuleSets",
"ses:ListRecommendations",
"ses:ListRelays",
"ses:ListRuleSets",
"ses:ListSuppressedDestinations",
"ses:ListTagsForResource",
"ses:ListTemplates",
"ses:ListTrafficPolicies",
"ses:ListVerifiedEmailAddresses",
"ses:PutAccountDedicatedIpWarmupAttributes",
"ses:PutAccountDetails",
Expand Down Expand Up @@ -14381,11 +14438,16 @@
"ses:SetIdentityMailFromDomain",
"ses:SetIdentityNotificationTopic",
"ses:SetReceiptRulePosition",
"ses:StartArchiveExport",
"ses:StartArchiveSearch",
"ses:StopArchiveExport",
"ses:StopArchiveSearch",
"ses:TagResource",
"ses:TestRenderEmailTemplate",
"ses:TestRenderTemplate",
"ses:UntagResource",
"ses:UpdateAccountSendingEnabled",
"ses:UpdateArchive",
"ses:UpdateConfigurationSetEventDestination",
"ses:UpdateConfigurationSetReputationMetricsEnabled",
"ses:UpdateConfigurationSetSendingEnabled",
Expand All @@ -14395,8 +14457,12 @@
"ses:UpdateCustomVerificationEmailTemplate",
"ses:UpdateEmailIdentityPolicy",
"ses:UpdateEmailTemplate",
"ses:UpdateIngressPoint",
"ses:UpdateReceiptRule",
"ses:UpdateRelay",
"ses:UpdateRuleSet",
"ses:UpdateTemplate",
"ses:UpdateTrafficPolicy",
"ses:VerifyDomainDkim",
"ses:VerifyDomainIdentity",
"ses:VerifyEmailAddress",
Expand Down Expand Up @@ -15792,6 +15858,12 @@
"ts:StartExecution",
"ts:TagResource",
"ts:UntagResource",
"user-subscriptions:CreateClaim",
"user-subscriptions:DeleteClaim",
"user-subscriptions:ListApplicationClaims",
"user-subscriptions:ListClaims",
"user-subscriptions:ListUserSubscriptions",
"user-subscriptions:UpdateClaim",
"vendor-insights:ActivateSecurityProfile",
"vendor-insights:AssociateDataSource",
"vendor-insights:CreateDataSource",
Expand Down Expand Up @@ -16223,18 +16295,21 @@
"wisdom:CreateAssistant",
"wisdom:CreateAssistantAssociation",
"wisdom:CreateContent",
"wisdom:CreateContentAssociation",
"wisdom:CreateKnowledgeBase",
"wisdom:CreateQuickResponse",
"wisdom:CreateSession",
"wisdom:DeleteAssistant",
"wisdom:DeleteAssistantAssociation",
"wisdom:DeleteContent",
"wisdom:DeleteContentAssociation",
"wisdom:DeleteImportJob",
"wisdom:DeleteKnowledgeBase",
"wisdom:DeleteQuickResponse",
"wisdom:GetAssistant",
"wisdom:GetAssistantAssociation",
"wisdom:GetContent",
"wisdom:GetContentAssociation",
"wisdom:GetContentSummary",
"wisdom:GetImportJob",
"wisdom:GetKnowledgeBase",
Expand All @@ -16243,6 +16318,7 @@
"wisdom:GetSession",
"wisdom:ListAssistantAssociations",
"wisdom:ListAssistants",
"wisdom:ListContentAssociations",
"wisdom:ListContents",
"wisdom:ListImportJobs",
"wisdom:ListKnowledgeBases",
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from contextlib import suppress
from typing import Union

from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, ValidationError, field_validator, model_validator
from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_validator
from typing_extensions import Annotated

from pycfmodel.model.base import FunctionDict
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/ec2_vpc_endpoint_policy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument as resource_policy_document
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/es_domain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.generic import ResolvableGeneric
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/iam_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy import Policy
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/iam_managed_policy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/iam_policy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/iam_role.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy import Policy
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/iam_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, Dict, List, Literal, Optional
from typing import Dict, List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.parameter import Parameter
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/kms_key.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/opensearch_domain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.generic import ResolvableGeneric
Expand Down
9 changes: 9 additions & 0 deletions pycfmodel/model/resources/properties/tag.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pydantic import ConfigDict, field_validator

from pycfmodel.model.resources.properties.property import Property
from pycfmodel.model.types import ResolvableStr

Expand All @@ -9,5 +11,12 @@ class Tag(Property):
More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html)
"""

model_config = ConfigDict(Property.model_config, coerce_numbers_to_str=True)
Key: ResolvableStr
Value: ResolvableStr

@field_validator("Value", mode="before")
def coerce_bools_to_strings(cls, v):
if isinstance(v, bool):
return str(v)
return v
2 changes: 0 additions & 2 deletions pycfmodel/model/resources/resource.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Any, ClassVar, Dict, List, Optional

from pydantic import field_validator

from pycfmodel.model.base import CustomModel
from pycfmodel.model.generic import Generic
from pycfmodel.model.parameter import Parameter
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/s3_bucket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional
from typing import List, Literal, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.generic import ResolvableGeneric
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/s3_bucket_policy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal
from typing import List, Literal

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
Expand Down
2 changes: 1 addition & 1 deletion pycfmodel/model/resources/security_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, List, Literal, Optional, Union
from typing import List, Literal, Optional, Union

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.security_group_egress_prop import SecurityGroupEgressProp
Expand Down
Loading

0 comments on commit 5e3114b

Please sign in to comment.