from schematics.types import DictType, ListType, ModelType, PolyModelType, StringType from spaceone.inventory.connector.aws_secrets_manager_connector.schema.data import Secret from spaceone.inventory.libs.schema.resource import CloudServiceMeta, CloudServiceResource, CloudServiceResponse from spaceone.inventory.libs.schema.dynamic_field import TextDyField, DateTimeDyField, EnumDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, SimpleTableDynamicLayout secrets = ItemDynamicLayout.set_fields( 'Secrets', fields=[ TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('ARN', 'data.arn'), TextDyField.data_source('Description', 'data.description'), TextDyField.data_source('Encryption Key ID', 'data.kms_key_id'), TextDyField.data_source('Own Service', 'data.owning_service'), DateTimeDyField.data_source('Last Changed Date', 'data.last_changed_date'), DateTimeDyField.data_source('Last Accessed Date', 'data.last_accessed_date'), ]) rotation = ItemDynamicLayout.set_fields( 'Rotation Configuration', fields=[ EnumDyField.data_source('Rotation Status', 'data.rotation_enabled', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), TextDyField.data_source('Rotation Interval', 'data.rotation_rules'), TextDyField.data_source('AWS Lambda Function',
base = ItemDynamicLayout.set_fields( 'Clusters', 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('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'), ])
meta_base = ItemDynamicLayout.set_fields( 'Distributions', fields=[ TextDyField.data_source('Distribution ID', 'data.id'), TextDyField.data_source('ARN', 'data.arn'), EnumDyField.data_source('Status', 'data.status', default_state={ 'safe': ['Deployed'], }), TextDyField.data_source('Domain Name', 'data.domain_name'), TextDyField.data_source('HTTP Version', 'data.http_version'), TextDyField.data_source('Comment', 'data.comment'), TextDyField.data_source('Price Class', 'data.price_class'), TextDyField.data_source('AWS Web ACL', 'data.web_acl_id'), EnumDyField.data_source('State Enabled', 'data.enabled', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), ListDyField.data_source('CNAME', 'data.alias_icp_recordals', options={ 'sub_key': 'cname', 'delimiter': '<br>' }), TextDyField.data_source('Domain Name', 'data.domain_name'), TextDyField.data_source('Custom SSL Client Support', 'data.viewer_certificate.ssl_support_method'), TextDyField.data_source( 'Security Policy', 'data.viewer_certificate.minimum_protocol_version'), EnumDyField.data_source('IPv6 Support', 'data.is_ipv6_enabled', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), DateTimeDyField.data_source('Last Modified', 'data.last_modified_time') ])
from schematics.types import ModelType, StringType, PolyModelType, DictType, ListType from spaceone.inventory.connector.aws_iam_connector.schema.data import Group, User, Role, Policy, IdentityProvider from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta from spaceone.inventory.libs.schema.dynamic_field import TextDyField, DateTimeDyField, ListDyField, \ BadgeDyField, EnumDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, \ SimpleTableDynamicLayout, ListDynamicLayout # GROUP group_base = ItemDynamicLayout.set_fields('Group', fields=[ TextDyField.data_source('Group ARN', 'data.arn'), TextDyField.data_source('Group Name', 'data.group_name'), TextDyField.data_source('Group ID', 'data.group_id'), TextDyField.data_source('Path', 'data.path'), TextDyField.data_source('User Count', 'data.user_count'), DateTimeDyField.data_source('Created At', 'data.create_date'), ]) group_user_table = TableDynamicLayout.set_fields('Users', root_path='data.users', fields=[ TextDyField.data_source('User Name', 'user_name'), TextDyField.data_source('Access Key Age', 'access_key_age_display'), TextDyField.data_source('Last Activity', 'last_activity'), EnumDyField.data_source('MFA', 'mfa_device', default_badge={ 'indigo.500': ['Virtual'], 'coral.600': ['Not enabled'], }), ]) group_policy_table = TableDynamicLayout.set_fields('Permissions', root_path='data.attached_permission', fields=[ TextDyField.data_source('Policy Name', 'policy_name'), TextDyField.data_source('Policy ID', 'policy_id'),
from schematics.types import DictType, ListType, ModelType, PolyModelType, StringType from spaceone.inventory.connector.aws_ec2_connector.schema.data import SecurityGroup, Image from spaceone.inventory.libs.schema.resource import CloudServiceMeta, CloudServiceResource, CloudServiceResponse from spaceone.inventory.libs.schema.dynamic_field import TextDyField, DateTimeDyField, EnumDyField, ListDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, SimpleTableDynamicLayout, \ TableDynamicLayout sg = ItemDynamicLayout.set_fields( 'Security Group', fields=[ TextDyField.data_source('ID', 'data.group_id'), TextDyField.data_source('Name', 'data.group_name'), TextDyField.data_source('Description', 'data.description'), TextDyField.data_source('VPC ID', 'data.vpc_id'), TextDyField.data_source('Account ID', 'data.owner_id'), ]) inbound_rules = TableDynamicLayout.set_fields( 'Inbound Rules', 'data.ip_permissions', fields=[ EnumDyField.data_source('Protocol', 'protocol_display', default_badge={ 'coral.600': ['ALL'], 'indigo.500': ['TCP'], 'peacock.500': ['UDP'], 'green.500': ['ICMP'] }), TextDyField.data_source('Port range', 'port_display'), TextDyField.data_source('Source', 'source_display'),
from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, BadgeItemDyField, BadgeDyField, EnumDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, SimpleTableDynamicLayout # TAB - BASE meta_base = ItemDynamicLayout.set_fields( 'Distributions', fields=[ TextDyField.data_source('Id', 'data.id'), TextDyField.data_source('ARN', 'data.arn'), EnumDyField.data_source('Status', 'data.status', default_state={ 'safe': ['Deployed'], }), TextDyField.data_source('Domain Name', 'data.domain_name'), ListDyField.data_source('CNAME', 'data.alias_icp_recordals', default_badge={ 'type': 'outline', 'sub_key': 'cname', }), TextDyField.data_source( 'Origins quantity', 'data.distribution_config.origin_groups.quantity'), TextDyField.data_source( 'Origin Groups quantity', 'data.distribution_config.origin_groups.quantity'), ]) alias_icp_recordals = SimpleTableDynamicLayout.set_fields( 'Alias ICP Recordals', 'data.alias_icp_recordals',
base = ItemDynamicLayout.set_fields( 'File Systems', fields=[ TextDyField.data_source('ID', 'data.file_system_id'), TextDyField.data_source('Name', 'data.name'), EnumDyField.data_source('File System State', 'data.life_cycle_state', default_state={ 'safe': ['available'], 'warning': ['creating', 'updating', 'deleting'], 'disable': ['deleted'] }), TextDyField.data_source('Owner ID', 'data.owner_id'), SizeField.data_source('Metered Size', 'data.size_in_bytes.value'), TextDyField.data_source('Number of mount targets', 'data.number_of_mount_targets'), TextDyField.data_source('Performance mode', 'data.performance_mode'), TextDyField.data_source('Throughput mode', 'data.throughput_mode'), EnumDyField.data_source('Encrypted', 'data.encrypted', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), ListDyField.data_source('Lifecycle policy', 'data.life_cycle_policies', options={ 'sub_key': 'transition_to_ia_display', 'delimiter': '<br>' }), DateTimeDyField.data_source('Creation date', 'data.creation_time') ])
from schematics.types import ModelType, StringType, PolyModelType from spaceone.inventory.connector.aws_eks_connector.schema.data import Cluster, NodeGroup from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, EnumDyField, DateTimeDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, \ SimpleTableDynamicLayout from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta cluster_base = ItemDynamicLayout.set_fields('Cluster', fields=[ TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('ARN', 'data.arn'), EnumDyField.data_source('Status', 'data.status', default_state={ 'safe': ['ACTIVE'], 'warning': ['CREATING', 'DELETING', 'UPDATING'], 'alert': ['FAILED'] }), TextDyField.data_source('Version', 'data.version'), TextDyField.data_source('Endpoint', 'data.endpoint'), TextDyField.data_source('Role ARN', 'data.role_arn'), TextDyField.data_source('Certificate Authority', 'data.certificate_authority.data'), ]) cluster_node_groups = TableDynamicLayout.set_fields('Node Groups', 'data.node_groups', fields=[ TextDyField.data_source('Group Name', 'nodegroup_name'), EnumDyField.data_source('Status', 'status', default_state={ 'safe': ['ACTIVE'], 'warning': ['CREATING', 'UPDATING', 'DELETING'], 'alert': ['CREATE_FAILED', 'DELETE_FAILED', 'DEGRADED'], }), ListDyField.data_source('Instance Types', 'instance_types', options={ 'delimiter': '<br>'
from schematics.types import ModelType, StringType, PolyModelType, DictType, ListType from spaceone.inventory.connector.aws_s3_connector.schema.data import Bucket from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, BadgeDyField, EnumDyField, SizeField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, SimpleTableDynamicLayout bucket = ItemDynamicLayout.set_fields('Buckets', fields=[ TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('ARN', 'data.arn'), TextDyField.data_source('Region', 'data.region_name'), EnumDyField.data_source('Public Access', 'data.public_access', default_badge={ 'indigo.500': ['Private'], 'coral.600': ['Public'] }), ]) object_info = ItemDynamicLayout.set_fields('Objects', fields=[ TextDyField.data_source('Object Counts', 'data.object_count'), SizeField.data_source('Object Total Size', 'data.object_total_size'), ]) versioning = ItemDynamicLayout.set_fields('Versioning', fields=[ EnumDyField.data_source('Status', 'data.versioning.status', default_state={ 'safe': ['Enabled'], 'alert': ['Suspended'] }), EnumDyField.data_source('MFA Delete', 'data.versioning.mfa_delete', default_badge={ 'indigo.500': ['Enabled'], 'coral.600': ['Disabled']
vol_base = ItemDynamicLayout.set_fields('Volumes', fields=[ TextDyField.data_source('Volume ID', 'data.volume_id'), TextDyField.data_source('ARN', 'data.arn'), EnumDyField.data_source('State', 'data.state', default_state={ 'safe': ['in-use'], 'available': ['available'], 'warning': ['deleting', 'creating'], 'disable': ['deleted'], 'alert': ['error'] }), TextDyField.data_source('Outpost ARN', 'data.outpost_arn'), SizeField.data_source('Size', 'data.size'), EnumDyField.data_source('Volume Type', 'data.volume_type', default_outline_badge=['standard', 'io1', 'gp2', 'gp3', 'sc1', 'st1']), TextDyField.data_source('Snapshot', 'data.snapshot_id'), TextDyField.data_source('Availability Zone', 'data.availability_zone'), EnumDyField.data_source('Encryption', 'data.encrypted', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), ListDyField.data_source('Attachment information', 'data.attachments', default_badge={ 'type': 'outline', 'sub_key': 'instance_id', }), TextDyField.data_source('KMS Key ID', 'data.kms_key_id'), TextDyField.data_source('KMS Key ARN', 'data.kms_key_arn'), TextDyField.data_source('IOPS', 'data.iops'), EnumDyField.data_source('Multi-Attach Enabled', 'data.multi_attach_enabled', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), DateTimeDyField.data_source('Created', 'data.create_time'), ])
from spaceone.inventory.libs.schema.dynamic_field import TextDyField, BadgeDyField, EnumDyField, BadgeItemDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, SimpleTableDynamicLayout connection = ItemDynamicLayout.set_fields( 'Connections', fields=[ TextDyField.data_source('ID', 'data.connection_id'), TextDyField.data_source('Name', 'data.connection_name'), EnumDyField.data_source('State', 'data.connection_state', default_state={ 'safe': ['available'], 'available': ['requested'], 'alert': ['down', 'rejected'], 'warning': ['ordering', 'pending', 'deleting'], 'disable': ['unknown', 'deleted'] }), TextDyField.data_source('Region', 'data.region'), TextDyField.data_source('Location', 'data.location'), TextDyField.data_source('Bandwidth', 'data.bandwidth'), TextDyField.data_source('Vlan', 'data.vlan'), TextDyField.data_source('Partner Name', 'data.partner_name'), TextDyField.data_source('Lag ID', 'data.lag_id'), TextDyField.data_source('AWS Device', 'data.aws_device'), TextDyField.data_source('Provider name', 'data.provider_name'), TextDyField.data_source('Owner Account', 'data.owner_account'), ]) connection_tags = SimpleTableDynamicLayout.set_tags() connection_metadata = CloudServiceMeta.set_layouts(
EnumDyField, SizeField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, ListDynamicLayout, \ SimpleTableDynamicLayout from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta ''' Certificate ''' # TAB - Status acm_meta_status = ItemDynamicLayout.set_fields( 'Status', fields=[ EnumDyField.data_source('Status', 'data.status', default_state={ 'safe': ['ISSUED'], 'warning': [ 'PENDING_VALIDATION', 'INACTIVE', 'VALIDATION_TIMED_OUT', 'REVOKED' ], 'alert': ['EXPIRED', 'FAILED'] }), DateTimeDyField.data_source('Issue Date', 'data.issued_at'), ]) acm_meta_domain_validation_table = \ TableDynamicLayout.set_fields('Domain Validation Status','data.domain_validation_options', fields=[ TextDyField.data_source('Domain', 'domain_name'), EnumDyField.data_source('Validation status', 'validation_status', default_state={ 'safe': ['SUCCESS'],
function = ItemDynamicLayout.set_fields( 'Functions', fields=[ TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('ARN', 'data.arn'), BadgeDyField.data_source('Runtime', 'data.runtime'), EnumDyField.data_source('State', 'data.state.type', default_state={ 'safe': ['Active'], 'warning': ['Pending'], 'disable': ['Inactive'], 'alert': ['Failed'] }), TextDyField.data_source('State Reason', 'data.state.reason'), EnumDyField.data_source('State Reason Code', 'data.state.reason_code', default_state={ 'warning': ['Creating', 'Restoring', 'Idle'], 'alert': [ 'EniLimitExceeded', 'InsufficientRolePermissions', 'InvalidConfiguration', 'InternalError', 'SubnetOutOfIPAddresses', 'InvalidSubnet', 'InvalidSecurityGroup' ] }), TextDyField.data_source('Role', 'data.role'), TextDyField.data_source('Handler', 'data.handler'), TextDyField.data_source('Code Size', 'data.code_size'), TextDyField.data_source('Description', 'data.description'), TextDyField.data_source('Timeout', 'data.time_out'), TextDyField.data_source('Memory Size', 'data.memory_size'), TextDyField.data_source('Code SHA 256', 'data.code_sha256'), TextDyField.data_source('KMS Key ARN', 'data.kms_key_arn'), TextDyField.data_source('Master ARN', 'data.master_arn'), TextDyField.data_source('Revision ID', 'data.revision_id'), EnumDyField.data_source('Last Update Status', 'data.last_update.type', default_state={ 'safe': ['Successful'], 'alert': ['Failed'], 'warning': ['InProgress'] }), TextDyField.data_source('Last Update State Reason', 'data.last_update.reason'), DateTimeDyField.data_source('Last Modified', 'data.last_modified'), ])
base = ItemDynamicLayout.set_fields( 'Keys', fields=[ TextDyField.data_source('ID', 'data.key_id'), TextDyField.data_source('ARN', 'data.arn'), TextDyField.data_source('Alias', 'data.alias_name'), EnumDyField.data_source('Enabled', 'data.enabled', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), EnumDyField.data_source('Key Status', 'data.key_state', default_state={ 'safe': ['Enabled'], 'warning': ['PendingDeletion', 'PendingImport'], 'disable': ['Disabled'], 'alert': ['Unavailable'] }), TextDyField.data_source('Description', 'data.description'), ListDyField.data_source('Key Algorithms', 'data.encryption_algorithms', default_badge={'type': 'outline'}), ListDyField.data_source('Signing Algorithms', 'data.signing_algorithms', default_badge={'type': 'outline'}), EnumDyField.data_source( 'Origin', 'data.origin', default_outline_badge=['AWS_KMS', 'EXTERNAL', 'AWS_CLOUDHSM']), EnumDyField.data_source('Key Manager', 'data.key_manager', default_outline_badge=['AWS', 'CUSTOMER']), EnumDyField.data_source('CMK Auto Rotation', 'data.key_rotated', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), EnumDyField.data_source( 'Key Usage', 'data.key_usage', default_outline_badge=['SIGN_VERIFY', 'ENCRYPT_DECRYPT']), EnumDyField.data_source('Expiration Model', 'data.expiration_model', default_outline_badge=[ 'KEY_MATERIAL_EXPIRES', 'KEY_MATERIAL_DOES_NOT_EXPIRE' ]), EnumDyField.data_source('Custom Master Key Spec.', 'data.customer_master_key_spec', default_outline_badge=[ 'RSA_2048', 'RSA_3072', 'RSA_4096', 'ECC_NIST_P256', 'ECC_NIST_P384', 'ECC_NIST_P521', 'ECC_SECG_P256K1', 'SYMMETRIC_DEFAULT' ]), TextDyField.data_source('Custom Key Store ID', 'data.custom_key_store_id'), TextDyField.data_source('Cloud HSM Cluster ID', 'data.cloud_hsm_cluster_id'), DateTimeDyField.data_source('Creation Time', 'data.creation_date') ])
from schematics.types import ModelType, StringType, PolyModelType, DictType, ListType from spaceone.inventory.connector.aws_api_gateway_connector.schema.data import RestAPI, HTTPWebsocket from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, BadgeDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta ''' REST API ''' # TAB - BASE rest_api_meta_base = ItemDynamicLayout.set_fields('REST API', fields=[ TextDyField.data_source('Id', 'data.id'), TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('Description', 'data.description'), ListDyField.data_source('Endpoint Type', 'data.endpoint_configuration.types', default_badge={'type': 'outline'}) ]) # TAB - RESOURCE rest_api_meta_resources = TableDynamicLayout.set_fields('Resources', 'data.resources', fields=[ TextDyField.data_source('ID', 'id'), TextDyField.data_source('Parent ID', 'parent_id'), TextDyField.data_source('Path', 'path'), ListDyField.data_source('HTTP Methods', 'display_methods', default_badge={'type': 'inline'}), ]) rest_api_meta = CloudServiceMeta.set_layouts([rest_api_meta_base, rest_api_meta_resources]) '''
ListDynamicLayout, ) from spaceone.inventory.libs.schema.resource import ( CloudServiceResource, CloudServiceResponse, CloudServiceMeta, ) """ kinesis """ # TAB - Detail kds_meta_detail = ItemDynamicLayout.set_fields( "Stream Details", fields=[ TextDyField.data_source("Status", "data.stream_status_display"), TextDyField.data_source("ARN", "data.stream_arn"), TextDyField.data_source("Data retention period", "data.retention_period_display"), ], ) # TAB - Configuration kds_meta_configuration = ItemDynamicLayout.set_fields( "Configuration", fields=[ TextDyField.data_source("Number of open shards", "data.open_shards_num"), TextDyField.data_source("Number of closed shards", "data.closed_shards_num"), TextDyField.data_source("Server-side encryption", "data.encryption_display"),
vpc = ItemDynamicLayout.set_fields( 'VPC', fields=[ TextDyField.data_source('VPC ID', 'data.vpc_id'), EnumDyField.data_source('State', 'data.state', default_state={ 'safe': ['available'], 'warning': ['pending'] }), TextDyField.data_source('IPv4 CIDR', 'data.cidr_block'), ListDyField.data_source('IPv6 CIDR', 'data.ipv6_cidr_block_association_set', default_badge={ 'type': 'outline', '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'), ])
''' AUTO SCALING GROUP ''' # TAB - AutoScaling asg_meta_autoscaling = ItemDynamicLayout.set_fields('Auto Scaling', fields=[ TextDyField.data_source('Name', 'data.auto_scaling_group_name'), TextDyField.data_source('Launch Configuration name', 'data.launch_configuration_name'), 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'),
tables = ItemDynamicLayout.set_fields( 'Tables', fields=[ TextDyField.data_source('Table Name', 'data.table_name'), TextDyField.data_source('ARN', 'data.table_arn'), EnumDyField.data_source( 'Status', 'data.table_status', default_state={ 'safe': ['ACTIVE'], 'warning': ['CREATING', 'UPDATING', 'DELETING', 'ARCHIVING'], 'alert': ['INACCESSIBLE_ENCRYPTION_CREDENTIALS', 'ARCHIVED'] }), TextDyField.data_source('Partition Key', 'data.partition_key_display'), TextDyField.data_source('Primary Sort Key', 'data.sort_key_display'), EnumDyField.data_source( 'Point-in-time Recovery', 'data.continuous_backup.point_in_time_recovery_description.point_in_time_recovery_status', default_state={ 'safe': ['ENABLED'], 'disable': ['DISABLED'] }), EnumDyField.data_source( 'CloudWatch Contributor Insights', 'data.contributor_insight.contributor_insights_status', default_state={ 'safe': ['ENABLED'], 'warninig': ['ENABLING', 'DISABLING'], 'alert': ['FAILED'], 'disable': ['DISABLED'] }), SizeField.data_source('Storage Size', 'data.table_size_bytes'), TextDyField.data_source('Item count', 'data.item_count'), TextDyField.data_source('Region', 'data.region_name'), DateTimeDyField.data_source('Creation date', 'data.creation_date_time'), ])
from schematics.types import ModelType, StringType, PolyModelType, DictType, ListType from spaceone.inventory.connector.aws_route53_connector.schema.data import HostedZone from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, BadgeDyField, EnumDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout hosted_zone = ItemDynamicLayout.set_fields( 'Hosted Zones', fields=[ TextDyField.data_source('Name', 'data.name'), EnumDyField.data_source('Type', 'data.type', default_badge={ 'indigo.500': ['Public'], 'coral.600': ['Private'] }), TextDyField.data_source('Host Zone ID', 'data.id'), TextDyField.data_source('Record Set Count', 'data.resource_record_set_count'), TextDyField.data_source('Comment', 'data.config.comment'), ]) record_set = TableDynamicLayout.set_fields( 'Record Sets', 'data.record_sets', fields=[ TextDyField.data_source('Name', 'name'), EnumDyField.data_source('Type', 'type', default_outline_badge=[
""" # TAB - Stream firehose_meta_stream_details = ItemDynamicLayout.set_fields( "Stream Details", fields=[ TextDyField.data_source("ARN", "data.delivery_stream_arn"), EnumDyField.data_source( "Status", "data.delivery_stream_status", default_state={ "safe": ["ACTIVE"], 'warning': ["CREATING", "DELETING"], "alert": ["DELETING_FAILED", "CREATING_FAILED", "SUSPENDED"] }, ), DateTimeDyField.data_source("Creation Time", "data.create_timestamp"), TextDyField.data_source("Source", "data.source.source_name"), ListDyField.data_source('Destination', 'data.destinations', options={ 'sub_key': 'destination_id', 'delimiter': '<br>' }), TextDyField.data_source('ARN', 'data.delivery_stream_arn'), TextDyField.data_source('Type', 'data.delivery_stream_type'), TextDyField.data_source('Version ID', 'data.version_id'), TextDyField.data_source('Encryption Configuration Status', 'data.delivery_stream_encryption_configuration.status'), TextDyField.data_source('Failure Description', 'data.failure_description') ], ) # TAB - Source
memcached_base = ItemDynamicLayout.set_fields( 'Description', fields=[ TextDyField.data_source('Cluster Name', 'data.cache_cluster_id'), TextDyField.data_source('ARN', 'data.arn'), EnumDyField.data_source('Status', 'data.cache_cluster_status', default_state={ 'safe': ['available'], }), TextDyField.data_source('Configuration Endpoint', 'data.configuration_endpoint_display'), TextDyField.data_source('Engine', 'data.engine'), TextDyField.data_source('Engine Version Compatibility', 'data.engine_version'), TextDyField.data_source('Node Type', 'data.cache_node_type'), TextDyField.data_source('Number of Nodes', 'data.num_cache_nodes'), TextDyField.data_source('Availability Zones', 'data.preferred_availability_zone'), TextDyField.data_source( 'Parameter Group', 'data.cache_parameter_group.cache_parameter_group_name'), TextDyField.data_source('Subnet Group', 'data.cache_subnet_group_name'), ListDyField.data_source('Security Group', 'data.security_groups', options={ 'delimiter': '<br>', 'sub_key': 'security_group_id' }), TextDyField.data_source('Notification ARN', 'data.notification_configuration.topic_arn'), TextDyField.data_source('Maintenance Window', 'data.preferred_maintenance_window'), TextDyField.data_source('Backup Retension Period', 'data.snapshot_retention_limit'), TextDyField.data_source('Backup Window', 'data.snapshot_window'), DateTimeDyField.data_source('Creation Time', 'data.cache_cluster_create_time') ])
from spaceone.inventory.connector.aws_ecs_connector.schema.data import Cluster from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta from spaceone.inventory.libs.schema.dynamic_field import TextDyField, BadgeDyField, EnumDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, SimpleTableDynamicLayout base = ItemDynamicLayout.set_fields( 'Clusters', fields=[ TextDyField.data_source('Name', 'data.cluster_name'), TextDyField.data_source('ARN', 'data.cluster_arn'), EnumDyField.data_source('Status', 'data.status', default_state={ 'safe': ['ACTIVE'], 'warning': ['PROVISIONING', 'DEPROVISIONING'], 'disable': ['INACTIVE'], 'alert': ['FAILED'] }), TextDyField.data_source('Active Service', 'data.active_services_count'), TextDyField.data_source('Running Tasks', 'data.active_services_count'), TextDyField.data_source('Pending Tasks', 'data.pending_tasks_count'), TextDyField.data_source('Registered Instances', 'data.registered_container_instances_count'), ]) services = TableDynamicLayout.set_fields( 'Services', 'data.services', fields=[
from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, ListDynamicLayout, \ SimpleTableDynamicLayout from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta ''' CLUSTERS ''' # Cluster cluster_base = ItemDynamicLayout.set_fields('Cluster', fields=[ TextDyField.data_source('ARN', 'data.cluster_arn'), TextDyField.data_source('Name', 'data.cluster_name'), EnumDyField.data_source('Status', 'data.state', default_state={ 'safe': ['ACTIVE'], 'warning': ['CREATING', 'DELETING', 'HEALING', 'MAINTENANCE', 'REBOOTING_BROKER'], 'alert': ['FAILED'] }), TextDyField.data_source('Current Version', 'data.current_version'), TextDyField.data_source('Enhanced Monitoring', 'data.enhanced_monitoring'), TextDyField.data_source('Number of Broker Nodes', 'data.number_of_broker_nodes'), TextDyField.data_source('Zookeeper Connect String', 'data.zookeeper_connect_string'), DateTimeDyField.data_source('Created Time', 'data.creation_time'), ]) # Broker Summary Info cluster_broker_node_summary = \ ItemDynamicLayout.set_fields('Broker Summary Info', root_path='data.broker_node_group_info', fields=[ TextDyField.data_source('Broker AZ Distribution', 'broker_az_distribution'),
summary = ItemDynamicLayout.set_fields( 'Summary', fields=[ TextDyField.data_source('DB Identifier', 'data.db_identifier'), EnumDyField.data_source('Role', 'data.role', default_badge={ 'indigo.500': ['cluster'], 'coral.600': ['instance'] }), EnumDyField.data_source('Status', 'data.status', default_state={ 'safe': ['available'], 'warning': [ 'creating', 'deleting', 'maintenance', 'modifying', 'rebooting', 'renaming', 'starting', 'stopping', 'upgrading' ], 'alert': [ 'failed', 'inaccessible-encryption-credentials', 'restore-error', 'stopped', 'storage-full' ] }), EnumDyField.data_source('Engine', 'data.engine', default_outline_badge=[ 'aurora', 'aurora-mysql', 'docdb', 'mysql', 'mariadb', 'postgres', 'oracle-ee', 'oracle-se', 'oracle-se1', 'oracle-se2', 'sqlserver-ex', 'sqlserver-web', 'sqlserver-se', 'sqlserver-ee' ]), TextDyField.data_source('Class', 'data.size'), TextDyField.data_source('Region & AZ', 'data.availability_zone'), ])
from spaceone.inventory.libs.schema.resource import CloudServiceResource, CloudServiceResponse, CloudServiceMeta from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, EnumDyField, DateTimeDyField, \ SizeField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, TableDynamicLayout base = ItemDynamicLayout.set_fields( 'Repositories', fields=[ TextDyField.data_source('Repository ID', 'data.registry_id'), TextDyField.data_source('Repository name', 'data.repository_name'), TextDyField.data_source('Repository ARN', 'data.repository_arn'), TextDyField.data_source('URI', 'data.repository_uri'), TextDyField.data_source('Created', 'data.created_at'), EnumDyField.data_source('Tag Immutability', 'data.image_tag_mutability', default_badge={ 'indigo.500': ['MUTABLE'], 'coral.600': ['IMMUTABLE'] }), EnumDyField.data_source( 'Scan On Push', 'data.image_scanning_configuration.scan_on_push', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), ]) images = TableDynamicLayout.set_fields( 'Images', 'data.images', fields=[
from spaceone.inventory.libs.schema.dynamic_field import TextDyField, BadgeDyField, EnumDyField from spaceone.inventory.libs.schema.dynamic_layout import ItemDynamicLayout, SimpleTableDynamicLayout 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])
lb_base = ItemDynamicLayout.set_fields( 'Load Balancers', fields=[ TextDyField.data_source('Name', 'data.load_balancer_name'), TextDyField.data_source('ARN', 'data.load_balancer_arn'), TextDyField.data_source('DNS Name', 'data.dns_name'), EnumDyField.data_source('State', 'data.state.code', default_state={ 'safe': ['active'], 'warning': ['provisioning'], 'alert': ['active_impaired', 'failed'] }), EnumDyField.data_source('Type', 'data.type', default_badge={ 'indigo.500': ['network'], 'coral.600': ['application'] }), EnumDyField.data_source('Scheme', 'data.scheme', default_badge={ 'indigo.500': ['internet-facing'], 'coral.600': ['internal'] }), ListDyField.data_source('Security Groups', 'data.security_groups', default_badge={'type': 'outline'}), EnumDyField.data_source('IP address type', 'data.ip_address_type', default_outline_badge=['ipv4', 'dualstack']), TextDyField.data_source('VPC ID', 'data.vpc_id'), ListDyField.data_source('Availability Zones', 'data.availability_zones', default_badge={ 'type': 'outline', 'sub_key': 'zone_name', }), TextDyField.data_source('Hosted Zone', 'data.canonical_hosted_zone_id'), DateTimeDyField.data_source('Creation time', 'data.created_time'), ])
""" kinesis """ # TAB - Stream firehose_meta_stream_details = ItemDynamicLayout.set_fields( "Stream Details", fields=[ TextDyField.data_source("ARN", "data.delivery_stream_arn"), EnumDyField.data_source( "Status", "data.delivery_stream_status", default_state={ "safe": ["ACTIVE"], 'warning': ["CREATING", "DELETING"], "alert": ["DELETING_FAILED", "CREATING_FAILED", "SUSPENDED"] }, ), DateTimeDyField.data_source( "Data retention period", "data.create_timestamp" ), ListDyField.data_source("Permissions (IAM role)", "data.additional_tabs.iam_role", options={"delimiter": ", "}), ListDyField.data_source("CloudWatch error logging", "data.additional_tabs.cloud_watch_info", options={"delimiter": ", "}) ], ) # TAB - Source firehose_meta_source_details = ItemDynamicLayout.set_fields( "Source", fields=[
sqs = ItemDynamicLayout.set_fields( 'Queue', fields=[ TextDyField.data_source('ARN', 'data.arn'), TextDyField.data_source('Name', 'data.name'), TextDyField.data_source('URL', 'data.url'), EnumDyField.data_source('FIFO Queue', 'data.fifo_queue', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), EnumDyField.data_source('Content Based Deduplication', 'data.content_based_duplication', default_badge={ 'indigo.500': ['true'], 'coral.600': ['false'] }), TextDyField.data_source('Approximate Number Of Messages', 'data.approximate_number_of_messages'), TextDyField.data_source('Approximate Number Of Messages Delayed', 'data.approximate_number_of_messages_delayed'), TextDyField.data_source( 'Approximate Number Of Messages Not Visible', 'data.approximate_number_of_messages_not_visible'), TextDyField.data_source('Delay Seconds', 'data.delay_seconds'), TextDyField.data_source('Maximum Message Size', 'data.maximum_message_size'), TextDyField.data_source('Message Retention Period', 'data.message_retention_period'), TextDyField.data_source('Receive Message Wait Time Seconds', 'data.receive_message_wait_time_seconds'), TextDyField.data_source('Visibility Timeout', 'data.visibility_timeout'), DateTimeDyField.data_source('Created Time', 'data.created_timestamp', options={ 'source_type': 'timestamp', 'source_format': 'seconds' }), DateTimeDyField.data_source('Last Modified Time', 'data.last_modified_timestamp', options={ 'source_type': 'timestamp', 'source_format': 'seconds' }), ])