base = ItemDynamicLayout.set_fields( 'Elastic IPs', fields=[ TextDyField.data_source('Public IPv4 Address', 'data.public_ip'), TextDyField.data_source('Associated Instance ID', 'data.instance_id'), TextDyField.data_source('Public DNS', 'data.public_dns'), TextDyField.data_source('Allocation ID', 'data.allocation_id'), TextDyField.data_source('Private IP Address', 'data.private_ip_address'), TextDyField.data_source('Region', 'data.region_name'), TextDyField.data_source('NAT Gateway ID', 'data.nat_gateway_id'), TextDyField.data_source('Association ID', 'data.association_id'), TextDyField.data_source('Network Interface ID', 'data.network_interface_id'), BadgeDyField.data_source('Address Pool', 'data.public_ipv4_pool'), EnumDyField.data_source('Scope', 'data.domain', default_outline_badge=['vpc', 'standard']), TextDyField.data_source('Network Interface Owner Account ID', 'data.network_interface_owner_id'), TextDyField.data_source('Customer owned IP Address', 'data.customer_owned_ip'), TextDyField.data_source('Customer owned IP Address Pool', 'data.customer_owned_ipv4_pool'), ]) eip_tags = SimpleTableDynamicLayout.set_tags() metadata = CloudServiceMeta.set_layouts(layouts=[base, eip_tags])
'incompatible-network', 'incompatible-parameters', 'incompatible-restore', 'storage-full' ] }), TextDyField.data_source('Endpoint', 'data.endpoint.address'), TextDyField.data_source('Cluster Version', 'data.cluster_version'), EnumDyField.data_source('Cluster Availability Status', 'data.cluster_availability_status', default_state={ 'safe': ['Available'], 'warning': ['Maintenance', 'Modifying'], 'disable': ['Unavailable'], 'alert': ['Failed'] }), TextDyField.data_source('Node Count', 'data.number_of_nodes'), BadgeDyField.data_source('Node Type', 'data.node_type'), TextDyField.data_source('Automated Snapshot Retention Period', 'data.automated_snapshot_retention_period'), TextDyField.data_source('Manual Snapshot Retention Period', 'data.manual_snapshot_retention_period'), TextDyField.data_source('Allow Version Upgrade', 'data.allow_version_upgrade'), TextDyField.data_source('Cluster Revision Number', 'data.cluster_revision_number'), ]) db_conf = ItemDynamicLayout.set_fields( 'Database configurations', fields=[ TextDyField.data_source('Database Name', 'data.db_name'), TextDyField.data_source('Port', 'data.endpoint.port'),
cst_function.name = 'Function' cst_function.provider = 'aws' cst_function.group = 'Lambda' cst_function.labels = ['Compute'] cst_function.is_primary = True cst_function.is_major = True cst_function.service_code = 'AWSLambda' cst_function.tags = { 'spaceone:icon': 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/AWS-Lambda.svg', } cst_function._metadata = CloudServiceTypeMeta.set_meta( fields=[ TextDyField.data_source('Name', 'data.name'), BadgeDyField.data_source('Runtime', 'data.runtime'), SizeField.data_source('Code Size', 'data.code_size'), SizeField.data_source('Memory Size', 'data.memory_size', options={'source_unit': 'MB'}), TextDyField.data_source('Description', 'data.description'), ], search=[ SearchField.set(name='Name', key='data.name'), SearchField.set(name='ARN', key='data.arn'), SearchField.set(name='Runtime', key='data.runtime'), SearchField.set(name='State', key='data.state.type', enums={ "Active": { 'label': 'Active',
'data.provisioned_throughput.read_capacity_units'), TextDyField.data_source( 'Provisioned Write capacity units', 'data.provisioned_throughput.write_capacity_units'), DateTimeDyField.data_source( 'Last Increase Date Time', 'data.provisioned_throughput.last_increase_date_time'), DateTimeDyField.data_source( 'Last Decrease Date Time', 'data.provisioned_throughput.last_decrease_date_time'), ]) encryption = ItemDynamicLayout.set_fields( 'Encryptions', fields=[ BadgeDyField.data_source('Encryption Type', 'data.encryption_type'), EnumDyField.data_source('Encryption Status', 'data.sse_description.status', default_state={ 'safe': ['ENABLED'], 'disable': ['DISABLED'], 'warning': ['ENABLING', 'UPDATING', 'DISABLING'] }), TextDyField.data_source('KMS Master Key ARN', 'data.sse_description.kms_master_key_arn'), ]) ttl = ItemDynamicLayout.set_fields( 'TTL Attributes', fields=[
cluster_endpoint = ItemDynamicLayout.set_fields( 'Endpoints', fields=[ TextDyField.data_source('Endpoint', 'data.cluster.endpoint'), TextDyField.data_source('Port', 'data.cluster.port'), TextDyField.data_source('Reader Endpoint', 'data.cluster.reader_endpoint'), ]) cluster_conf = ItemDynamicLayout.set_fields( 'Configuration', fields=[ TextDyField.data_source('DB Cluster ID', 'data.cluster.db_cluster_identifier'), TextDyField.data_source('ARN', 'data.cluster.db_cluster_arn'), BadgeDyField.data_source('DB Cluster Role', 'data.cluster.db_cluster_role'), TextDyField.data_source('Engine Version', 'data.cluster.engine_version'), TextDyField.data_source('Resource ID', 'data.cluster.db_cluster_resource_id'), BadgeDyField.data_source('Engine Mode', 'data.cluster.engine_mode'), TextDyField.data_source('DB Cluster Parameter Group', 'data.cluster.db_cluster_parameter_group'), EnumDyField.data_source('Deletion Protection', 'data.cluster.deletion_protection', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), EnumDyField.data_source( 'IAM DB Authentication',
]) cst_rds_paramgrp = CloudServiceTypeResource() cst_rds_paramgrp.name = 'ParameterGroup' cst_rds_paramgrp.provider = 'aws' cst_rds_paramgrp.group = 'RDS' cst_rds_paramgrp.labels = ['Database'] cst_rds_paramgrp.tags = { 'spaceone:icon': 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/Amazon-RDS.svg', 'spaceone:is_major': 'false', } cst_rds_paramgrp._metadata = CloudServiceTypeMeta.set_meta( fields=[ TextDyField.data_source('Name', 'data.db_parameter_group_name'), BadgeDyField.data_source('Family', 'data.db_parameter_group_family'), TextDyField.data_source('Description', 'data.description'), ], search=[ SearchField.set(name='Name', key='data.db_parameter_group_name'), SearchField.set(name='ARN', key='data.db_parameter_group_arn'), SearchField.set(name='Family', key='data.db_parameter_group_family'), SearchField.set(name='Region', key='data.region_name'), SearchField.set(name='AWS Account ID', key='data.account_id'), ]) cst_rds_optgrp = CloudServiceTypeResource() cst_rds_optgrp.name = 'OptionGroup' cst_rds_optgrp.provider = 'aws' cst_rds_optgrp.group = 'RDS' cst_rds_optgrp.labels = ['Database']
'sub_key': 'ipv6_cidr_block' }), EnumDyField.data_source('DNS resolution', 'data.enable_dns_support', default_badge={ 'indigo.500': ['Enabled'], 'coral.600': ['Disabled'] }), EnumDyField.data_source('DNS hostnames', 'data.enable_dns_hostnames', default_badge={ 'indigo.500': ['Enabled'], 'coral.600': ['Disabled'] }), TextDyField.data_source('DHCP Options set', 'data.dhcp_options_id'), BadgeDyField.data_source('Tenancy', 'data.instance_tenancy'), EnumDyField.data_source('Default VPC', 'data.is_default', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), TextDyField.data_source('Owner', 'data.owner_id'), ]) vpc_subnet = TableDynamicLayout.set_fields( 'Subnet', 'data.subnets', fields=[ TextDyField.data_source('Subnet ID', 'subnet_id'), EnumDyField.data_source('State',
]) rest_api_meta = CloudServiceMeta.set_layouts([rest_api_meta_base, rest_api_meta_resources]) ''' WEBSOCKET & HTTP ''' # TAB - BASE websocket_meta_base = ItemDynamicLayout.set_fields('HTTP & Web Socket', fields=[ TextDyField.data_source('Id', 'data.api_id'), TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('Endpoint', 'data.api_endpoint'), TextDyField.data_source('Description', 'data.description'), BadgeDyField.data_source('Protocol Type', 'data.protocol_type'), ]) websocket_meta = CloudServiceMeta.set_layouts([websocket_meta_base, ]) class APIGatewayResource(CloudServiceResource): cloud_service_group = StringType(default='APIGateway') class RestAPIResource(APIGatewayResource): cloud_service_type = StringType(default='RestAPI') data = ModelType(RestAPI) _metadata = ModelType(CloudServiceMeta, default=rest_api_meta, serialized_name='metadata')
TextDyField.data_source('Launch Template name', 'data.launch_template.launch_template_name'), TextDyField.data_source('ARN', 'data.auto_scaling_group_arn'), TextDyField.data_source('Desired Capacity', 'data.desired_capacity'), TextDyField.data_source('Min Size', 'data.min_size'), TextDyField.data_source('Max Size', 'data.max_size'), TextDyField.data_source('Default CoolDown', 'data.default_cooldown'), ListDyField.data_source('Availability Zones', 'data.availability_zones', default_badge={'type': 'outline', 'delimiter': '<br>'}), EnumDyField.data_source('Health Check Type', 'data.health_check_type', default_outline_badge=['EC2', 'ELB']), TextDyField.data_source('Health Check Grace Period', 'data.health_check_grace_period'), TextDyField.data_source('Service Linked Role ARN', 'data.service_linked_role_arn'), ListDyField.data_source('Target Group ARNs', 'data.target_group_arns', default_badge={'delimiter': '<br>'}), ListDyField.data_source('Load Balancer ARNs', 'data.load_balancer_arns', default_badge={'delimiter': '<br>'}), BadgeDyField.data_source('Termination Policies', 'data.termination_policies'), DateTimeDyField.data_source('Creation Time', 'data.created_time'), ]) # TAB - Launch Configuration asg_meta_lc = ItemDynamicLayout.set_fields('Launch Configuration', fields=[ TextDyField.data_source('Name', 'data.launch_configuration.launch_configuration_name'), TextDyField.data_source('ARN', 'data.launch_configuration.launch_configuration_arn'), TextDyField.data_source('AMI', 'data.launch_configuration.image_id'), TextDyField.data_source('Instance Type', 'data.launch_configuration.instance_type'), EnumDyField.data_source('Monitoring', 'data.launch_configuration.instance_monitoring.enabled', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), TextDyField.data_source('IAM Instance Profile', 'data.launch_configuration.iam_instance_profile'), TextDyField.data_source('Kernel ID', 'data.launch_configuration.kernel_id'), ListDyField.data_source('Security Groups', 'data.launch_configuration.security_groups',
} cst_redshift_cluster._metadata = CloudServiceTypeMeta.set_meta( fields=[ TextDyField.data_source('Cluster', 'data.cluster_identifier'), EnumDyField.data_source('Status', 'data.cluster_status', default_state={ 'safe': ['available'], 'warning': ['prep-for-resize', 'resize-cleanup', 'cancelling-resize', 'creating', 'deleting', 'final-snapshot', 'modifying', 'rebooting', 'renaming', 'resizing', 'rotating-keys', 'updating-hsm'], 'disable': ['paused'], 'alert': ['hardware-failure', 'incompatible-hsm', 'incompatible-network', 'incompatible-parameters', 'incompatible-restore', 'storage-full'] }), TextDyField.data_source('Cluster Version', 'data.cluster_version'), TextDyField.data_source('Nodes', 'data.number_of_nodes'), BadgeDyField.data_source('Node Type', 'data.node_type'), ], search=[ SearchField.set(name='Cluster Identifier', key='data.cluster_identifier'), SearchField.set(name='ARN', key='data.arn'), SearchField.set(name='Cluster Version', key='data.cluster_version'), SearchField.set(name='Node Type', key='data.node_type'), SearchField.set(name='Status', key='data.cluster_status', enums={ "available": {'label': 'Available', 'icon': {'color': 'green.500'}}, "prep-for-resize": {'label': 'Prepare for Resize', 'icon': {'color': 'yellow.400'}}, "resize-cleanup": {'label': 'Resize Cleanup', 'icon': {'color': 'yellow.400'}}, "cancelling-resize": {'label': 'Cancelling Resize', 'icon': {'color': 'yellow.400'}}, "creating": {'label': 'Creating', 'icon': {'color': 'yellow.400'}}, "deleting": {'label': 'Deleting', 'icon': {'color': 'yellow.400'}}, "final-snapshot": {'label': 'Final Snapshot', 'icon': {'color': 'yellow.400'}},