Beispiel #1
0
    def get(self, app):
        client_map = {
            'vm': VmClient,
            'iam': IamClient,
            'disk': DiskClient,
            'mongodb': MongodbClient,
            'mps': MpsClient,
            'streambus': StreambusClient,
            'ipanti': IpantiClient,
            'rds': RdsClient,
            'redis': RedisClient,
            'monitor': MonitorClient,
            'vpc': VpcClient,
            'xdata': XdataClient,
            'nc': NcClient,
            'oss': OssClient,
        }

        profile_manager = ProfileManager()
        cli_config = profile_manager.load_current_profile()
        if cli_config is None:
            return None

        logger = get_logger(app.pargs.debug)

        config = Config(cli_config.endpoint, cli_config.scheme)
        credential = Credential(cli_config.access_key, cli_config.secret_key)
        if self.__service not in client_map:
            return None

        client = client_map[self.__service](credential, config, logger)
        return client
Beispiel #2
0
    def get(self, app):
        client_map = {
            'rds': RdsClient,
            'kubernetes': KubernetesClient,
            'streamcomputer': StreamcomputerClient,
            'ipanti': IpantiClient,
            'oss': OssClient,
            'redis': RedisClient,
            'deploy': DeployClient,
            'sop': SopClient,
            'function': FunctionClient,
            'portal': PortalClient,
            'clouddnsservice': ClouddnsserviceClient,
            'cps': CpsClient,
            'cdn': CdnClient,
            'streambus': StreambusClient,
            'httpdns': HttpdnsClient,
            'mps': MpsClient,
            'disk': DiskClient,
            'nc': NcClient,
            'vm': VmClient,
            'pod': PodClient,
            'ams': AmsClient,
            'jdro': JdroClient,
            'zfs': ZfsClient,
            'datastar': DatastarClient,
            'kms': KmsClient,
            'elite': EliteClient,
            'iam': IamClient,
            'iothub': IothubClient,
            'jcq': JcqClient,
            'baseanti': BaseantiClient,
            'ias': IasClient,
            'mongodb': MongodbClient,
            'live': LiveClient,
            'jdfusion': JdfusionClient,
            'vpc': VpcClient,
            'monitor': MonitorClient,
            'xdata': XdataClient,
            'cr': CrClient,
        }

        profile_manager = ProfileManager()
        cli_config = profile_manager.load_current_profile()
        if cli_config is None:
            return None

        logger = get_logger(app.pargs.debug)

        config = Config(cli_config.endpoint, cli_config.scheme, int(cli_config.timeout))
        credential = Credential(cli_config.access_key, cli_config.secret_key)
        if self.__service not in client_map:
            return None

        client = client_map[self.__service](credential, config, logger)
        return client
Beispiel #3
0
def attach(app, service, headers, region_id, container_id, pod_id=None):
    def handle_signal(signum, frame):
        h, w = web_socket.get_win_size()
        resize_tty(h, w, app, service, headers, region_id, container_id, pod_id=pod_id)

    web_socket.reg_winch_handler(handle_signal)

    profile_manager = ProfileManager()
    cli_config = profile_manager.load_current_profile()
    credential = Credential(cli_config.access_key, cli_config.secret_key)
    request = AttachRequest(service, WEBSOCKET_SCHEME, cli_config.endpoint, METHOD_GET, headers, region_id, container_id, pod_id=pod_id)
    request.invoke_shell(credential)

    h_o, w_o = web_socket.get_win_size()
    resize_tty(h_o, w_o, app, service, headers, region_id, container_id, pod_id=pod_id)
def exec_start(app, region_id, container_id, exec_id):
    def handle_signal(signum, frame):
        h, w = web_socket.get_win_size()
        resize_tty(h, w, app, region_id, container_id, exec_id)

    web_socket.reg_winch_handler(handle_signal)

    profile_manager = ProfileManager()
    cli_config = profile_manager.load_current_profile()
    credential = Credential(cli_config.access_key, cli_config.secret_key)
    request = ExecStartRequest(WEBSOCKET_SCHEME, cli_config.endpoint,
                               METHOD_GET, region_id, container_id, exec_id)
    request.invoke_shell(credential)

    h_o, w_o = web_socket.get_win_size()
    resize_tty(h_o, w_o, app, region_id, container_id, exec_id)
Beispiel #5
0
    def get(self, app):
        client_map = {
            'rds': RdsClient,
            'kubernetes': KubernetesClient,
            'vqd': VqdClient,
            'streamcomputer': StreamcomputerClient,
            'ipanti': IpantiClient,
            'ssl': SslClient,
            'domainservice': DomainserviceClient,
            'jmr': JmrClient,
            'oss': OssClient,
            'redis': RedisClient,
            'billing': BillingClient,
            'deploy': DeployClient,
            'sop': SopClient,
            'function': FunctionClient,
            'portal': PortalClient,
            'jdccs': JdccsClient,
            'logs': LogsClient,
            'clouddnsservice': ClouddnsserviceClient,
            'cps': CpsClient,
            'cdn': CdnClient,
            'streambus': StreambusClient,
            'apigateway': ApigatewayClient,
            'httpdns': HttpdnsClient,
            'disk': DiskClient,
            'sts': StsClient,
            'nc': NcClient,
            'vm': VmClient,
            'nativecontainer': NativecontainerClient,
            'iotcore': IotcoreClient,
            'pod': PodClient,
            'ams': AmsClient,
            'jdro': JdroClient,
            'zfs': ZfsClient,
            'vod': VodClient,
            'yundingdatapush': YundingdatapushClient,
            'datastar': DatastarClient,
            'kms': KmsClient,
            'elite': EliteClient,
            'ossopenapi': OssopenapiClient,
            'iam': IamClient,
            'iothub': IothubClient,
            'sms': SmsClient,
            'jcq': JcqClient,
            'resourcetag': ResourcetagClient,
            'baseanti': BaseantiClient,
            'ias': IasClient,
            'mongodb': MongodbClient,
            'jdfusion': JdfusionClient,
            'live': LiveClient,
            'detection': DetectionClient,
            'iotlink': IotlinkClient,
            'renewal': RenewalClient,
            'yunding': YundingClient,
            'vpc': VpcClient,
            'monitor': MonitorClient,
            'xdata': XdataClient,
            'containerregistry': ContainerregistryClient,
            'partner': PartnerClient,
            'lb': LbClient,
            'industrydata': IndustrydataClient,
        }

        profile_manager = ProfileManager()
        cli_config = profile_manager.load_current_profile()
        if cli_config is None:
            return None

        logger = get_logger(app.pargs.debug)

        config = Config(cli_config.endpoint, cli_config.scheme,
                        int(cli_config.timeout))
        credential = Credential(cli_config.access_key, cli_config.secret_key)
        if self.__service not in client_map:
            return None

        client = client_map[self.__service](credential, config, logger)
        return client
Beispiel #6
0
def _append_region_id(param_dict):
    if REGION_ID in param_dict and param_dict[REGION_ID] is None:
        pm = ProfileManager()
        param_dict.update({REGION_ID: str(pm.load_current_profile().region_id)})