Exemplo n.º 1
0
class GenericSnmpConfig(GenericResourceConfig):
    snmp_read_community = PasswordAttrRO(
        attribute_names.SNMP_READ_COMMUNITY, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_write_community = PasswordAttrRO(
        attribute_names.SNMP_WRITE_COMMUNITY, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_v3_user = ResourceAttrRO(
        attribute_names.SNMP_V3_USER, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_v3_password = PasswordAttrRO(
        attribute_names.SNMP_V3_PASSWORD, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_v3_private_key = ResourceAttrRO(
        attribute_names.SNMP_V3_PRIVATE_KEY, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_v3_auth_protocol = ResourceAttrRO(
        attribute_names.SNMP_V3_AUTH_PROTOCOL, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_v3_priv_protocol = ResourceAttrRO(
        attribute_names.SNMP_V3_PRIVACY_PROTOCOL, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    snmp_version = ResourceAttrRO(
        attribute_names.SNMP_VERSION, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    enable_snmp = ResourceAttrRO(
        attribute_names.ENABLE_SNMP, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    disable_snmp = ResourceAttrRO(
        attribute_names.DISABLE_SNMP, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
Exemplo n.º 2
0
class GenericCLIConfig(GenericResourceConfig):
    user = ResourceAttrRO(attribute_names.USER, ResourceAttrRO.NAMESPACE.SHELL_NAME)
    password = PasswordAttrRO(
        attribute_names.PASSWORD, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    enable_password = PasswordAttrRO(
        attribute_names.ENABLE_PASSWORD, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    cli_connection_type = ResourceAttrRO(
        attribute_names.CLI_CONNECTION_TYPE, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    cli_tcp_port = ResourceAttrRO(
        attribute_names.CLI_TCP_PORT, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    sessions_concurrency_limit = ResourceAttrRO(
        attribute_names.SESSION_CONCURRENCY_LIMIT, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
class GenericApiConfig(GenericResourceConfig):
    api_user = ResourceAttrRO(attribute_names.API_USER,
                              ResourceAttrRO.NAMESPACE.SHELL_NAME)
    api_password = PasswordAttrRO(attribute_names.API_PASSWORD,
                                  PasswordAttrRO.NAMESPACE.SHELL_NAME)
    api_scheme = ResourceAttrRO(attribute_names.API_SCHEME,
                                ResourceAttrRO.NAMESPACE.SHELL_NAME)
    api_port = ResourceAttrRO(attribute_names.API_PORT,
                              ResourceAttrRO.NAMESPACE.SHELL_NAME)
class AzureResourceConfig(GenericResourceConfig):
    region = RegionResourceAttrRO("Region",
                                  RegionResourceAttrRO.NAMESPACE.SHELL_NAME)

    vm_size = ResourceAttrRO("VM Size", ResourceAttrRO.NAMESPACE.SHELL_NAME)

    networks_in_use = ResourceAttrRO("Networks in use",
                                     ResourceAttrRO.NAMESPACE.SHELL_NAME)

    azure_subscription_id = ResourceAttrRO("Azure Subscription ID",
                                           ResourceAttrRO.NAMESPACE.SHELL_NAME)

    azure_tenant_id = ResourceAttrRO("Azure Tenant ID",
                                     ResourceAttrRO.NAMESPACE.SHELL_NAME)

    azure_application_id = ResourceAttrRO("Azure Application ID",
                                          ResourceAttrRO.NAMESPACE.SHELL_NAME)

    azure_application_key = PasswordAttrRO("Azure Application Key",
                                           PasswordAttrRO.NAMESPACE.SHELL_NAME)

    management_group_name = ResourceAttrRO("Management Group Name",
                                           ResourceAttrRO.NAMESPACE.SHELL_NAME)

    execution_server_selector = ResourceAttrRO(
        "Execution Server Selector", ResourceAttrRO.NAMESPACE.SHELL_NAME)

    additional_mgmt_networks = AdditionalMgmtNetworksAttrRO(
        "Additional Mgmt Networks",
        AdditionalMgmtNetworksAttrRO.NAMESPACE.SHELL_NAME)

    custom_tags = CustomTagsAttrRO("Custom Tags",
                                   CustomTagsAttrRO.NAMESPACE.SHELL_NAME)

    private_ip_allocation_method = ResourceAttrRO(
        "Private IP Allocation Method", ResourceAttrRO.NAMESPACE.SHELL_NAME)

    @classmethod
    def from_context(cls, shell_name, context, api=None, supported_os=None):
        """Creates an instance of a Resource by given context.

        :param str shell_name: Shell Name
        :param list supported_os: list of supported OS
        :param cloudshell.shell.core.driver_context.ResourceCommandContext context:
        :param cloudshell.api.cloudshell_api.CloudShellAPISession api:
        :rtype: GenericResourceConfig
        """
        return cls(
            shell_name=shell_name,
            name=context.resource.name,
            fullname=context.resource.fullname,
            address=context.resource.address,
            family_name=context.resource.family,
            attributes=dict(context.resource.attributes),
            supported_os=supported_os,
            api=api,
        )
Exemplo n.º 5
0
class GenericBackupConfig(GenericResourceConfig):
    backup_location = ResourceAttrRO(
        attribute_names.BACKUP_LOCATION, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    backup_type = ResourceAttrRO(
        attribute_names.BACKUP_TYPE, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    backup_user = ResourceAttrRO(
        attribute_names.BACKUP_USER, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    backup_password = PasswordAttrRO(
        attribute_names.BACKUP_PASSWORD, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
Exemplo n.º 6
0
class GenericConsoleServerConfig(GenericResourceConfig):
    console_server_ip_address = ResourceAttrRO(
        attribute_names.CONSOLE_SERVER_IP_ADDRESS, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    console_user = ResourceAttrRO(
        attribute_names.CONSOLE_USER, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    console_port = ResourceAttrRO(
        attribute_names.CONSOLE_PORT, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
    console_password = PasswordAttrRO(
        attribute_names.CONSOLE_PASSWORD, ResourceAttrRO.NAMESPACE.SHELL_NAME
    )
Exemplo n.º 7
0
class OSResourceConfig(GenericResourceConfig):
    ATTR_NAMES = OSAttributeNames
    controller_url = ResourceAttrROShellName(ATTR_NAMES.controller_url)
    os_domain_name = ResourceAttrROShellName(ATTR_NAMES.os_domain_name)
    os_project_name = ResourceAttrROShellName(ATTR_NAMES.os_project_name)
    user = ResourceAttrROShellName(ATTR_NAMES.user)
    password = PasswordAttrRO(ATTR_NAMES.password,
                              ResourceAttrRO.NAMESPACE.SHELL_NAME)
    os_reserved_networks = ResourceListAttrROShellName(
        ATTR_NAMES.os_reserved_networks)
    os_mgmt_net_id = ResourceAttrROShellName(ATTR_NAMES.os_mgmt_net_id)
    vlan_type = ResourceAttrROShellName(ATTR_NAMES.vlan_type)
    os_physical_int_name = ResourceAttrROShellName(
        ATTR_NAMES.os_physical_int_name)
    floating_ip_subnet_id = ResourceAttrROShellName(
        ATTR_NAMES.floating_ip_subnet_id)
    exec_server_selector = ResourceAttrROShellName(
        ATTR_NAMES.exec_server_selector)