예제 #1
0
    TableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
INSTANCE
'''
# TAB - Instance Group
instance_group_item = ItemDynamicLayout.set_fields(
    'Instance Group',
    fields=[
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source(
            'Type',
            'data.instance_group_type',
            default_outline_badge=['STATELESS', 'STATEFUL', 'UNMANAGED']),
        TextDyField.data_source('Project', 'data.project'),
        TextDyField.data_source('Region', 'data.region'),
        TextDyField.data_source('Zone', 'data.zone'),
        TextDyField.data_source('Network', 'data.network'),
        TextDyField.data_source('Subnet', 'data.subnetwork'),
        TextDyField.data_source('Description', 'data.description'),
        TextDyField.data_source('Instance Counts', 'data.instance_counts'),
        TextDyField.data_source('Self Link', 'data.self_link'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])

instance_template_item = ItemDynamicLayout.set_fields(
    'Instance Template',
    fields=[
        TextDyField.data_source('Resource ID', 'data.template.id'),
        TextDyField.data_source('Name', 'data.template.name'),
compute_instance = ItemDynamicLayout.set_fields(
    'Compute Instance',
    fields=[
        TextDyField.data_source('Account', 'data.account'),
        TextDyField.data_source('Compartment',
                                'data.compartment.compartment_name'),
        TextDyField.data_source('Instance ID', 'data.compute.instance_id'),
        TextDyField.data_source('Instance Name', 'data.instance_name'),
        EnumDyField.data_source('Instance State',
                                'data.compute.instance_state',
                                default_state={
                                    'safe': ['RUNNING'],
                                    'warning': ['PENDING', 'STOPPING'],
                                    'disable': ['SHUTTING-DOWN'],
                                    'alert': ['STOPPED']
                                }),
        TextDyField.data_source('Instance Type', 'data.compute.instance_type'),
        TextDyField.data_source('Image', 'data.compute.image'),
        TextDyField.data_source('Launch Mode',
                                'data.oracle_cloud.launch_mode'),
        TextDyField.data_source('Boot Volume Type',
                                'data.oracle_cloud.boot_volume_type'),
        TextDyField.data_source('Primary IP Address', 'primary_ip_address'),
        ListDyField.data_source('IP Addresses',
                                'ip_addresses',
                                default_badge={'type': 'outline'}),
        TextDyField.data_source('Region', 'region_code'),
        TextDyField.data_source('Availability Domain', 'data.compute.ad'),
        TextDyField.data_source('Fault Domain',
                                'data.oracle_cloud.fault_domain'),
        ListDyField.data_source('Security Groups',
                                'data.security_group',
                                default_badge={
                                    'type': 'outline',
                                    'delimeter': '<br>',
                                    'sub_key': 'security_group_name'
                                },
                                reference={
                                    'resource_type': 'inventory.CloudService',
                                    'reference_key': 'data.security_group_id'
                                }),
        TextDyField.data_source('Key Pair', 'data.compute.keypair'),
        DateTimeDyField.data_source('Launched At', 'data.compute.launched_at')
    ])
'''

# TAB - Snapshot
# snapshot details
snapshot_instance_meta = ItemDynamicLayout.set_fields(
    'Snapshot Details',
    fields=[
        TextDyField.data_source('Source Disk',
                                'data.disk.source_disk_display'),
        SizeField.data_source('Disk Size', 'data.disk.disk_size'),
        SizeField.data_source('SnapShot Size', 'data.disk.storage_bytes'),
        ListDyField.data_source('Locations',
                                'data.storage_locations',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
        EnumDyField.data_source('Encryption Type',
                                'data.encryption',
                                default_badge={
                                    'primary': ['Google managed'],
                                    'indigo.500': ['Customer managed'],
                                    'coral.600': ['Customer supplied']
                                }),
    ])

# Snapshot Schedules
snapshot_schedule_meta = TableDynamicLayout.set_fields(
    'Snapshot Schedules',
# TAB - Instance Template
instance_template_meta = ItemDynamicLayout.set_fields(
    'Instance',
    fields=[
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Description', 'data.description'),
        ListDyField.data_source('In Used By',
                                'data.in_used_by',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        EnumDyField.data_source('IP Forward',
                                'data.ip_forward',
                                default_badge={
                                    'indigo.500': ['true'],
                                    'coral.600': ['false']
                                }),
        TextDyField.data_source('Self Link', 'data.self_link'),
        ListDyField.data_source('Network Tags',
                                'data.network_tags',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        TextDyField.data_source('Fingerprint', 'data.fingerprint'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])
vm_scale_set_info_meta = ItemDynamicLayout.set_fields(
    'VmScaleSets',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Subscription', 'data.subscription_name'),
        TextDyField.data_source('Subscription ID', 'data.subscription_id'),
        TextDyField.data_source('Instances', 'data.instance_count'),
        TextDyField.data_source(
            'Operating System',
            'data.virtual_machine_profile.os_profile.operating_system'),
        TextDyField.data_source('Size', 'data.sku.name'),
        TextDyField.data_source(
            'Virtual network/subnet',
            'data.virtual_machine_profile.network_profile.primary_vnet'),
        TextDyField.data_source('Host group', 'data.host_group.id'),
        TextDyField.data_source(
            'Ephemeral OS Disk',
            'data.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings.option.local'
        ),
        TextDyField.data_source(
            'Azure Spot Eviction Policy',
            'data.virtual_machine_profile.eviction_policy'),
        TextDyField.data_source(
            'Azure Spot Max Price',
            'data.virtual_machine_profile.billing_profile.max_price'),
        TextDyField.data_source(
            'Termination Notification',
            'data.virtual_machine_profile.terminate_notification_display'),
        TextDyField.data_source('OverProvisioning', 'data.overprovision'),
        TextDyField.data_source('Proximity Placement Group',
                                'data.proximity_placement_group_display'),
        TextDyField.data_source('Automatic Repairs',
                                'data.automatic_repairs_policy.enabled'),
        TextDyField.data_source('Upgrade Policy', 'data.upgrade_policy.mode'),
        TextDyField.data_source('Fault Domains',
                                'data.platform_fault_domain_count'),
    ])
sql_databases_info_meta = ItemDynamicLayout.set_fields(
    'SQL Databases',
    fields=[
        TextDyField.data_source('Database Name', 'data.name'),
        EnumDyField.data_source(
            'Status',
            'data.status',
            default_state={
                'safe': [
                    'Online', 'Creating', 'Copying', 'Creating',
                    'OnlineChangingDwPerformanceTiers', 'Restoring',
                    'Resuming', 'Scaling', 'Standby'
                ],
                'warning': [
                    'AutoClosed', 'Inaccessible', 'Offline',
                    'OfflineChangingDwPerformanceTiers', 'OfflineSecondary',
                    'Pausing', 'Recovering', 'RecoveryPending', 'Suspect'
                ],
                'disable': ['Disabled', 'Paused', 'Shutdown'],
                'alert': ['EmergencyMode']
            }),
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Subscription ID', 'data.subscription_id'),
        TextDyField.data_source('Server Name', 'data.server_name'),
        TextDyField.data_source('Elastic Pool', 'data.elastic_pool_id'),
        TextDyField.data_source('Pricing Tier', 'data.pricing_tier_display'),
        DateTimeDyField.data_source('Earliest Restore Point',
                                    'data.earliest_restore_date'),
        TextDyField.data_source('Collation', 'data.collation'),
        DateTimeDyField.data_source('Creation Date', 'data.creation_date'),
        TextDyField.data_source('Server Admin Login',
                                'data.administrator_login'),
    ])
예제 #7
0
dbsystem_base = ItemDynamicLayout.set_fields(
    'General Info',
    fields=[
        EnumDyField.data_source(
            'Lifecycle State',
            'data.lifecycle_state',
            default_state={
                'safe': ['ACTIVE'],
                'warning': [
                    'UPDATING', 'TERMINATING', 'MAINTENANCE_IN_PROGRESS',
                    'PROVISIONING'
                ],
                'alert':
                ['TERMINATED', 'FAILED', 'MIGRATED', 'NEEDS_ATTENTION']
            }),
        TextDyField.data_source('Availability Domain',
                                'data.availability_domain'),
        ListDyField.data_source('Fault Domains',
                                'data.fault_domains',
                                options={'delimiter': '<br>'}),
        TextDyField.data_source('Cluster Name', 'data.cluster_name'),
        TextDyField.data_source('OCID', 'data.id'),
        TextDyField.data_source('Shape', 'data.shape'),
        TextDyField.data_source('Version', 'data.version'),
        DateTimeDyField.data_source('Created', 'data.time_created'),
        TextDyField.data_source('Time Zone', 'data.time_zone'),
        TextDyField.data_source('Compartment', 'data.compartment_name'),
        TextDyField.data_source('Oracle Database Software Edition',
                                'data.database_edition'),
        TextDyField.data_source('Storage Management Software',
                                'data.db_system_options.storage_management'),
        SizeField.data_source('Storage Size',
                              'data.data_storage_size_in_gbs',
                              options={
                                  'display_unit': 'GB',
                                  'source_unit': 'GB'
                              }),
        TextDyField.data_source('Licence Type', 'data.license_model'),
        TextDyField.data_source('Maintenance Window',
                                'data.maintenance_window.display'),
        TextDyField.data_source('KMS key Id', 'data.kms_key_id'),
        ListDyField.data_source('SSH Public Key',
                                'data.ssh_public_keys',
                                options={'delimiter': '<br>'})
    ])
예제 #8
0
    ListDynamicLayout, SimpleTableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
from spaceone.inventory.model.applicationgateway.data import ApplicationGateway
'''
APPLICATION_GATEWAY
'''
# TAB - Default
application_gateway_info_meta = ItemDynamicLayout.set_fields(
    'Application Gateway',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Subscription', 'data.subscription_name'),
        TextDyField.data_source('Subscription ID', 'data.subscription_id'),
        TextDyField.data_source('Virtual Network', 'data.virtual_network'),
        TextDyField.data_source('Subnet', 'data.subnet'),
        TextDyField.data_source('Frontend public IP Address',
                                'data.public_ip_address.ip_address'),
        TextDyField.data_source('Frontend private IP Address',
                                'data.private_ip_address'),
        TextDyField.data_source('Tier', 'data.sku.tier')
    ])

# TAB - Configuration
application_gateway_configuration = ItemDynamicLayout.set_fields(
    'Configuration',
    fields=[
        TextDyField.data_source('Capacity ', 'data.sku.tier'),
        # TextDyField.data_source('Capacity Type', ''),
'''
SQL SERVERS

'''

# TAB - Default
# Resource Group, Status, Location, Subscription, Subscription ID, Server Admin, Firewalls, Active Directory admin, Server name
sql_servers_info_meta = ItemDynamicLayout.set_fields('SQL Servers', fields=[
    TextDyField.data_source('Name', 'data.name'),
    TextDyField.data_source('Resource Group', 'data.resource_group'),
    TextDyField.data_source('Resource ID', 'data.id'),
    EnumDyField.data_source('Status', 'data.state', default_state={
        'safe': ['Ready'],
        'warning': ['Disabled']
    }),
    TextDyField.data_source('Location', 'data.location'),
    TextDyField.data_source('Subscription', 'data.subscription_name'),
    TextDyField.data_source('Subscription ID', 'data.subscription_id'),
    TextDyField.data_source('Server Admin', 'data.administrator_login'),
    TextDyField.data_source('Active Directory Admin', 'data.azure_ad_admin_name'),
    TextDyField.data_source('Server Name', 'data.fully_qualified_domain_name')

])

# TAB - Failover Groups
# Name, Primary Server, Secondary Server, Read/Write Failover Policy, Grace Period (minutes), Database count
sql_server_failover_group = TableDynamicLayout.set_fields('Failover Groups', 'data.failover_groups', fields=[
    TextDyField.data_source('ID', 'id'),
    TextDyField.data_source('Name', 'name'),
    TextDyField.data_source('Primary Server', 'primary_server'),
    TextDyField.data_source('Secondary Server', 'secondary_server'),
예제 #10
0
from spaceone.inventory.model.personal_health_dashboard.data import Event
from spaceone.inventory.libs.schema.metadata.dynamic_field import TextDyField, DateTimeDyField, EnumDyField
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta

event_meta = ItemDynamicLayout.set_fields(
    'Event',
    fields=[
        TextDyField.data_source('Event', 'data.event_title'),
        TextDyField.data_source('ARN', 'data.arn'),
        TextDyField.data_source('Event Code', 'data.event_type_code'),
        EnumDyField.data_source('Status',
                                'data.status_code',
                                default_state={
                                    'safe': ['closed'],
                                    'warning': ['upcoming'],
                                    'alert': ['open']
                                }),
        TextDyField.data_source('Event Scope Code', 'data.event_scope_code'),
        TextDyField.data_source('Event Category', 'data.event_type_category'),
        TextDyField.data_source('Region', 'region_code'),
        TextDyField.data_source('Description', 'data.description'),
        DateTimeDyField.data_source('Start Time', 'data.start_time'),
        DateTimeDyField.data_source('Last Update Time',
                                    'data.last_update_time'),
        DateTimeDyField.data_source('End Time', 'data.end_time'),
    ])

affected_resources_meta = TableDynamicLayout.set_fields(
    'Affected Resources',
    'data.affected_resources',
    fields=[
from schematics.types import ModelType, StringType, PolyModelType

from spaceone.inventory.model.autonomous_database.data import Database
from spaceone.inventory.libs.schema.metadata.dynamic_field import TextDyField
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta

'''
Database
'''
database_meta = ItemDynamicLayout.set_fields('Database', fields=[
    TextDyField.data_source('Display Name', ''),
])

# TAB - tags
database_tags = TableDynamicLayout.set_fields('Tags', 'data.tags', fields=[
    TextDyField.data_source('Key', 'key'),
    TextDyField.data_source('Value', 'value')
])

adb_meta = CloudServiceMeta.set_layouts([database_meta, database_tags])


class AutonomousDatabaseResource(CloudServiceResource):
    cloud_service_group = StringType(default='AutonomousDatabase')


class DatabaseResource(AutonomousDatabaseResource):
    cloud_service_type = StringType(default='Database')
    data = ModelType(Database)
    _metadata = ModelType(CloudServiceMeta, default=adb_meta, serialized_name='metadata')
disk_properties_meta = ItemDynamicLayout.set_fields(
    'Properties',
    fields=[
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Disk Type',
                                'data.disk_type',
                                default_outline_badge=[
                                    'local-ssd', 'pd-balanced', 'pd-ssd',
                                    'pd-standard'
                                ]),
        SizeField.data_source('Size', 'data.size'),
        TextDyField.data_source('Zone', 'data.zone'),
        ListDyField.data_source('In Used By',
                                'data.in_used_by',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        ListDyField.data_source('Snapshot Schedule',
                                'data.snapshot_schedule_display',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        EnumDyField.data_source('Encryption Type',
                                'data.encryption',
                                default_badge={
                                    'primary': ['Google managed'],
                                    'indigo.500': ['Customer managed'],
                                    'coral.600': ['Customer supplied']
                                }),
        TextDyField.data_source('Source Image', 'data.source_image_display'),
        DateTimeDyField.data_source('Last Attach Time',
                                    'data.last_attach_timestamp'),
        DateTimeDyField.data_source('Last Detach Time',
                                    'data.last_detach_timestamp'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])
meta_machine_image = ItemDynamicLayout.set_fields(
    'Instance',
    fields=[
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Description', 'data.description'),
        ListDyField.data_source('Location',
                                'data.storage_locations',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        TextDyField.data_source('Machine Type', 'data.machine.machine_type'),
        ListDyField.data_source('Network Tags',
                                'data.network_tags',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        EnumDyField.data_source('Status',
                                'data.status',
                                default_badge={
                                    'primary': ['READY'],
                                    'indigo.500': ['UPLOADING', 'CREATING'],
                                    'coral.600': ['DELETING', 'INVALID']
                                }),
        EnumDyField.data_source('Delete Protection',
                                'data.deletion_protection',
                                default_badge={
                                    'indigo.500': ['true'],
                                    'coral.600': ['false']
                                }),
        TextDyField.data_source('Service accounts',
                                'data.service_account.email'),
        TextDyField.data_source('Total Storage Bytes',
                                'data.total_storage_bytes'),
        TextDyField.data_source('Fingerprint', 'data.fingerprint'),
        TextDyField.data_source('Self Link', 'data.self_link'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])
예제 #14
0
from spaceone.inventory.model.route.data import *
from spaceone.inventory.libs.schema.metadata.dynamic_field import TextDyField, EnumDyField, ListDyField, DateTimeDyField
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta

'''
INSTANCE
'''

# TAB - Route
route_detail_meta = ItemDynamicLayout.set_fields('Route Details', fields=[
    TextDyField.data_source('Name', 'data.id'),
    TextDyField.data_source('Name', 'data.name'),
    TextDyField.data_source('Description', 'data.description'),
    TextDyField.data_source('Network', 'data.display.network_display'),
    TextDyField.data_source('Destination IP Address Range', 'data.dest_range'),
    TextDyField.data_source('Priority', 'data.priority'),
    ListDyField.data_source('Instance Tags (Detail)', 'data.display.instance_tags'),
    DateTimeDyField.data_source('Creation Time', 'data.creation_timestamp'),
])

# instance_template_meta_disk
route_applicable_inst_meta= TableDynamicLayout.set_fields('Applicable to Instances',  root_path='data.applicable_instance', fields=[
    TextDyField.data_source('Name', 'name'),
    TextDyField.data_source('Subnetwork', 'subnetwork'),
    TextDyField.data_source('Internal IP', 'address'),
    ListDyField.data_source('Tags', 'tags',
                            default_badge={'type': 'outline', 'delimiter': '<br>'}),
    ListDyField.data_source('Service Accounts', 'service_accounts'),
    TextDyField.data_source('Project', 'project'),
    ListDyField.data_source('Label', 'labels_display',
예제 #15
0
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
INSTANCE
'''

# TAB - Bucket
vpc_network_detail_meta = ItemDynamicLayout.set_fields(
    'VPC Network Details',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Description', 'data.description'),
        TextDyField.data_source('Maximum transmission unit', 'data.mtu'),
        TextDyField.data_source('Mode', 'data.subnet_creation_mode'),
        EnumDyField.data_source('Global Dynamic Routing',
                                'data.global_dynamic_route',
                                default_state={
                                    'safe': ['On'],
                                    'warning': ['Off'],
                                }),
        TextDyField.data_source('Dynamic Routing mode',
                                'data.dynamic_routing_mode'),
        #TextDyField.data_source('DNS Server Policy', 'data.location.location_type'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])

vpc_network_subnets_meta = TableDynamicLayout.set_fields(
    'Subnets',
    root_path='data.subnetwork_data.subnets',
    fields=[
        TextDyField.data_source('Name', 'name'),
예제 #16
0
'''

# TAB - Firewall
firewall_detail_meta = ItemDynamicLayout.set_fields(
    'Firewall Details',
    fields=[
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Logs',
                                'data.display.logs',
                                default_badge={
                                    'indigo.500': ['On'],
                                    'coral.600': ['Off']
                                }),
        TextDyField.data_source('Priority', 'data.priority'),
        TextDyField.data_source('Direction', 'data.display.direction_display'),
        EnumDyField.data_source('Action On Match',
                                'data.display.action',
                                default_badge={
                                    'indigo.500': ['Allow'],
                                    'coral.600': ['Deny']
                                }),
        ListDyField.data_source('Source Filter', 'data.source_ranges'),
        ListDyField.data_source('Protocols and ports',
                                'data.display.protocols_port'),
        #TextDyField.data_source('Insights', 'data.network_tier_display'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])

# instance_template_meta_disk
firewall_applicable_inst_meta = TableDynamicLayout.set_fields(
'''
INSTANCE
'''

# TAB - Bucket
dataset_details_meta = ItemDynamicLayout.set_fields(
    'Information',
    fields=[
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source(
            'Default Partition Expires',
            'data.default_partition_expiration_ms_display'),
        TextDyField.data_source('Default Table Expires',
                                'data.default_table_expiration_ms_display'),
        EnumDyField.data_source('Visible on Console',
                                'data.visible_on_console',
                                default_badge={
                                    'indigo.500': ['true'],
                                    'coral.600': ['false']
                                }),
        DateTimeDyField.data_source('Creation Time', 'data.creation_time'),
        DateTimeDyField.data_source('Last Modified Time',
                                    'data.last_modified_time'),
    ])

access_table_meta = SimpleTableDynamicLayout.set_fields(
    'Access',
    root_path='data.access',
    fields=[
예제 #18
0
external_ip_address_detail_meta = ItemDynamicLayout.set_fields(
    'External IP Address Details',
    fields=[
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Version',
                                'data.status_display',
                                default_state={
                                    'safe': ['Reserved'],
                                    'warning': ['In Use'],
                                    'disable': ['Reserving'],
                                }),
        TextDyField.data_source('Region', 'data.region'),
        EnumDyField.data_source('Type',
                                'data.is_ephemeral',
                                default_badge={
                                    'indigo.500': ['Static'],
                                    'coral.600': ['Ephemeral']
                                }),
        EnumDyField.data_source('Version',
                                'data.ip_version_display',
                                default_badge={
                                    'indigo.500': ['IPv4'],
                                    'coral.600': ['IPv6']
                                }),
        ListDyField.data_source('In Used By', 'data.used_by'),
        ListDyField.data_source('In Used By (Details)', 'data.users'),
        TextDyField.data_source('Network Tier', 'data.network_tier_display'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ])
'''
# TAB - Default
snapshot_info_meta = ItemDynamicLayout.set_fields(
    'Snapshots',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Storage Type', 'data.sku.name'),
        SizeField.data_source('Size', 'data.size'),
        TextDyField.data_source('Source Disk', 'data.source_disk_name'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        EnumDyField.data_source(
            'Snapshot state',
            'data.disk_state',
            default_state={
                'safe': ['ActiveSAS', 'ActiveUpload', 'Attached', 'Reserved'],
                'warning': ['ReadyToUpload'],
                'available': ['Unattached']
            }),
        TextDyField.data_source('Snapshot Type', 'data.incremental_display'),
        TextDyField.data_source('Subscription ID', 'data.subscription_id'),
        TextDyField.data_source('Subscription Name', 'data.subscription_name'),
        TextDyField.data_source('Encryption Type',
                                'data.encryption.type_display'),
        TextDyField.data_source('Network Access Policy',
                                'data.network_access_policy_display'),
        DateTimeDyField.data_source('Created Time', 'data.time_created')
    ])

# TAB - tags
exadata_infra_base = ItemDynamicLayout.set_fields(
    'General Info',
    fields=[
        TextDyField.data_source('Display Name', 'data.display_name'),
        TextDyField.data_source('Id', 'data.id'),
        EnumDyField.data_source(
            'Lifecycle State',
            'data.lifecycle_state',
            default_state={
                'safe': ['AVAILABLE'],
                'warning':
                ['UPDATING', 'TERMINATING', 'MAINTENANCE_IN_PROGRESS'],
                'alert': ['TERMINATED', 'FAILED']
            }),
        TextDyField.data_source('Availability Domain',
                                'data.availability_domain'),
        TextDyField.data_source('Compartment', 'data.compartment_name'),
        TextDyField.data_source('Shape', 'data.shape'),
        TextDyField.data_source('Version', 'data.version'),
        TextDyField.data_source('Compute Count', 'data.compute_count'),
        TextDyField.data_source('Storage Count', 'data.storage_count'),
        SizeField.data_source('Total Storage Size',
                              'data.total_storage_size_in_gbs',
                              options={
                                  'display_unit': 'GB',
                                  'source_unit': 'GB'
                              }),
        SizeField.data_source('Available Storage Size',
                              'data.available_storage_size_in_gbs',
                              options={
                                  'display_unit': 'GB',
                                  'source_unit': 'GB'
                              }),
        #TextDyField.data_source('Maintenance Window' 'data.maintenance_window.display'),
        DateTimeDyField.data_source('Created', 'data.time_created')
    ])
# TAB - Default
disk_info_meta = ItemDynamicLayout.set_fields(
    'Disks',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Storage Account Type', 'data.sku.name'),
        SizeField.data_source('Size', 'data.size'),
        EnumDyField.data_source(
            'Disk State',
            'data.disk_state',
            default_state={
                'safe': ['ActiveSAS', 'ActiveUpload', 'Attached', 'Reserved'],
                'warning': ['ReadyToUpload'],
                'available': ['Unattached']
            }),
        TextDyField.data_source('Attached VM', 'data.managed_by'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Resource ID', 'data.id'),
        ListDyField.data_source('Zones',
                                'data.zones',
                                options={'delimiter': '<br>'}),
        TextDyField.data_source('Subscription ID', 'data.subscription_id'),
        TextDyField.data_source('Subscription Name', 'data.subscription_name'),
        TextDyField.data_source('Encryption Type', 'data.encryption.type'),
        TextDyField.data_source('Networking',
                                'data.network_access_policy_display'),
        DateTimeDyField.data_source('Created Time', 'data.time_created'),
        TextDyField.data_source('Max Shares', 'data.max_shares')
    ])
# TAB - Default
# Resource Group, Location, Subscription, Subscription ID, SKU, Backend pool, Health probe,
# Load balancing rule, NAT Rules, Public IP Addresses, Load Balancing Type
load_balancer_info_meta = ItemDynamicLayout.set_fields(
    'LoadBalancers',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Subscription', 'data.subscription_id'),
        TextDyField.data_source('SKU', 'data.sku.name'),
        TextDyField.data_source('Backend pools',
                                'data.backend_address_pools_count_display'),
        ListDyField.data_source('Health Probe',
                                'data.probes_display',
                                options={'delimiter': '<br>'}),
        ListDyField.data_source('Load Balancing Rule',
                                'data.load_balancing_rules_display',
                                options={'delimiter': '<br>'}),
        ListDyField.data_source('NAT Rules',
                                'data.inbound_nat_rules_display',
                                options={'delimiter': '<br>'}),
        ListDyField.data_source('Private IP Address',
                                'data.private_ip_address_display',
                                options={'delimiter': '<br>'}),
    ])

# TAB - Frontend IP Configurations
# 1) Name, IP Address, Rules Count, Type, Public IP Address
load_balancer_info_frontend_ip_config = SimpleTableDynamicLayout.set_fields(
from spaceone.inventory.model.virtualnetwork.data import VirtualNetwork
'''
VIRTUAL_NETWORK
'''
# TAB - Default
virtual_network_info_meta = ItemDynamicLayout.set_fields(
    'Virtual Network',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Resource ID', 'data.id'),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Subscription', 'data.subscription_name'),
        TextDyField.data_source('Subscription ID', 'data.subscription_id'),
        ListDyField.data_source('DNS servers',
                                'data.dhcp_options.dns_servers'),
        EnumDyField.data_source('DDoS Protection Standard',
                                'data.enable_ddos_protection',
                                default_state={
                                    'safe': ['True'],
                                    'warning': ['False']
                                }),
        TextDyField.data_source('Resource GUID', 'data.resource_guid'),
        ListDyField.data_source('Address Space',
                                'data.address_space.address_prefixes')
    ])
'''
# TAB - Address Space - 
# Address space, Address range, Address count
virtual_network_address_space = ItemDynamicLayout.set_fields('Address Space', 'data.address_space', fields=[
    ListDyField.data_source('Address Space', 'address_prefixes'),
예제 #24
0
general_info_meta = ItemDynamicLayout.set_fields('General Information', fields=[
    TextDyField.data_source('Display Name', 'data.display_name'),
    TextDyField.data_source('Workload Type', 'data.db_workload_display'),
    EnumDyField.data_source('Is dedicated', 'data.is_dedicated',
                            default_badge={'indigo.500': ['true'],
                                           'coral.600': ['false'],
                                           }),
    TextDyField.data_source('Region', 'data.region'),
    TextDyField.data_source('Compartment', 'data.compartment_name'),
    TextDyField.data_source('OCID', 'data.id'),
    TextDyField.data_source('OCPU Count', 'data.cpu_core_count'),
    TextDyField.data_source('Storage in GB', 'data.data_storage_size_in_gbs'),
    TextDyField.data_source('License Type', 'data.license_model'),
    TextDyField.data_source('Database version', 'data.db_version'),
    EnumDyField.data_source('Auto Scaling', 'data.is_auto_scaling_enabled',
                            default_badge={'indigo.500': ['true'],
                                           'coral.600': ['false'],
                                           }),
    EnumDyField.data_source('Lifecycle State', 'data.lifecycle_state', default_state={
                                'safe': ['AVAILABLE','AVAILABLE_NEEDS_ATTENTION'],
                                'warning': ['PROVISIONING', 'STOPPING','STARTING','TERMINATING',
                                            'RESTORE_IN_PROGRESS','BACKUP_IN_PROGRESS','SCALE_IN_PROGRESS',
                                            'UPDATING', 'MAINTENANCE_IN_PROGRESS', 'RESTARTING','RECREATING',
                                            'ROLE_CHANGE_IN_PROGRESS', 'UPGRADING'],
                                'alert': ['STOPPED', 'TERMINATED', 'UNAVAILABLE','RESTORE_FAILED','UNKNOWN_ENUM_VALUE']
                            }),
    EnumDyField.data_source('Is Free Tier', 'data.is_free_tier', default_badge={
                                'indigo.500': ['true'],
                                'coral.600': ['false'],
                            }),
    TextDyField.data_source('Open Mode', 'data.open_mode'),
    EnumDyField.data_source('Data Guard Enable', 'data.is_data_guard_enable', default_badge={
                                'indigo.500': ['true'],
                                'coral.600': ['false']
                            }),
    TextDyField.data_source('Service Console URL', 'data.service_console_url'),
    EnumDyField.data_source('Data Safe Status', 'data.data_safe_status', default_state={
                                'safe': ['REGISTERED'],
                                'warning': ['REGISTERING', 'DEREGISTERING'],
                                'alert': ['NOT_REGISTERED', 'FAILED']
                            }),
    TextDyField.data_source('Key Store id', 'data.key_store_id'),
    TextDyField.data_source('Oracle Key Vault Wallet Name', 'data.key_store_wallet_name'),
    DateTimeDyField.data_source('Created', 'data.time_created')
])
예제 #25
0
    network = ModelType(NetworkCPUMonitoring, serialize_when_none=False)


class Server(Model):
    monitoring = ModelType(Monitoring, default={})

    def reference(self, reference_id):
        return {
            "resource_id": reference_id,
        }


cpu_details_meta = ItemDynamicLayout.set_fields(
    'CPU',
    fields=[
        TextDyField.data_source('CPU Utilization (%) | Avg',
                                'data.monitoring.cpu.utilization.avg'),
        TextDyField.data_source('CPU Utilization (%) | Max',
                                'data.monitoring.cpu.utilization.max')
    ])

memory_details_meta = ItemDynamicLayout.set_fields(
    'Memory',
    fields=[
        TextDyField.data_source('Memory Usage (%) | Avg',
                                'data.monitoring.memory.usage.avg'),
        SizeField.data_source('Memory Total | Avg',
                              'data.monitoring.memory.total.avg'),
        SizeField.data_source('Memory Used  | Avg',
                              'data.monitoring.memory.used.avg'),
        TextDyField.data_source('Memory Usage (%) | Max',
                                'data.monitoring.memory.usage.max'),
예제 #26
0
INSTANCE
'''
# TAB - Instance
sql_meta_instance = ItemDynamicLayout.set_fields(
    'Instance',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('State',
                                'data.display_state',
                                default_state={
                                    'safe': ['RUNNING'],
                                    'disable': ['UNKNOWN', 'ON-DEMAND'],
                                    'alert': ['STOPPED'],
                                }),
        TextDyField.data_source('Type', 'data.database_version'),
        TextDyField.data_source('Project', 'data.project'),
        ListDyField.data_source('Public IP Address',
                                'data.ip_addresses',
                                default_badge={
                                    'type': 'outline',
                                    'sub_key': 'ip_address',
                                    'delimiter': '<br>'
                                }),
        TextDyField.data_source('Connection name', 'data.connection_name'),
        TextDyField.data_source('Location', 'data.gce_zone'),
        TextDyField.data_source('Service Account',
                                'data.service_account_email_address'),
    ])

# TAB - Configuration
sql_meta_configuration = ItemDynamicLayout.set_fields(
bucket_configuration_meta = ItemDynamicLayout.set_fields(
    'Configurations',
    fields=[
        TextDyField.data_source('Location Type',
                                'data.location.location_type'),
        TextDyField.data_source('Location', 'data.location.location_display'),
        EnumDyField.data_source('Default Storage Class',
                                'data.default_storage_class',
                                default_outline_badge=[
                                    'Standard', 'Nearline', 'Coldline',
                                    'Archive'
                                ]),
        TextDyField.data_source('Encryption Type', 'data.encryption'),
        TextDyField.data_source('Object Total Counts', 'data.object_count'),
        SizeField.data_source('Object Size', 'data.object_total_size'),
        EnumDyField.data_source('Public Access',
                                'data.public_access',
                                default_state={
                                    'safe':
                                    ['Subject to object ACLs', 'Not public'],
                                    'warning': ['Not authorized'],
                                    'alert': ['Public to internet'],
                                }),
        EnumDyField.data_source('Requester Pays',
                                'data.requester_pays',
                                default_badge={
                                    'indigo.500': ['OFF'],
                                    'coral.600': ['ON']
                                }),
        TextDyField.data_source('Access Control', 'data.access_control'),
        TextDyField.data_source('Link URL', 'data.links.link_url'),
        TextDyField.data_source('Link for gsutil', 'data.links.gsutil_link'),
        DateTimeDyField.data_source('Created', 'data.creation_timestamp'),
        DateTimeDyField.data_source('Updated', 'data.update_timestamp'),
    ])
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, \
    HTMLDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta

resources = TableDynamicLayout.set_fields('Affected Resources',
                                          'data.flagged_resources')
resources.type = 'raw-table'

check = ItemDynamicLayout.set_fields(
    'Check Information',
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Category', 'data.category'),
        EnumDyField.data_source('Status',
                                'data.status',
                                default_state={
                                    'safe': ['ok'],
                                    'warning': ['warning'],
                                    'alert': ['error'],
                                    'disable': ['not_available']
                                }),
        TextDyField.data_source('Checked at', 'data.timestamp'),
    ])

html_description = HTMLDynamicLayout.set('Description',
                                         root_path='data.description')

metadata = CloudServiceMeta.set_layouts(
    layouts=[check, html_description, resources])