Пример #1
0
                                default_badge={
                                    'type': 'outline',
                                    'sub_key': 'name',
                                    'delimiter': '<br>'
                                }),
        ListDyField.data_source('Ports',
                                'name_ports',
                                default_badge={
                                    'type': 'outline',
                                    'sub_key': 'port',
                                    'delimiter': '<br>'
                                }),
    ])

instance_group_meta = CloudServiceMeta.set_layouts([
    instance_group_layout, instance_layout, autoscaling_layout,
    autohealing_layout
])


class ComputeEngineResource(CloudServiceResource):
    cloud_service_group = StringType(default='ComputeEngine')


class InstanceGroupResource(ComputeEngineResource):
    cloud_service_type = StringType(default='InstanceGroup')
    data = ModelType(InstanceGroup)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_group_meta,
                          serialized_name='metadata')

                                'scheme',
                                default_badge={
                                    'indigo.500': ['public'],
                                    'coral.600': ['private']
                                })
    ])

tags = TableDynamicLayout.set_fields('Oracle Tags',
                                     root_path='data.oracle_cloud.tags',
                                     fields=[
                                         TextDyField.data_source('Key', 'key'),
                                         TextDyField.data_source(
                                             'Value', 'value'),
                                     ])

compute_instance_metadata = CloudServiceMeta.set_layouts(
    [instance, tags, disk, nic, security_group, lb])


class ComputeInstanceResource(CloudServiceResource):
    cloud_service_group = StringType(default='Compute')
    cloud_service_type = StringType(default='Instance')
    data = ModelType(ServerData)
    _metadata = ModelType(CloudServiceMeta,
                          default=compute_instance_metadata,
                          serialize_name='metadata')
    name = StringType()
    tags = ListType(ModelType(Tags))
    nics = ListType(ModelType(NIC))
    disks = ListType(ModelType(Disk))
    primary_ip_address = StringType(default='')
    ip_addresses = ListType(StringType())
        TextDyField.data_source(
            'Auto-delete Snapshots After',
            'snapshot_schedule_policy.retention_policy.max_retention_days_display'
        ),
        DateTimeDyField.data_source('Creation Time', 'creation_timestamp')
    ])

snapshot_labels_meta = TableDynamicLayout.set_fields(
    'Labels',
    root_path='data.labels',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value'),
    ])

instance_template_meta = CloudServiceMeta.set_layouts(
    [snapshot_instance_meta, snapshot_schedule_meta, snapshot_labels_meta])


class ComputeEngineResource(CloudServiceResource):
    cloud_service_group = StringType(default='ComputeEngine')


class SnapshotResource(ComputeEngineResource):
    cloud_service_type = StringType(default='Snapshot')
    data = ModelType(Snapshot)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')


class SnapshotResponse(CloudServiceResponse):
        TextDyField.data_source('Write IOPS', 'tags.write_iops'),
        TextDyField.data_source('Read Throughput(MB/s)',
                                'tags.read_throughput'),
        TextDyField.data_source('Write Throughput(MB/s)',
                                'tags.write_throughput'),
    ])

meta_it_labels = TableDynamicLayout.set_fields(
    'Labels',
    root_path='data.labels',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value'),
    ])

instance_template_meta = CloudServiceMeta.set_layouts(
    [instance_template, it_meta_network, meta_it_disk, meta_it_labels])


class ComputeEngineResource(CloudServiceResource):
    cloud_service_group = StringType(default='ComputeEngine')


class InstanceTemplateResource(ComputeEngineResource):
    cloud_service_type = StringType(default='InstanceTemplate')
    data = ModelType(InstanceTemplate)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')


class InstanceTemplateResponse(CloudServiceResponse):
        TextDyField.data_source(
            'VM Agent',
            'data.virtual_machine_profile.os_profile.linux_configuration.provision_vm_agent'
        ),
        TextDyField.data_source(
            'Automatic OS Upgrades',
            'data.upgrade_policy.automatic_os_upgrade_policy.enable_automatic_os_upgrade'
        ),
        TextDyField.data_source(
            'Custom Data',
            'data.virtual_machine_profile.os_profile.custom_data')
    ])

vm_scale_set_meta = CloudServiceMeta.set_layouts([
    vm_scale_set_info_meta, vm_scale_set_info_tags, vm_scale_set_instance,
    vm_scale_set_info_network, vm_scale_set_info_scaling,
    vm_scale_set_info_disk, vm_scale_set_info_os_profile
])


class ComputeResource(CloudServiceResource):
    cloud_service_group = StringType(default='Compute')


class VmScaleSetResource(ComputeResource):
    cloud_service_type = StringType(default='VmScaleSet')
    data = ModelType(VirtualMachineScaleSet)
    _metadata = ModelType(CloudServiceMeta,
                          default=vm_scale_set_meta,
                          serialized_name='metadata')
    name = StringType()
        TextDyField.data_source('Storage Account', 'storage_account_id'),
        TextDyField.data_source('Event Hub', 'event_hub_name'),
        TextDyField.data_source('Log Analytics Workspace', 'workspace_id'),
    ])

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

sql_databases_meta = CloudServiceMeta.set_layouts([
    sql_databases_info_meta, sql_databases_configure,
    sql_databases_diagnostic_settings, sql_databases_info_tags
])


class DatabaseResource(CloudServiceResource):
    cloud_service_group = StringType(default='Sql')


class SqlDatabaseResource(DatabaseResource):
    cloud_service_type = StringType(default='SqlDatabases')
    data = ModelType(Database)
    _metadata = ModelType(CloudServiceMeta,
                          default=sql_databases_meta,
                          serialized_name='metadata')

Пример #7
0
                                                                  'alert': ['DELETED', 'FAILED']}),
                                      TextDyField.data_source('Fingerprint', 'fingerprint'),
                                      TextDyField.data_source('Connection String', 'connection_string')
                                  ])

dbsystem_tags = TableDynamicLayout.set_fields(
    'Tags',
    root_path='data.freeform_tags',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value')
    ])

dbsystem_metadata = CloudServiceMeta.set_layouts([
    dbsystem_base, dbsystem_network, dbsystem_database, dbsystem_node,
    dbsystem_patches, dbsystem_patch_history, dbsystem_console_connection,
    dbsystem_tags
])
'''
Database
'''
db_base = ItemDynamicLayout.set_fields(
    'General Info',
    fields=[
        TextDyField.data_source('DB Name', 'data.db_name'),
        TextDyField.data_source('Id', 'data.id'),
        TextDyField.data_source('Compartment Id', 'data.compartment_id'),
        EnumDyField.data_source('State',
                                'data.lifecycle_state',
                                default_state={
                                    'safe': ['AVAILABLE'],
Пример #8
0
        TextDyField.data_source('Timeout(Seconds)', 'timeout')
    ])

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

application_gateway_meta = CloudServiceMeta.set_layouts([
    application_gateway_info_meta, application_gateway_configuration,
    application_gateway_web_app_firewall_meta,
    application_gateway_backend_pools,
    application_gateway_frontend_ip_configurations,
    application_gateway_listeners_info
])


class ComputeResource(CloudServiceResource):
    cloud_service_group = StringType(default='Network')


class ApplicationGatewayResource(ComputeResource):
    cloud_service_type = StringType(default='ApplicationGateway')
    data = ModelType(ApplicationGateway)
    _metadata = ModelType(CloudServiceMeta,
                          default=application_gateway_meta,
                          serialized_name='metadata')
                                                                     'data.server_automatic_tuning.options', fields=[
        TextDyField.data_source('Tuning Type', 'tuning_type'),
        TextDyField.data_source('Desired State', 'desired_state'),
        TextDyField.data_source('Current State', 'actual_state'),
    ])


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

sql_servers_meta = CloudServiceMeta.set_layouts(
    [sql_servers_info_meta, sql_server_failover_group, sql_server_backups, sql_servers_active_directory_admin, sql_servers_databases_info,
     sql_servers_elastic_pools,
     sql_servers_deleted_databases, sql_servers_auditing, sql_servers_network, sql_servers_transparent_data_encryption, sql_servers_automatic_tuning_options,
     sql_servers_firewalls_and_vn,
     sql_servers_private_endpoint_connections, sql_servers_info_tags])


class DatabaseResource(CloudServiceResource):
    cloud_service_group = StringType(default='SQL')


class SqlServerResource(DatabaseResource):
    cloud_service_type = StringType(default='SQLServer')
    data = ModelType(SqlServer)
    _metadata = ModelType(CloudServiceMeta, default=sql_servers_meta, serialized_name='metadata')
    name = StringType()

Пример #10
0
        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=[
        TextDyField.data_source('Account ID', 'aws_account_id'),
        TextDyField.data_source('Event Type', 'entity_type'),
        TextDyField.data_source('Entity Value', 'entity_value'),
    ])

metadata = CloudServiceMeta.set_layouts(
    layouts=[event_meta, affected_resources_meta])


class PersonalHealthDashboardResource(CloudServiceResource):
    cloud_service_group = StringType(default='PersonalHealthDashboard')


class EventResource(PersonalHealthDashboardResource):
    cloud_service_type = StringType(default='Event')
    data = ModelType(Event)
    _metadata = ModelType(CloudServiceMeta,
                          default=metadata,
                          serialized_name='metadata')


class EventResponse(CloudServiceResponse):
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')


class DatabaseResponse(CloudServiceResponse):
    resource = PolyModelType(DatabaseResource)
                                }),
        DateTimeDyField.data_source('Creation Time', 'creation_timestamp')
    ])

meta_disk_template = ListDynamicLayout.set_layouts(
    'Disks', layouts=[disk_properties_meta, disk_performance_meta])

it_meta_labels = TableDynamicLayout.set_fields(
    'Labels',
    root_path='data.labels',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value'),
    ])

disk_meta = CloudServiceMeta.set_layouts(
    [meta_disk_template, it_meta_labels, schedule_meta])


class ComputeEngineResource(CloudServiceResource):
    cloud_service_group = StringType(default='ComputeEngine')


class DiskResource(ComputeEngineResource):
    cloud_service_type = StringType(default='Disk')
    data = ModelType(Disk)
    _metadata = ModelType(CloudServiceMeta,
                          default=disk_meta,
                          serialized_name='metadata')


class DiskResponse(CloudServiceResponse):
        TextDyField.data_source('Network', 'network_display'),
        TextDyField.data_source('Subnetwork', 'subnetwork_display'),
        TextDyField.data_source('Primary internal IP', 'primary_ip_address'),
        ListDyField.data_source('Alias IP range',
                                'alias_ip_ranges',
                                default_badge={
                                    'type': 'outline',
                                    'delimiter': '<br>'
                                }),
        TextDyField.data_source('Public IP', 'public_ip_address'),
        ListDyField.data_source('Access Configs', 'configs'),
        ListDyField.data_source('Network Tier', 'network_tier_display'),
        ListDyField.data_source('IP forwarding', 'ip_forward')
    ])

instance_template_meta = CloudServiceMeta.set_layouts(
    [meta_machine_template, it_meta_disk, it_meta_network])


class ComputeEngineResource(CloudServiceResource):
    cloud_service_group = StringType(default='ComputeEngine')


class MachineImageResource(ComputeEngineResource):
    cloud_service_type = StringType(default='MachineImage')
    data = ModelType(MachineImage)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')


class MachineImageResponse(CloudServiceResponse):
Пример #14
0
# 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')
])

instance_template_meta = CloudServiceMeta.set_layouts([route_detail_meta,
                                                       route_applicable_inst_meta])


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


class RouteResource(VPCResource):
    cloud_service_type = StringType(default='Route')
    data = ModelType(Route)
    _metadata = ModelType(CloudServiceMeta, default=instance_template_meta, serialized_name='metadata')


class RouteResponse(CloudServiceResponse):
    resource = PolyModelType(RouteResource)
Пример #15
0
        TextDyField.data_source('Peered Project ID', 'display.project_id'),
        EnumDyField.data_source('Status',
                                'display.state_display',
                                default_badge={
                                    'indigo.500': ['Active'],
                                    'coral.600': ['Inactive']
                                }),
        TextDyField.data_source('Exchange Custom Routes',
                                'display.ex_custom_route'),
        TextDyField.data_source('Exchange Subnet Routes With Public IP',
                                'display.ex_route_public_ip_display'),
    ])

instance_template_meta = CloudServiceMeta.set_layouts([
    vpc_network_detail_meta, vpc_network_subnets_meta,
    vpc_network_subnets_ip_address_meta, vpc_network_firewall_meta,
    vpc_network_route_meta, vpc_network_peering_meta
])


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


class VPCNetworkResource(VPCResource):
    cloud_service_type = StringType(default='VPCNetwork')
    data = ModelType(VPCNetwork)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')
Пример #16
0
                                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')
    ])

instance_template_meta = CloudServiceMeta.set_layouts(
    [firewall_detail_meta, firewall_applicable_inst_meta])


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


class FirewallResource(VPCResource):
    cloud_service_type = StringType(default='Firewall')
    data = ModelType(Firewall)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')


class FirewallResponse(CloudServiceResponse):
        DateTimeDyField.data_source('Creation Time',
                                    'statistics.creation_time'),
        DateTimeDyField.data_source('Start Time', 'statistics.start_time'),
        DateTimeDyField.data_source('End time', 'statistics.end_time')
    ])

workspace_labels_meta = TableDynamicLayout.set_fields(
    'Labels',
    root_path='data.labels',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value'),
    ])

big_query_workspace_meta = CloudServiceMeta.set_layouts([
    workspace_dataset_meta, workspace_table_meta, workspace_table_schema_meta,
    workspace_jobs_meta, workspace_matching_project_meta, workspace_labels_meta
])


class BigQueryGroupResource(CloudServiceResource):
    cloud_service_group = StringType(default='BigQuery')


class SQLWorkSpaceResource(BigQueryGroupResource):
    cloud_service_type = StringType(default='SQLWorkspace')
    data = ModelType(BigQueryWorkSpace)
    _metadata = ModelType(CloudServiceMeta,
                          default=big_query_workspace_meta,
                          serialized_name='metadata')

Пример #18
0
                                    '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):
    cloud_service_type = StringType(default='ExternalIPAddress')
    data = ModelType(ExternalIpAddress)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')


class ExternalIpAddressResponse(CloudServiceResponse):
                                '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
snapshot_info_tags = TableDynamicLayout.set_fields(
    'Tags',
    'data.tags',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value')
    ])

snapshot_meta = CloudServiceMeta.set_layouts(
    [snapshot_info_meta, snapshot_info_tags])


class ComputeResource(CloudServiceResource):
    cloud_service_group = StringType(default='Compute')


class SnapshotResource(ComputeResource):
    cloud_service_type = StringType(default='Snapshots')
    data = ModelType(Snapshot)
    _metadata = ModelType(CloudServiceMeta,
                          default=snapshot_meta,
                          serialized_name='metadata')


class SnapshotResponse(CloudServiceResponse):
            TextDyField.data_source('Compartment', 'compartment_name'),
            TextDyField.data_source('Availability Domain', 'availability_domain'),
            TextDyField.data_source('CPU Core Count', 'cpu_core_count'),
            DateTimeDyField.data_source('Created', 'time_created')
        ])

exadata_tag = TableDynamicLayout.set_fields(
    'Tags',
    root_path='data.freeform_tags',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value')
    ])

exadata_infra_meta = CloudServiceMeta.set_layouts([
    exadata_infra_base, exadata_vm_cluster_meta, exadata_maintenance_meta,
    exadata_tag
])
'''
ExadataVMCluster
'''
vm_cluster_base = ItemDynamicLayout.set_fields(
    'General Info',
    fields=[
        TextDyField.data_source('Display Name', 'data.display_name'),
        TextDyField.data_source('Cluster Name', 'data.cluster_name'),
        EnumDyField.data_source('State',
                                'lifecycle_state',
                                default_state={
                                    'safe': ['AVAILABLE'],
                                    'warning': [
                                        'PROVISIONING', 'UPDATING',
        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=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value')
    ])

disk_meta = CloudServiceMeta.set_layouts([disk_info_meta, disk_info_tags])


class ComputeResource(CloudServiceResource):
    cloud_service_group = StringType(default='Compute')


class DiskResource(ComputeResource):
    cloud_service_type = StringType(default='Disk')
    data = ModelType(Disk)
    _metadata = ModelType(CloudServiceMeta,
                          default=disk_meta,
                          serialized_name='metadata')
    name = StringType()

    ])
# TextDyField.data_source('IP Version', 'frontend_ip_configurations...private_ip_address_version'),
# TextDyField.data_source('Destination', 'private_ip_address'),

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

load_balancer_meta = CloudServiceMeta.set_layouts([
    load_balancer_info_meta, load_balancer_info_frontend_ip_config_meta,
    load_balancer_info_backend_pools_meta, load_balancer_info_health_probes,
    load_balancer_info_load_balancing_rules, load_balancer_info_tags
])


class NetworkResource(CloudServiceResource):
    cloud_service_group = StringType(default='Network')


class LoadBalancerResource(NetworkResource):
    cloud_service_type = StringType(default='LoadBalancers')
    data = ModelType(LoadBalancer)
    _metadata = ModelType(CloudServiceMeta,
                          default=load_balancer_meta,
                          serialized_name='metadata')
        TextDyField.data_source('Subnet', 'subnet'),
        TextDyField.data_source('Resource Group', 'resource_group')
    ])

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

virtual_network_meta = CloudServiceMeta.set_layouts([
    virtual_network_info_meta, virtual_network_connected_devices,
    virtual_network_subnets, virtual_network_firewall,
    virtual_network_peerings, virtual_network_service_endpoints,
    virtual_network_private_endpoints, virtual_network_tags
])


class ComputeResource(CloudServiceResource):
    cloud_service_group = StringType(default='Network')


class VirtualNetworkResource(ComputeResource):
    cloud_service_type = StringType(default='VirtualNetwork')
    data = ModelType(VirtualNetwork)
    _metadata = ModelType(CloudServiceMeta,
                          default=virtual_network_meta,
                          serialized_name='metadata')
    name = StringType()
Пример #24
0
                                                                                'ROLE_CHANGE_IN_PROGRESS', 'UPGRADING'],
                                                                    'alert': ['STOPPED', 'TERMINATED', 'UNAVAILABLE',
                                                                              'RESTORE_FAILED','UNKNOWN_ENUM_VALUE']}),
                                          DateTimeDyField.data_source('Last Refresh', 'last_refresh'),
                                          DateTimeDyField.data_source('Refresh Point', 'time_of_last_refresh_point')
                                          ])

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

adb_meta = CloudServiceMeta.set_layouts([database_meta,
                                         connection_meta,
                                         backup_meta,
                                         refresh_clone_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')
    name = StringType()

Пример #25
0
        SizeField.data_source('Network Sent Throughput | Max',
                              'data.monitoring.network.sent_throughput.max'),
    ])

performance_form_1_details = ListDynamicLayout.set_layouts(
    'Performance',
    layouts=[cpu_details_meta, disk_details_meta, network_details_meta])

performance_form_2_details = ListDynamicLayout.set_layouts(
    'Performance',
    layouts=[
        cpu_details_meta, memory_details_meta, disk_details_meta,
        network_details_meta
    ])

server_basic_aws_meta = CloudServiceMeta.set_layouts(
    [performance_form_1_details])
server_basic_azure_meta = CloudServiceMeta.set_layouts(
    [performance_form_1_details])
server_basic_google_meta = CloudServiceMeta.set_layouts(
    [performance_form_2_details])


class ServerAwsInstanceResource(CloudServiceResource):
    provider = StringType(default='aws')
    cloud_service_group = StringType(default='ComputeEngine')
    cloud_service_type = StringType(default='Instance')
    data = ModelType(Server)
    _metadata = ModelType(CloudServiceMeta,
                          default=server_basic_aws_meta,
                          serialized_name='metadata')
Пример #26
0
            'data.settings.backup_configuration.replication_log_archiving_enabled',
            default_badge={
                'indigo.500': ['true'],
                'coral.600': ['false']
            }),
        EnumDyField.data_source(
            'Point In Time Recovery Enabled',
            'data.settings.backup_configuration.point_in_time_recovery_enabled',
            default_badge={
                'indigo.500': ['true'],
                'coral.600': ['false']
            }),
    ])

cloud_sql_meta = CloudServiceMeta.set_layouts([
    sql_meta_instance, sql_meta_configuration, sql_meta_connection,
    sql_meta_database, sql_meta_user, sql_meta_backup
])


class CloudSQLResource(CloudServiceResource):
    cloud_service_group = StringType(default='CloudSQL')


class InstanceResource(CloudSQLResource):
    cloud_service_type = StringType(default='Instance')
    data = ModelType(Instance)
    _metadata = ModelType(CloudServiceMeta,
                          default=cloud_sql_meta,
                          serialized_name='metadata')

    root_path='data.lifecycle_rule.rule',
    fields=[
        TextDyField.data_source('Action', 'action_display'),
        TextDyField.data_source('Object Condition', 'condition_display'),
    ])

bucket_labels_meta = TableDynamicLayout.set_fields(
    'Labels',
    root_path='data.labels',
    fields=[
        TextDyField.data_source('Key', 'key'),
        TextDyField.data_source('Value', 'value'),
    ])

instance_template_meta = CloudServiceMeta.set_layouts([
    bucket_configuration_meta, bucket_permission_meta, bucket_retention_meta,
    bucket_life_cycle_meta, bucket_labels_meta
])


class StorageGroupResource(CloudServiceResource):
    cloud_service_group = StringType(default='Storage')


class StorageResource(StorageGroupResource):
    cloud_service_type = StringType(default='Bucket')
    data = ModelType(Storage)
    _metadata = ModelType(CloudServiceMeta,
                          default=instance_template_meta,
                          serialized_name='metadata')

        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])


class TrustedAdvisorResource(CloudServiceResource):
    cloud_service_group = StringType(default='TrustedAdvisor')


class CheckResource(TrustedAdvisorResource):
    cloud_service_type = StringType(default='Check')
    data = ModelType(Check)
    _metadata = ModelType(CloudServiceMeta,
                          default=metadata,
                          serialized_name='metadata')


class CheckResponse(CloudServiceResponse):