class VaultSecretGroup(
        Model):  # belongs to VmScaleSet >> VirtualMachineScaleSetVMProfile
    source_vault = ModelType(SubResource, serialize_when_none=False)
    vault_certificates = ListType(ModelType(VaultCertificate),
                                  serialize_when_none=False)
Exemplo n.º 2
0
class UserResource(IAMResource):
    cloud_service_type = StringType(default='User')
    data = ModelType(User)
    _metadata = ModelType(CloudServiceMeta, default=user_metadata, serialized_name='metadata')
Exemplo n.º 3
0
class PolicyResource(IAMResource):
    cloud_service_type = StringType(default='Policy')
    data = ModelType(Policy)
    _metadata = ModelType(CloudServiceMeta, default=policy_metadata, serialized_name='metadata')
Exemplo n.º 4
0
 class Card(Model):
     user = ModelType(User)
Exemplo n.º 5
0
 class M(Model):
     m = ListType(ModelType('M', required=True), required=True)
Exemplo n.º 6
0
class TableResource(DynamoDBResource):
    cloud_service_type = StringType(default='Table')
    data = ModelType(Table)
    _metadata = ModelType(CloudServiceMeta,
                          default=metadata,
                          serialized_name='metadata')
class DeliveryStreamResource(FirehoseResource):  # service type - name
    cloud_service_type = StringType(default="DeliveryStream")
    data = ModelType(DeliveryStreamDescription)
    _metadata = ModelType(
        CloudServiceMeta, default=firehose_meta, serialized_name="metadata"
    )
class VirtualMachineScaleSetVMNetworkProfileConfiguration(Model):
    network_interface_configurations = ListType(
        ModelType(VirtualMachineScaleSetNetworkConfiguration),
        serialize_when_none=False)
class VirtualMachineAgentInstanceView(Model):
    statuses = ListType(ModelType(InstanceViewStatus),
                        serialize_when_none=False)
    vm_agent_version = StringType(serialize_when_none=False)
    display_status = StringType(serialize_when_none=False)  # #
Exemplo n.º 10
0
class StorageProfile(Model):
    data_disks = ListType(ModelType(DataDisk), serialize_when_none=False)
    image_reference = ModelType(ImageReference, serialize_when_none=False)
    os_disk = ModelType(OSDisk, serialize_when_none=False)
Exemplo n.º 11
0
class NetworkProfile(Model):  # belongs to VirtualMachineScaleSetVM
    network_interfaces = ListType(ModelType(NetworkInterfaceReference),
                                  serialize_when_none=False)
Exemplo n.º 12
0
class DiskEncryptionSettings(Model):
    disk_encryption_key = ModelType(KeyVaultSecretReference,
                                    serialize_when_none=False)
    enabled = BooleanType(serialize_when_none=False)
    key_encryption_key = ModelType(KeyVaultKeyReference,
                                   serialize_when_none=False)
Exemplo n.º 13
0
class KeyVaultKeyReference(Model):
    key_url = StringType(serialize_when_none=False)
    source_vault = ModelType(SubResource, serialize_when_none=False)
Exemplo n.º 14
0
class VirtualMachineScaleSetManagedDiskParameters(Model):
    # belongs to VmScaleSet >> VirtualMachineScaleSetVMProfile
    # >> VirtualMachineScaleSetStorageProfile >> VirtualMachineScaleSetDataDisk
    disk_encryption_set = ModelType(DiskEncryptionSetParameters,
                                    serialize_when_none=False)
    storage_account_type = StringType(serialize_when_none=False)
Exemplo n.º 15
0
class Config(Model):
    """This is the Python representation of a stacker config file.

    This is used internally by stacker to parse and validate a yaml formatted
    stacker configuration file, but can also be used in scripts to generate a
    stacker config file before handing it off to stacker to build/destroy.

    Example::

        from stacker.config import dump, Config, Stack

        vpc = Stack({
            "name": "vpc",
            "class_path": "blueprints.VPC"})

        config = Config()
        config.namespace = "prod"
        config.stacks = [vpc]

        print dump(config)

    """

    namespace = StringType(required=True)

    namespace_delimiter = StringType(serialize_when_none=False)

    stacker_bucket = StringType(serialize_when_none=False)

    stacker_bucket_region = StringType(serialize_when_none=False)

    stacker_cache_dir = StringType(serialize_when_none=False)

    sys_path = StringType(serialize_when_none=False)

    package_sources = ModelType(PackageSources, serialize_when_none=False)

    service_role = StringType(serialize_when_none=False)

    pre_build = ListType(ModelType(Hook), serialize_when_none=False)

    post_build = ListType(ModelType(Hook), serialize_when_none=False)

    pre_destroy = ListType(ModelType(Hook), serialize_when_none=False)

    post_destroy = ListType(ModelType(Hook), serialize_when_none=False)

    tags = DictType(StringType, serialize_when_none=False)

    template_indent = StringType(serialize_when_none=False)

    mappings = DictType(DictType(DictType(StringType)),
                        serialize_when_none=False)

    lookups = DictType(StringType, serialize_when_none=False)

    targets = ListType(ModelType(Target), serialize_when_none=False)

    stacks = ListType(ModelType(Stack), default=[])

    def _remove_excess_keys(self, data):
        excess_keys = set(data.keys())
        excess_keys -= self._schema.valid_input_keys
        if not excess_keys:
            return data

        logger.debug('Removing excess keys from config input: %s', excess_keys)
        clean_data = data.copy()
        for key in excess_keys:
            del clean_data[key]

        return clean_data

    def _convert(self, raw_data=None, context=None, **kwargs):
        if raw_data is not None:
            # Remove excess top-level keys, since we want to allow them to be
            # used for custom user variables to be reference later. This is
            # preferable to just disabling strict mode, as we can still
            # disallow excess keys in the inner models.
            raw_data = self._remove_excess_keys(raw_data)

        return super(Config, self)._convert(raw_data=raw_data,
                                            context=context,
                                            **kwargs)

    def validate(self, *args, **kwargs):
        try:
            return super(Config, self).validate(*args, **kwargs)
        except UndefinedValueError as e:
            raise exceptions.InvalidConfig([e.message])
        except SchematicsError as e:
            raise exceptions.InvalidConfig(e.errors)

    def validate_stacks(self, data, value):
        if value:
            stack_names = [stack.name for stack in value]
            if len(set(stack_names)) != len(stack_names):
                # only loop / enumerate if there is an issue.
                for i, stack_name in enumerate(stack_names):
                    if stack_names.count(stack_name) != 1:
                        raise ValidationError(
                            "Duplicate stack %s found at index %d." %
                            (stack_name, i))
Exemplo n.º 16
0
class VirtualMachineScaleSetVM(Model):  # data model for actual instances
    id = StringType()
    instance_id = IntType()
    location = StringType()
    name = StringType()
    plan = ModelType(Plan, serialize_when_none=False)
    additional_capabilities = ModelType(AdditionalCapabilities,
                                        serialize_when_none=False)
    available_set = ModelType(SubResource, serialize_when_none=False)
    diagnostics_profile = ModelType(DiagnosticsProfile,
                                    serialize_when_none=False)
    hardware_profile = ModelType(HardwareProfile, serialize_when_none=False)
    latest_model_applied = BooleanType(default=True, serialize_when_none=False)
    licence_type = StringType(serialize_when_none=False)
    model_definition_applied = StringType(serialize_when_none=False)
    network_profile = ModelType(NetworkProfile, serialize_when_none=False)
    network_profile_configuration = ModelType(
        VirtualMachineScaleSetVMNetworkProfileConfiguration,
        serialize_when_none=False)
    primary_vnet = StringType(serialize_when_none=False)
    os_profile = ModelType(OSProfile, serialize_when_none=False)
    protection_policy = ModelType(VirtualMachineScaleSetVMProtectionPolicy,
                                  serialize_when_none=False)
    provisioning_state = StringType(serialize_when_none=False)
    vm_instance_status_display = StringType(serialize_when_none=False)
    security_profile = ModelType(SecurityProfile, serialize_when_none=False)
    storage_profile = ModelType(StorageProfile, serialize_when_none=False)
    vm_id = StringType(serialize_when_none=False)
    vm_instance_status_profile = ModelType(
        VirtualMachineExtensionVMInstanceView, serialize_when_none=False)
    resources = ListType(ModelType(VirtualMachineExtension),
                         serialize_when_none=False)
    sku = ModelType(Sku, serialize_when_none=False)
    tags = ModelType(Tags, serialize_when_none=False)
    type = StringType(serialize_when_none=False)
    zones = ListType(StringType, serialize_when_none=False)
Exemplo n.º 17
0
class Disk(Model):
    device_index = IntType()
    device = StringType(default='')
    disk_type = StringType(default="EBS")
    size = FloatType()
    tags = ModelType(DiskTags, default={})
Exemplo n.º 18
0
class VirtualMachineScaleSet(Model):
    id = StringType(serialize_when_none=False)
    subscription_id = StringType(serialize_when_none=False)
    autoscale_setting_resource_collection = ModelType(
        AutoscaleSettingResourceCollection, serialize_when_none=False)
    subscription_name = StringType(serialize_when_none=False)
    resource_group = StringType(serialize_when_none=False)
    location = StringType(serialize_when_none=False)
    identity = ModelType(VirtualMachineScaleSetIdentity,
                         serialize_when_none=False)
    instance_count = IntType(serialize_when_none=False)
    name = StringType(serialize_when_none=False)
    plan = ModelType(Plan, serialize_when_none=False)
    additional_capabilities = ModelType(AdditionalCapabilities,
                                        serialize_when_none=False)
    automatic_repairs_policy = ModelType(AutomaticRepairsPolicy,
                                         serialize_when_none=False)
    do_not_run_extensions_on_overprovisioned_v_ms = BooleanType(
        serialize_when_none=False)
    host_group = ModelType(SubResource, serialize_when_none=False)
    overprovision = BooleanType(default=True, serialize_when_none=False)
    platform_fault_domain_count = IntType(serialize_when_none=False)
    provisioning_state = StringType(choices=('Failed', 'Succeeded'),
                                    serialize_when_none=False)
    proximity_placement_group = ModelType(SubResource,
                                          serialize_when_none=False)
    proximity_placement_group_display = StringType(serialize_when_none=False,
                                                   default='None')
    scale_in_policy = ModelType(ScaleInPolicy, serialize_when_none=False)
    single_placement_group = BooleanType(serialize_when_none=False)
    unique_id = StringType(serialize_when_none=False)
    upgrade_policy = ModelType(UpgradePolicy, serialize_when_none=False)
    virtual_machine_profile = ModelType(VirtualMachineScaleSetVMProfile,
                                        serialize_when_none=False)
    virtual_machine_scale_set_power_state = ListType(
        ModelType(VirtualMachineScaleSetPowerState))
    zone_balance = BooleanType(serialize_when_none=False)
    sku = ModelType(Sku, serialize_when_none=False)
    tags = ListType(ModelType(Tags), default=[], serialize_when_none=False)
    type = StringType(serialize_when_none=False)
    zones = ListType(StringType, serialize_when_none=False)
    vm_instances = ListType(ModelType(VirtualMachineScaleSetVM),
                            serialize_when_none=False)

    def reference(self):
        return {
            "resource_id":
            self.id,
            "external_link":
            f"https://portal.azure.com/#@.onmicrosoft.com/resource{self.id}/overview",
        }
Exemplo n.º 19
0
class FileSystemResource(EFSResource):
    cloud_service_type = StringType(default='FileSystem')
    data = ModelType(FileSystem)
    _metadata = ModelType(CloudServiceMeta,
                          default=metadata,
                          serialized_name='metadata')
Exemplo n.º 20
0
class Recurrence(Model):
    frequency = StringType(choices=('Day', 'Hour', 'Minute', 'Month', 'None',
                                    'Second', 'Week', 'Year'),
                           serialize_when_none=False)
    schedule = ModelType(RecurrentSchedule)
Exemplo n.º 21
0
 class Root(Model):
     keys = ModelType(Nested)
class CloudServiceResource(Model):
    provider = StringType(default="azure")
    cloud_service_type = StringType(serialize_when_none=False)
    cloud_service_group = StringType(serialize_when_none=False)
    data = PolyModelType(Model, default=lambda: {})
    reference = ModelType(ReferenceModel)
Exemplo n.º 23
0
 class Root(Model):
     root_attr = StringType()
     nxt_level = ModelType(Nested)
Exemplo n.º 24
0
class PackageSources(Model):
    git = ListType(ModelType(GitPackageSource))

    s3 = ListType(ModelType(S3PackageSource))
Exemplo n.º 25
0
class GroupResource(IAMResource):
    cloud_service_type = StringType(default='Group')
    data = ModelType(Group)
    _metadata = ModelType(CloudServiceMeta, default=group_metadata, serialized_name='metadata')
Exemplo n.º 26
0
class Config(Model):
    """This is the Python representation of a stacker config file.

    This is used internally by stacker to parse and validate a yaml formatted
    stacker configuration file, but can also be used in scripts to generate a
    stacker config file before handing it off to stacker to build/destroy.

    Example::

        from stacker.config import dump, Config, Stack

        vpc = Stack({
            "name": "vpc",
            "class_path": "blueprints.VPC"})

        config = Config()
        config.namespace = "prod"
        config.stacks = [vpc]

        print dump(config)

    """

    namespace = StringType(required=True)

    namespace_delimiter = StringType(serialize_when_none=False)

    stacker_bucket = StringType(serialize_when_none=False)

    stacker_bucket_region = StringType(serialize_when_none=False)

    stacker_cache_dir = StringType(serialize_when_none=False)

    sys_path = StringType(serialize_when_none=False)

    package_sources = ModelType(PackageSources, serialize_when_none=False)

    service_role = StringType(serialize_when_none=False)

    pre_build = ListType(ModelType(Hook), serialize_when_none=False)

    post_build = ListType(ModelType(Hook), serialize_when_none=False)

    pre_destroy = ListType(ModelType(Hook), serialize_when_none=False)

    post_destroy = ListType(ModelType(Hook), serialize_when_none=False)

    tags = DictType(StringType, serialize_when_none=False)

    template_indent = StringType(serialize_when_none=False)

    mappings = DictType(DictType(DictType(StringType)),
                        serialize_when_none=False)

    lookups = DictType(StringType, serialize_when_none=False)

    stacks = ListType(ModelType(Stack),
                      default=[],
                      validators=[not_empty_list])

    def validate(self):
        try:
            super(Config, self).validate()
        except SchematicsError as e:
            raise exceptions.InvalidConfig(e.errors)

    def validate_stacks(self, data, value):
        if value:
            stack_names = [stack.name for stack in value]
            if len(set(stack_names)) != len(stack_names):
                # only loop / enumerate if there is an issue.
                for i, stack_name in enumerate(stack_names):
                    if stack_names.count(stack_name) != 1:
                        raise ValidationError(
                            "Duplicate stack %s found at index %d." %
                            (stack_name, i))
Exemplo n.º 27
0
class RoleResource(IAMResource):
    cloud_service_type = StringType(default='Role')
    data = ModelType(Role)
    _metadata = ModelType(CloudServiceMeta, default=role_metadata, serialized_name='metadata')
Exemplo n.º 28
0
class PackageSources(Model):
    local = ListType(ModelType(LocalPackageSource))

    git = ListType(ModelType(GitPackageSource))

    s3 = ListType(ModelType(S3PackageSource))
Exemplo n.º 29
0
class IdentityProviderResource(IAMResource):
    cloud_service_type = StringType(default='IdentityProvider')
    data = ModelType(IdentityProvider)
    _metadata = ModelType(CloudServiceMeta, default=identity_provider_metadata, serialized_name='metadata')
Exemplo n.º 30
0
class AutoscaleNotification(Model):
    email = ModelType(EmailNotification, serialize_when_none=False)
    operation = ModelType(OperationType, serialize_when_none=False)
    webhooks = ListType(ModelType(WebhookNotification),
                        serialize_when_none=False)