Exemple #1
0
 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={
from spaceone.inventory.libs.schema.metadata.dynamic_field import TextDyField, DateTimeDyField, EnumDyField, ListDyField, SizeField
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, ListDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
INSTANCE
'''
# TAB - Instance Template
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']
        TextDyField.data_source('Server Admin Login',
                                'data.administrator_login'),
    ])

# TAB - Configure
sql_databases_configure = ItemDynamicLayout.set_fields(
    'Configure',
    fields=[
        TextDyField.data_source('Service Tier', 'data.service_tier_display'),
        TextDyField.data_source('Compute Tier', 'data.compute_tier'),
        TextDyField.data_source('Compute Hardware', 'data.sku.family'),
        TextDyField.data_source('Licence Type', 'data.license_type'),
        TextDyField.data_source('vCores', 'data.current_sku.capacity'),
        TextDyField.data_source('Data max size', 'data.max_size_gb'),
        TextDyField.data_source('Zone Redundant', 'data.zone_redundant'),
        ListDyField.data_source('Sync Groups', 'data.sync_group_display'),
        ListDyField.data_source('Sync Agents', 'data.sync_agent_display'),
        TextDyField.data_source('Collation', 'data.collation'),
        DateTimeDyField.data_source('Creation Date', 'data.creation_date')
    ])

# TAB - Diagnostic Settings
sql_databases_diagnostic_settings = SimpleTableDynamicLayout.set_fields(
    'Diagnostic Settings',
    'data.diagnostic_settings_resource',
    fields=[
        TextDyField.data_source('Name', 'name'),
        TextDyField.data_source('Storage Account', 'storage_account_id'),
        TextDyField.data_source('Event Hub', 'event_hub_name'),
        TextDyField.data_source('Log Analytics Workspace', 'workspace_id'),
    ])
Exemple #4
0
cst_instance_template.labels = ['Compute']
cst_instance_template.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg',
}
# Basic table for
cst_instance_template._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Machine Type',
                                'data.machine.machine_display'),
        TextDyField.data_source('Image', 'data.image'),
        TextDyField.data_source('Disk Type', 'data.disk_display'),
        ListDyField.data_source('In Used By',
                                'data.in_used_by',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ],
    search=[
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='Machine Type', key='data.machine.machine_type'),
        SearchField.set(name='Image', key='data.image'),
        SearchField.set(name='Disk Type', key='data.disk_display'),
        SearchField.set(name='In Use By', key='data.in_used_by'),
        SearchField.set(name='Creation Time',
                        key='data.creation_timestamp',
                        data_type='datetime'),
    ])
vm_scale_set_info_network = ListDynamicLayout.set_layouts(
    'Networking',
    layouts=[
        vm_scale_set_info_networking, vm_scale_set_info_network_configuration,
        vm_scale_set_info_ip_configurations
    ])

# TAB - Scaling
# Instance Count, Scale-in policy
vm_scale_set_scaling_info = ItemDynamicLayout.set_fields(
    'Scaling',
    fields=[
        TextDyField.data_source('Instance Count', 'data.instance_count'),
        ListDyField.data_source('Scale-in Policy',
                                'data.scale_in_policy.rules',
                                options={'delimiter': '<br>'})
    ])

vm_scale_set_scaling_rules = SimpleTableDynamicLayout.set_fields(
    'Autoscale Settings',
    'data.virtual_machine_scale_set_power_state',
    fields=[
        TextDyField.data_source('Name', 'name'),
        ListDyField.data_source('Profiles',
                                'profiles_display',
                                options={'delimiter': '<br>'}),
        TextDyField.data_source('Default', 'profiles.capacity.default'),
        TextDyField.data_source('Max', 'profiles.capacity.maximum'),
        TextDyField.data_source('Min', 'profiles.capacity.minimum'),
    ])
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg',
}

cst_snapshot._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Status',
                                'data.status',
                                default_state={
                                    'safe': ['READY'],
                                    'warning':
                                    ['CREATING', 'UPLOADING', 'DELETING'],
                                    'alert': ['FAILED'],
                                }),
        ListDyField.data_source('Location', 'data.storage_locations'),
        SizeField.data_source('SnapShot Size', 'data.disk.storage_bytes'),
        TextDyField.data_source('Creation Type', 'data.creation_type'),
        TextDyField.data_source('Source Disk',
                                'data.disk.source_disk_display'),
        SizeField.data_source('Disk Size', 'data.disk.disk_size'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ],
    # TODO: Give a set that fit to its filtered data...
    search=[
        SearchField.set(name='ID', key='data.id'),
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='Location', key='data.storage_locations'),
        SearchField.set(name='Source Disk',
                        key='data.disk.source_disk_display'),
Exemple #7
0
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('External Address', 'data.address'),
        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'),
        TextDyField.data_source('Network Tier', 'data.network_tier_display'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ],
    search=[
        SearchField.set(name='ID', key='data.id'),
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='IP Address', key='data.address'),
        SearchField.set(name='Version', key='data.ip_version_display'),
        SearchField.set(name='Network Tier', key='data.network_tier_display'),
        SearchField.set(name='Creation Time',
                        key='data.creation_timestamp',
                        data_type='datetime'),
    ])
Exemple #8
0
                                    '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'),
    ])

instance_template_meta = CloudServiceMeta.set_layouts(
    [external_ip_address_detail_meta])


class VPCResource(CloudServiceResource):
    cloud_service_group = StringType(default='VPC')


class ExternalIpAddressResource(VPCResource):
        TextDyField.data_source('CPU Core Count', 'data.cpu_core_count'),
        TextDyField.data_source('Node Count', 'data.node_count'),
        SizeField.data_source('Storage Size',
                              'data.storage_size_in_gbs',
                              options={
                                  'display_unit': 'GB',
                                  'source_unit': 'GB'
                              }),
        TextDyField.data_source('Storage Percentage',
                                'data.data_storage_percentage'),
        TextDyField.data_source('System Version', 'data.system_version'),
        TextDyField.data_source('License Model', 'data.license_model'),
        TextDyField.data_source('GI Version', 'data.gi_version'),
        TextDyField.data_source('Time Zone', 'data.time_zone'),
        ListDyField.data_source('SSH Public Key',
                                'data.ssh_public_keys',
                                options={'delimiter': '<br>'}),
        DateTimeDyField.data_source('Created', 'data.time_created')
    ])

vm_cluster_network = ItemDynamicLayout.set_fields(
    'Network',
    fields=[
        TextDyField.data_source('Subnet Id', 'data.subnet_id'),
        TextDyField.data_source('Backup Subnet Id', 'data.backup_subnet_id'),
        ListDyField.data_source('NSG Id',
                                'data.nsg_ids',
                                options={'delimiter': '<br>'}),
        ListDyField.data_source('Backup NSG Id',
                                'data.backup_network_nsg_ids',
                                options={'delimiter': '<br>'}),
Exemple #10
0
        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(
    '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'),
Exemple #11
0
cst_instance._metadata = CloudServiceTypeMeta.set_meta(
    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('Location', 'data.gce_zone'),
        TextDyField.data_source('Data Disk Size (GB)',
                                'data.settings.data_disk_size_gb'),
    ],
    search=[
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='State', key='data.state'),
        SearchField.set(name='Type', key='data.database_version'),
        SearchField.set(name='Project', key='data.project'),
        SearchField.set(name='Region', key='data.region'),
        SearchField.set(name='Zone', key='data.gce_zone'),
        SearchField.set(name='Public IP Address',
Exemple #12
0
    ])

# TAB - Subnets
# Name, IPv4, IPv6, Available Ips, Delegated To, Security Group
application_gateway_web_app_firewall = ItemDynamicLayout.set_fields(
    'Web Application Firewall',
    'data.web_application_firewall_configuration',
    fields=[
        EnumDyField.data_source('Firewall Status Enabled',
                                'enabled',
                                default_state={
                                    'safe': ['True'],
                                    'warning': ['False']
                                }),
        TextDyField.data_source('Firewall Mode', 'firewall_mode'),
        ListDyField.data_source('IP Address Prefixes', 'address_prefixes'),
        TextDyField.data_source('Global Parameters', ''),
        TextDyField.data_source('Max Request Body Size(KB)',
                                'max_request_body_size_in_kb'),
        TextDyField.data_source('File Upload Limit(MB)',
                                'file_upload_limit_in_mb'),
        TextDyField.data_source('Rule Set Type', 'rule_set_type'),
        TextDyField.data_source('Rule Set Version', 'rule_set_version'),
        TextDyField.data_source('Advanced Rule Configuration', ''),
    ])

application_gateway_web_app_firewall_exclusions = SimpleTableDynamicLayout.set_fields(
    'Exclusions',
    'data.web_application_firewall_configuration.exclusions',
    fields=[
        TextDyField.data_source('Field', 'match_variable'),
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']
                                }),
Exemple #14
0
cst_route.provider = 'google_cloud'
cst_route.group = 'VPC'
cst_route.service_code = 'vpc'
cst_route.labels = ['Networking']
cst_route.tags = {
    'spaceone:icon': 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Route.svg',
}


cst_route._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Description', 'data.description'),
        TextDyField.data_source('Destination IP Range', 'data.dest_range'),
        TextDyField.data_source('Priority', 'data.priority'),
        ListDyField.data_source('Instance tags', 'data.display.instance_tags_on_list'),
        TextDyField.data_source('Network', 'data.display.network_display'),
        TextDyField.data_source('Next Hop', 'data.display.next_hop'),
        DateTimeDyField.data_source('Creation Time', 'data.creation_timestamp'),
    ],

    search=[
        SearchField.set(name='ID', key='data.id'),
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='Priority', key='data.priority'),
        SearchField.set(name='Instance Tags', key='data.tags'),
        SearchField.set(name='Network', key='data.display.network_display'),
        SearchField.set(name='Creation Time', key='data.creation_timestamp', data_type='datetime'),
    ]
)
        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 - tags
disk_info_tags = TableDynamicLayout.set_fields(
    'Tags',
    'data.tags',
    fields=[
# 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.libs.schema.metadata.dynamic_field import TextDyField, DateTimeDyField, EnumDyField, ListDyField, SizeField
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, ListDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
INSTANCE
'''
# 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>'
                                }),
Exemple #18
0
                                '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')
])

network_meta = ItemDynamicLayout.set_fields('Network', fields=[
    TextDyField.data_source('Access Type', 'data.permission_level'),
    ListDyField.data_source('NSG ids', 'data.nsg_ids', options={'delimiter': '<br>'}),
    TextDyField.data_source('Subnet id', 'data.subnet_id'),
    TextDyField.data_source('Private Endpoint', 'data.private_endpoint'),
    TextDyField.data_source('Private Endpoint ip', 'data.private_endpoint_ip'),
    TextDyField.data_source('Private Endpoint Label', 'data.private_endpoint_label')
])

maintenance_meta = ItemDynamicLayout.set_fields('Maintenance', fields=[
    DateTimeDyField.data_source('Next Maintenance Begin', 'data.time_maintenance_begin'),
    DateTimeDyField.data_source('Next Maintenance End', 'data.time_maintenance_end')
])

database_meta = ListDynamicLayout.set_layouts('Autonomous Database Information',
                                              [general_info_meta, network_meta, maintenance_meta])

'''
cst_disk.is_major = True
cst_disk.tags = {
    'spaceone:icon': 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg',
    'spaceone:display_name': 'Disk'
}

cst_disk._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('ID', 'data.id'),
        TextDyField.data_source('Zone', 'data.zone'),
        TextDyField.data_source('Source Image', 'data.source_image_display'),
        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'),
        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>'}),
        DateTimeDyField.data_source('Creation Time', 'data.creation_timestamp'),
    ],
    search=[
        SearchField.set(name='ID', key='data.id'),
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='Status', key='data.status'),
        SearchField.set(name='Disk Type', key='data.disk_type'),
        SearchField.set(name='Size (Bytes)', key='data.size', data_type='integer'),
        SearchField.set(name='Project', key='data.project'),
        SearchField.set(name='Zone', key='data.zone'),
        SearchField.set(name='Region', key='region_code'),
        SearchField.set(name='Creation Time', key='data.creation_timestamp', data_type='datetime'),
    ]
Exemple #20
0
    '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(
    'Configuration',
    fields=[
        EnumDyField.data_source('Auto Storage Increased',
                                'data.settings.storage_auto_resize',
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
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'),
Exemple #22
0
autoscaler = ItemDynamicLayout.set_fields(
    'Auto Scaler',
    fields=[
        TextDyField.data_source('Resource ID', 'data.auto_scaler.id'),
        TextDyField.data_source('Name', 'data.auto_scaler.name'),
        TextDyField.data_source('Description', 'data.auto_scaler.description'),
        EnumDyField.data_source('Status',
                                'data.auto_scaler.status',
                                default_state={
                                    'safe': ['ACTIVE'],
                                    'warning': ['PENDING', 'DELETING'],
                                    'alert': ['ERROR']
                                }),
        ListDyField.data_source('Status Detail Message',
                                'data.auto_scaler.status_details',
                                options={'sub_key': 'message'}),
        TextDyField.data_source('Self Link', 'data.auto_scaler.self_link'),
        DateTimeDyField.data_source('Creation Time',
                                    'data.auto_scaler.creation_timestamp'),
    ])

autoscaling_policy = ItemDynamicLayout.set_fields(
    'Auto Scaling Policy',
    fields=[
        EnumDyField.data_source('Mode',
                                'data.auto_scaler.autoscaling_policy.mode',
                                default_badge={
                                    'indigo.500': ['ON'],
                                    'coral.600': ['OFF']
                                }),
Exemple #23
0
cst_machine_image.service_code = 'compute'
cst_machine_image.labels = ['Compute']
cst_machine_image.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg',
}
# Basic table for
cst_machine_image._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Source Instance',
                                'data.machine.machine_display'),
        TextDyField.data_source('Machine Type', 'data.machine.machine_type'),
        ListDyField.data_source('Storage location',
                                'data.storage_locations',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ],
    search=[
        SearchField.set(name='ID', key='data.id'),
        SearchField.set(name='Name', key='data.name'),
        SearchField.set(name='Machine Type', key='data.machine.machine_type'),
        SearchField.set(name='Disk Type', key='data.disks.tags.disk_type'),
        SearchField.set(name='Core', key='data.machine.core'),
        SearchField.set(name='Memory', key='data.machine.memory'),
        SearchField.set(name='Creation Time',
                        key='data.creation_timestamp',
                        data_type='datetime'),
Exemple #24
0
        TextDyField.data_source('Ip Address Ranges', 'ip_cidr_range'),
        TextDyField.data_source('Gateway', 'gateway_address'),
        TextDyField.data_source('Private Google Access', 'google_access'),
        TextDyField.data_source('Flow logs', 'flow_log'),
    ])

vpc_network_subnets_ip_address_meta = TableDynamicLayout.set_fields(
    'Static Internal IP Addresses',
    root_path='data.ip_address_data',
    fields=[
        TextDyField.data_source('Name', 'name'),
        TextDyField.data_source('Internal Ip Address', 'address'),
        TextDyField.data_source('Subnetwork', 'subnet_name'),
        TextDyField.data_source('Region', 'region'),
        TextDyField.data_source('Version', 'ip_version_display'),
        ListDyField.data_source('In Used By', 'used_by'),
    ])

vpc_network_firewall_meta = TableDynamicLayout.set_fields(
    'Firewall Rules',
    root_path='data.firewall_data.firewall',
    fields=[
        TextDyField.data_source('Name', 'name'),
        TextDyField.data_source('Type', 'display.type_display'),
        ListDyField.data_source('Targets',
                                'display.target_display',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        TextDyField.data_source('Filters', 'display.filter'),
                         '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'
Exemple #26
0
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',
                            default_badge={'type': 'outline', 'delimiter': '<br>'}),
    DateTimeDyField.data_source('Creation Time', 'creation_timestamp')