How to use the pycfmodel.model.base.CustomModel function in pycfmodel

To help you get started, we’ve selected a few pycfmodel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Skyscanner / pycfmodel / pycfmodel / model / resources / s3_bucket_policy.py View on Github external
from typing import ClassVar

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.types import Resolvable, ResolvableStr


class S3BucketPolicyProperties(CustomModel):
    """
    Properties:

    - Bucket: Name of the Amazon S3 bucket to which the policy applies.
    - PolicyDocument: A [policy document][pycfmodel.model.resources.properties.policy_document.PolicyDocument] object.

    More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-policy.html)
    """

    Bucket: ResolvableStr
    PolicyDocument: Resolvable[PolicyDocument]


class S3BucketPolicy(Resource):
    """
    Properties:
github Skyscanner / pycfmodel / pycfmodel / model / resources / iam_managed_policy.py View on Github external
from typing import ClassVar, List, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.types import Resolvable, ResolvableStr


class IAMManagedPolicyProperties(CustomModel):
    """
    Properties:

    - Description: Description of the policy.
    - Groups: Friendly name of the IAM groups to attach the policy to.
    - ManagedPolicyName: Name of the policy.
    - Path: Path to the policy.
    - PolicyDocument: A [policy document][pycfmodel.model.resources.properties.policy_document.PolicyDocument] object.
    - Roles: Friendly name of the IAM roles to attach the policy to.
    - Users: Friendly name of the IAM users to attach the policy to.

    More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html)
    """

    Description: Optional[ResolvableStr] = None
    Groups: Optional[Resolvable[List[ResolvableStr]]] = None
github Skyscanner / pycfmodel / pycfmodel / model / resources / security_group.py View on Github external
from typing import ClassVar, Dict, List, Optional, Union

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.security_group_egress_prop import SecurityGroupEgressProp
from pycfmodel.model.resources.properties.security_group_ingress_prop import SecurityGroupIngressProp
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.types import Resolvable, ResolvableStr


class SecurityGroupProperties(CustomModel):
    """
    Properties:

    - GroupDescription: Description for the security group.
    - GroupName: Name of the security group.
    - SecurityGroupEgress: Outbound rules associated with the security group.
    - SecurityGroupIngress: Inbound rules associated with the security group.
    - Tags: Array of key-value pairs.
    - VpcId: ID of the VPC for the security group.

    More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html)
    """

    GroupDescription: ResolvableStr
    GroupName: Optional[ResolvableStr] = None
    SecurityGroupEgress: Optional[
github Skyscanner / pycfmodel / pycfmodel / model / parameter.py View on Github external
from typing import Any, ClassVar, List, Optional

from pydantic import PositiveInt

from pycfmodel.model.base import CustomModel


class Parameter(CustomModel):
    """
    CloudFormation Parameter object representation
    """

    NO_ECHO_NO_DEFAULT: ClassVar[str] = "NO_ECHO_NO_DEFAULT"
    NO_ECHO_WITH_DEFAULT: ClassVar[str] = "NO_ECHO_WITH_DEFAULT"
    NO_ECHO_WITH_VALUE: ClassVar[str] = "NO_ECHO_WITH_VALUE"
    AllowedPattern: Optional[str] = None
    AllowedValues: Optional[List] = None
    ConstraintDescription: Optional[str] = None
    Default: Optional[Any] = None
    Description: Optional[str] = None
    MaxLength: Optional[PositiveInt] = None
    MaxValue: Optional[PositiveInt] = None
    MinLength: Optional[int] = None
    MinValue: Optional[int] = None
github Skyscanner / pycfmodel / pycfmodel / model / resources / iam_group.py View on Github external
from typing import ClassVar, List, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.iam_policy import IAMPolicy
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.types import Resolvable, ResolvableStr


class IAMGroupProperties(CustomModel):
    """
    Properties:

    - GroupName: Name of the group.
    - ManagedPolicyArns: ARN of the IAM policies to attach.
    - Path: Path to the group. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html).
    - Policies: Inline policies embedded in the IAM group.

    More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html)
    """

    GroupName: Optional[ResolvableStr] = None
    ManagedPolicyArns: Optional[Resolvable[List[ResolvableStr]]] = None
    Path: Optional[ResolvableStr] = None
    Policies: Optional[Resolvable[List[IAMPolicy]]] = None
github Skyscanner / pycfmodel / pycfmodel / model / cf_model.py View on Github external
from datetime import date
from typing import Any, ClassVar, Collection, Dict, List, Optional, Type, Union

from pycfmodel.constants import AWS_NOVALUE
from pycfmodel.model.base import CustomModel
from pycfmodel.model.parameter import Parameter
from pycfmodel.model.resources.generic_resource import GenericResource
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.resources.types import ResourceModels
from pycfmodel.model.types import Resolvable
from pycfmodel.resolver import _extended_bool, resolve


class CFModel(CustomModel):
    """
    Template that describes AWS infrastructure.

    Properties:

    - AWSTemplateFormatVersion
    - Conditions: Conditions that control behaviour of the template.
    - Description: Description for the template.
    - Mappings: A 3 level mapping of keys and associated values.
    - Metadata: Additional information about the template.
    - Outputs: Output values of the template.
    - Parameters: Parameters to the template.
    - Resources: Stack resources and their properties.
    - Rules
    - Transform: For serverless applications, specifies the version of the AWS Serverless Application Model (AWS SAM) to use.
github Skyscanner / pycfmodel / pycfmodel / model / resources / iam_role.py View on Github external
from typing import ClassVar, List, Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy import Policy
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.types import Resolvable, ResolvableIntOrStr, ResolvableStr


class IAMRoleProperties(CustomModel):
    """
    Properties:

    - AssumeRolePolicyDocument: A [policy document][pycfmodel.model.resources.properties.policy_document.PolicyDocument] object.
    - ManagedPolicyArns: List of ARNs of the IAM managed policies to attach.
    - MaxSessionDuration: Maximum session duration (in seconds).
    - Path: Path to the role.
    - PermissionsBoundary: ARN of the policy used to set the permissions boundary.
    - Policies: A list of [policy][pycfmodel.model.resources.properties.policy.Policy] objects.
    - RoleName: Name of the role.

    More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)
    """

    AssumeRolePolicyDocument: Resolvable[PolicyDocument]
    ManagedPolicyArns: Optional[Resolvable[List[ResolvableStr]]] = None
github Skyscanner / pycfmodel / pycfmodel / model / resources / properties / property.py View on Github external
from typing import Optional

from pycfmodel.model.base import CustomModel
from pycfmodel.model.types import ResolvableCondition


class Property(CustomModel):
    """
    This class is used for all property types that we haven't had time to implement yet.

    Properties:

    - Condition
    """

    Condition: Optional[ResolvableCondition] = None
github Skyscanner / pycfmodel / pycfmodel / model / resources / resource.py View on Github external
from typing import ClassVar, Dict, Optional

from pydantic import validator

from pycfmodel.model.base import CustomModel
from pycfmodel.model.parameter import Parameter
from pycfmodel.model.types import ResolvableCondition, ResolvableStr, ResolvableStrOrList


class Resource(CustomModel):
    TYPE_VALUE: ClassVar[str]
    Type: str
    Condition: Optional[ResolvableCondition] = None
    CreatePolicy: Optional[Dict] = None
    DeletionPolicy: Optional[ResolvableStr] = None
    DependsOn: Optional[ResolvableStrOrList] = None
    Metadata: Optional[Dict] = None
    UpdatePolicy: Optional[Dict] = None
    UpdateReplacePolicy: Optional[ResolvableStr] = None

    @validator("Type")
    def check_type(cls, value):
        if value != cls.TYPE_VALUE:
            raise ValueError(f"Value needs to be {cls.TYPE_VALUE}")
        return value
github Skyscanner / pycfmodel / pycfmodel / model / resources / sqs_queue_policy.py View on Github external
from typing import ClassVar, List

from pycfmodel.model.base import CustomModel
from pycfmodel.model.resources.properties.policy_document import PolicyDocument
from pycfmodel.model.resources.resource import Resource
from pycfmodel.model.types import Resolvable, ResolvableStr


class SQSQueuePolicyProperties(CustomModel):
    """
    Properties:

    - PolicyDocument: A [policy document][pycfmodel.model.resources.properties.policy_document.PolicyDocument] object.
    - Queues: URLs of the queues to add the policy.

    More info at [AWS Docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html)
    """

    PolicyDocument: Resolvable[PolicyDocument]
    Queues: Resolvable[List[ResolvableStr]]


class SQSQueuePolicy(Resource):
    """
    Properties: