示例#1
0
cst_bucket.is_major = True
cst_bucket.labels = ['Storage']
cst_bucket.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Cloud_Storage.svg',
}

cst_bucket._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        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'
                                ]),
        EnumDyField.data_source('Public Access',
                                'data.public_access',
                                default_state={
                                    'safe':
                                    ['Subject to object ACLs', 'Not public'],
                                    'warning': ['Not authorized'],
                                    'alert': ['Public to internet'],
                                }),
        TextDyField.data_source('Object Total Counts', 'data.object_count'),
        SizeField.data_source('Object Size', 'data.object_total_size'),
        TextDyField.data_source('Access Control', 'data.access_control'),
        TextDyField.data_source('Lifecycle rules',
                                'data.lifecycle_rule.lifecycle_rule_display'),
# TAB - Instances
# name, computer name, location, status,  provisioning state, fault domain,
#       protection policy, and latest model
vm_scale_set_instance = TableDynamicLayout.set_fields(
    'Instances',
    'data.vm_instances',
    fields=[
        TextDyField.data_source('Name', 'name'),
        TextDyField.data_source('Computer Name', 'os_profile.computer_name'),
        TextDyField.data_source('Location', 'location'),
        EnumDyField.data_source(
            'Status',
            'vm_instance_status_profile.statuses.code',
            default_state={
                'safe': ['PowerState/running', 'PowerState/starting'],
                'warning': [
                    'PowerState/deallocated', 'PowerState/deallocating',
                    'PowerState/stopped', 'PowerState/stopping',
                    'PowerState/unknown'
                ]
            }),
        TextDyField.data_source('Provisioning State', 'provisioning_state'),
        TextDyField.data_source('Protection From Scale-in',
                                'protection_policy.protect_from_scale_in'),
        TextDyField.data_source(
            'Protection From Scale-set Actions',
            'protection_policy.protect_from_scale_set_actions'),
        TextDyField.data_source('Latest Model', 'latest_model_applied'),
        TextDyField.data_source('Virtual Network', 'primary_vnet')
    ])
示例#3
0
cst_sql_server.group = 'SQL'
cst_sql_server.service_code = 'Microsoft.Sql/servers'
cst_sql_server.labels = ['Database']
cst_sql_server.is_primary = True
cst_sql_server.is_major = True
cst_sql_server.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/azure/azure-sql-servers.svg',
}

cst_sql_server._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Status',
                                'data.state',
                                default_state={
                                    'safe': ['Ready'],
                                    'warning': ['Disabled']
                                }),
        TextDyField.data_source('Resource Group', 'data.resource_group'),
        TextDyField.data_source('Location', 'data.location'),
        TextDyField.data_source('Subscription', 'data.subscription_name'),
    ],
    search=[
        SearchField.set(name='ID', key='data.id', data_type='string'),
        SearchField.set(name='Name', key='data.name', data_type='string'),
        SearchField.set(name='Subscription ID',
                        key='data.subscription_id',
                        data_type='string'),
        SearchField.set(name='Subscription Name',
                        key='data.subscription_name',
                        data_type='string'),
示例#4
0
cst_external_ip.group = 'VPC'
cst_external_ip.service_code = 'vpc'
cst_external_ip.labels = ['Networking']
cst_external_ip.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/External_IP_Address.svg',
}

cst_external_ip._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        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'),
示例#5
0
cst_instance_group.name = 'InstanceGroup'
cst_instance_group.provider = 'google_cloud'
cst_instance_group.group = 'ComputeEngine'
cst_instance_group.service_code = 'compute'
cst_instance_group.labels = ['Compute']
cst_instance_group.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg',
}

cst_instance_group._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Instances', 'data.instance_counts'),
        EnumDyField.data_source(
            'Type',
            'data.instance_group_type',
            default_outline_badge=['STATELESS', 'STATEFUL', 'UNMANAGED']),
        TextDyField.data_source(
            'Min Replicas',
            'data.auto_scaler.autoscaling_policy.min_num_replicas'),
        TextDyField.data_source(
            'Max Replicas',
            'data.auto_scaler.autoscaling_policy.max_num_replicas'),
        TextDyField.data_source('Recommended Size',
                                'data.auto_scaler.recommended_size'),
        TextDyField.data_source('Template', 'data.template.name'),
        EnumDyField.data_source('Autoscaling Mode',
                                'data.auto_scaler.autoscaling_policy.mode',
                                default_badge={
                                    'indigo.500': ['ON'],
                                    'coral.600': ['OFF']
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, ListDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
DISK
'''
# 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'),
cst_snapshot.provider = 'google_cloud'
cst_snapshot.group = 'ComputeEngine'
cst_snapshot.service_code = 'compute'
cst_snapshot.labels = ['Compute', 'Storage']
cst_snapshot.tags = {
    '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'),
示例#8
0
from spaceone.inventory.model.instance_group.data import InstanceGroup
from spaceone.inventory.libs.schema.metadata.dynamic_field import TextDyField, DateTimeDyField, EnumDyField, ListDyField
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, ListDynamicLayout, \
    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',
示例#9
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'),
        TextDyField.data_source('Region', 'region'),
示例#10
0
from spaceone.inventory.model.autonomous_database.data import Database
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

'''
Autonomous Database Information
'''
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',
示例#11
0
from spaceone.inventory.model.cloud_sql.data import Instance
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 - 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',
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, \
    ListDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
ExadataInfrastructure
'''
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',
示例#13
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 - Bucket
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']
示例#14
0
cst_instance.labels = ['Database']
cst_instance.is_primary = True
cst_instance.is_major = True
cst_instance.service_code = 'cloudsql'
cst_instance.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Cloud_SQL.svg',
}

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'),
cst_firewall.name = 'Firewall'
cst_firewall.provider = 'google_cloud'
cst_firewall.group = 'VPC'
cst_firewall.service_code = 'vpc'
cst_firewall.labels = ['Networking']
cst_firewall.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Firewall_Rule.svg',
}

cst_firewall._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Logs',
                                'data.display.logs',
                                default_badge={
                                    'indigo.500': ['On'],
                                    'coral.600': ['Off']
                                }),
        TextDyField.data_source('Network', 'data.display.network_display'),
        TextDyField.data_source('Direction', 'data.display.direction_display'),
        TextDyField.data_source('Priority', 'data.priority'),
        EnumDyField.data_source('Action On Match',
                                'data.display.action',
                                default_badge={
                                    'indigo.500': ['Allow'],
                                    'coral.600': ['Deny']
                                }),
        DateTimeDyField.data_source('Creation Time',
                                    'data.creation_timestamp'),
    ],
    search=[
# 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=[
        TextDyField.data_source('Role', 'role'),
        TextDyField.data_source('Special Group', 'special_group'),
        TextDyField.data_source('User by E-mail', 'user_by_email')
    ])
示例#17
0
                                                                  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
'''
DBSystem
'''
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'),
# TAB - Default
# Resource Group, Location, Subscription, Subscription ID, SKU, Backend pool, Health probe,
# Load balancing rule, NAT Rules, Public IP Addresses, Load Balancing Type
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'),
# 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'),
    ])

# TAB - Network
cst_load_balancing.service_code = 'netservice'
cst_load_balancing.is_primary = True
cst_load_balancing.is_major = True
cst_load_balancing.labels = ['Networking']
cst_load_balancing.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Load_Balancing.svg',
}

cst_load_balancing._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Protocol',
                                'data.lead_protocol',
                                default_badge={
                                    'primary': ['HTTP', 'HTTPS', 'HTTP(S)'],
                                    'indigo.500': ['TCP', 'TCP (Proxy)'],
                                    'coral.600': ['UDP', 'UDP (Proxy)']
                                }),
        TextDyField.data_source('Region', 'data.region'),
        TextDyField.data_source('Frontends', 'data.frontend_display'),
        TextDyField.data_source('Backends', 'data.backends_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='Protocol', key='data.lead_protocol'),
        SearchField.set(name='Region', key='data.region'),
        SearchField.set(name='description', key='data.description'),
cst_disk.provider = 'google_cloud'
cst_disk.group = 'ComputeEngine'
cst_disk.labels = ['Compute', 'Storage']
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'),
示例#22
0
cst_ta.group = 'TrustedAdvisor'
cst_ta.labels = ['Management']
cst_ta.is_primary = True
cst_ta.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/AWS-Trusted-Advisor.svg',
}

cst_ta._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Category', 'data.category'),
        TextDyField.data_source('Name', 'data.name'),
        EnumDyField.data_source('Status',
                                'data.status',
                                default_state={
                                    'safe': ['ok'],
                                    'warning': ['warning'],
                                    'alert': ['error'],
                                    'disable': ['not_available']
                                }),
        TextDyField.data_source('Check ID', 'data.check_id'),
    ],
    search=[
        SearchField.set(name='Check ID', key='data.check_id'),
        SearchField.set(name='Category', key='data.category'),
        SearchField.set(name='Status', key='data.status'),
        SearchField.set(name='AWS Account ID', key='data.account_id'),
    ])

CLOUD_SERVICE_TYPES = [
    CloudServiceTypeResponse({'resource': cst_ta}),
]
'''
# 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'),
    TextDyField.data_source('Address Range', ''),
    TextDyField.data_source('Address Count', '')
])
'''
示例#24
0
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/oci/OCI_icon_Autonomous.svg'
}

cst_adb._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Display Name', 'data.display_name'),
        EnumDyField.data_source(
            '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('Dedicated',
                                'data.is_dedicated',
                                default_badge={
                                    'indigo.500': ['true'],
                                    'coral.600': ['false'],
                                }),
        TextDyField.data_source('OCPUs', 'data.cpu_core_count'),
cst_phd = CloudServiceTypeResource()
cst_phd.name = 'Event'
cst_phd.provider = 'aws'
cst_phd.group = 'PersonalHealthDashboard'
cst_phd.labels = ['Management']
cst_phd.is_primary = True
cst_phd.tags = {
    'spaceone:icon': 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/AWS-Personal-Health-Dashboard.svg',
}

cst_phd._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Event', 'data.event_title'),
        EnumDyField.data_source('Status', 'data.status_code', default_state={
            'safe': ['closed'],
            'warning': ['upcoming'],
            'alert': ['open']
        }),
        TextDyField.data_source('Event Category', 'data.event_type_category'),
        TextDyField.data_source('Region', 'region_code'),
        TextDyField.data_source('Affected Resources', 'data.affected_resource_display'),
        DateTimeDyField.data_source('Start Time', 'data.start_time'),
        DateTimeDyField.data_source('Last Update Time', 'data.last_update_time'),
    ],
    search=[
        SearchField.set(name='ARN', key='data.arn'),
        SearchField.set(name='Event', key='data.event_type_code'),
        SearchField.set(name='Event Category', key='data.event_type_category'),
        SearchField.set(name='Event Scope Code', key='data.event_scope_code'),
        SearchField.set(name='Status Code', key='data.status_code'),
        SearchField.set(name='Service', key='data.service'),
示例#26
0
cst_bmvm_dbsystems.is_primary = True
cst_bmvm_dbsystems.is_major = True
cst_bmvm_dbsystems.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/oci/OCI_icon_Database_Service.svg'
}

cst_bmvm_dbsystems._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Display Name', 'data.display_name'),
        EnumDyField.data_source(
            'State',
            'data.lifecycle_state',
            default_state={
                'safe': ['AVAILABLE'],
                'warning': [
                    'UPDATING', 'TERMINATING', 'MAINTENANCE_IN_PROGRESS',
                    'PROVISIONING'
                ],
                'alert':
                ['TERMINATED', 'FAILED', 'MIGRATED', 'NEEDS_ATTENTION']
            }),
        TextDyField.data_source('Availability Domain',
                                'data.availability_domain'),
        TextDyField.data_source('Shape', 'data.shape'),
        TextDyField.data_source('CPU Core Count', 'data.cpu_core_count'),
        SizeField.data_source('Storage Size',
                              'data.data_storage_size_in_gbs',
                              options={
                                  'display_unit': 'GB',
                                  'source_unit': 'GB'
                              }),
from spaceone.inventory.model.compute_instance.data.oracle_cloud import Tags
'''
Instance
'''
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'),
示例#28
0
cst_network.labels = ['Networking']
cst_network.tags = {
    'spaceone:icon':
    'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/VPC.svg',
}

cst_network._metadata = CloudServiceTypeMeta.set_meta(
    fields=[
        TextDyField.data_source('Name', 'data.name'),
        TextDyField.data_source('Number of Subnet',
                                'data.subnetwork_data.total_number'),
        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('Firewall Rules',
                                'data.firewall_data.total_number'),
        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='description', key='data.description'),
        SearchField.set(name='firewall', key='data.firewall_data.firewall'),
        SearchField.set(name='route', key='data.route_data.route'),
        SearchField.set(name='subnetwork', key='data.subnetwork_data.subnets'),
        SearchField.set(name='Creation Time',
from spaceone.inventory.libs.schema.metadata.dynamic_layout import ItemDynamicLayout, TableDynamicLayout, ListDynamicLayout, SimpleTableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta
'''
INSTANCE
'''

# TAB - Bucket
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',
    ListDynamicLayout, SimpleTableDynamicLayout
from spaceone.inventory.libs.schema.cloud_service import CloudServiceResource, CloudServiceResponse, CloudServiceMeta

'''
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'),