{ "cells": [ { "cell_type": "code", "execution_count": 4, "outputs": [ { "data": { "text/plain": "{'results': [{'uuid': '9e232e46-89ca-4a08-9186-7a6a7cd45c52',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'sonoda',\n 'createdDate': 1657529771410,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'https',\n 'options': [{'name': 'agile_backup',\n 'parameters': [],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'centtest.s.llnwi.net',\n 'sourceHostname': 'centtest.mt.lldns.net',\n 'publishedUrlPath': '/v1/',\n 'sourceUrlPath': '/centtest/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': '8a0aae8f-d658-46d7-93af-29fe656e293c',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'max2022',\n 'createdDate': 1677226134907,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl',\n 'parameters': [],\n 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.22'],\n 'source': 'direct'}]},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl',\n 'parameters': [],\n 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.22'],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'test01.advancecloud.net',\n 'sourceHostname': 'test01.advancecloud.net',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': 'e4ff684c-c5f5-4caa-aa74-71eaebd93b5d',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'max2022',\n 'createdDate': 1678871315598,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'https',\n 'options': [{'name': 'req_send_header',\n 'parameters': ['abc', '123'],\n 'source': 'direct'},\n {'name': 'req_send_header',\n 'parameters': ['def', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['123', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['test', 'abc'],\n 'source': 'direct'},\n {'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['www.baidu.com'],\n 'source': 'direct'}]},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'req_send_header',\n 'parameters': ['abc', '123'],\n 'source': 'direct'},\n {'name': 'req_send_header',\n 'parameters': ['def', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['123', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['test', 'abc'],\n 'source': 'direct'},\n {'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['www.baidu.com'],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'test03.advancecloud.net',\n 'sourceHostname': 'test03.advancecloud.net',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': 'aa120007-ac20-45f9-9722-b945024cbb5f',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'max2022',\n 'createdDate': 1678871492617,\n 'versionNumber': 2},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl',\n 'parameters': [],\n 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.11'],\n 'source': 'direct'}]},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl',\n 'parameters': [],\n 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.11'],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'test02.advancecloud.net',\n 'sourceHostname': 'test02.advancecloud.net',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': 'b6cf164a-1022-4d37-b752-bdece0d7f0a5',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'chl',\n 'createdDate': 1678946758170,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery',\n 'allowManualDuplicate': True},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl',\n 'parameters': [],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'description': 'string',\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': '316.shiqi.tsdb.work',\n 'sourceHostname': '54.255.244.22',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}}],\n 'size': 'all',\n 'offset': 0,\n 'page': 1,\n 'total': 5,\n 'sort': '_id',\n 'sort.dir': 'ascending'}" }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res = cl.list_delivery_service_instances(short_name)\n", "t = res.json()\n", "t" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 5, "outputs": [ { "data": { "text/plain": "dict" }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(t)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 6, "outputs": [ { "data": { "text/plain": "[{'uuid': '9e232e46-89ca-4a08-9186-7a6a7cd45c52',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'sonoda',\n 'createdDate': 1657529771410,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'https',\n 'options': [{'name': 'agile_backup',\n 'parameters': [],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'centtest.s.llnwi.net',\n 'sourceHostname': 'centtest.mt.lldns.net',\n 'publishedUrlPath': '/v1/',\n 'sourceUrlPath': '/centtest/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': '8a0aae8f-d658-46d7-93af-29fe656e293c',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'max2022',\n 'createdDate': 1677226134907,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.22'],\n 'source': 'direct'}]},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.22'],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'test01.advancecloud.net',\n 'sourceHostname': 'test01.advancecloud.net',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': 'e4ff684c-c5f5-4caa-aa74-71eaebd93b5d',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'max2022',\n 'createdDate': 1678871315598,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'https',\n 'options': [{'name': 'req_send_header',\n 'parameters': ['abc', '123'],\n 'source': 'direct'},\n {'name': 'req_send_header',\n 'parameters': ['def', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['123', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['test', 'abc'],\n 'source': 'direct'},\n {'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['www.baidu.com'],\n 'source': 'direct'}]},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'req_send_header',\n 'parameters': ['abc', '123'],\n 'source': 'direct'},\n {'name': 'req_send_header',\n 'parameters': ['def', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['123', '456'],\n 'source': 'direct'},\n {'name': 'reply_send_header',\n 'parameters': ['test', 'abc'],\n 'source': 'direct'},\n {'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['www.baidu.com'],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'test03.advancecloud.net',\n 'sourceHostname': 'test03.advancecloud.net',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': 'aa120007-ac20-45f9-9722-b945024cbb5f',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'max2022',\n 'createdDate': 1678871492617,\n 'versionNumber': 2},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.11'],\n 'source': 'direct'}]},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl', 'parameters': [], 'source': 'direct'},\n {'name': 'force_tcphost',\n 'parameters': ['54.255.244.11'],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'test02.advancecloud.net',\n 'sourceHostname': 'test02.advancecloud.net',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}},\n {'uuid': 'b6cf164a-1022-4d37-b752-bdece0d7f0a5',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'chl',\n 'createdDate': 1678946758170,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery',\n 'allowManualDuplicate': True},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'options': [{'name': 'fivemin_ttl',\n 'parameters': [],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'description': 'string',\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': '316.shiqi.tsdb.work',\n 'sourceHostname': '54.255.244.22',\n 'publishedUrlPath': '/',\n 'sourceUrlPath': '/',\n 'serviceKey': {'name': 'delivery'}}}]" }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['results']\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 7, "outputs": [], "source": [ "res = cl.list_delivery_service_profiles(short_name)\n", "\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 8, "outputs": [ { "data": { "text/plain": "{'results': [{'uuid': '44041a55-32a0-452e-a52b-258704a47009',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'cdoehler',\n 'createdDate': 1553296719959,\n 'versionNumber': 2,\n 'notes': 'LLNW Generic serviceProfile - slashes in source and published path removed - MWS-2721'},\n 'meta': {'manifestVersion': '6', 'serviceIdentifier': 'deliverysvcprof'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [],\n 'body': {'protocolSets': [{'publishedProtocol': 'http',\n 'sourceProtocol': 'http',\n 'allowedOptions': [],\n 'defaultOptions': [],\n 'requiredOptions': []},\n {'publishedProtocol': 'https',\n 'sourceProtocol': 'http',\n 'allowedOptions': [],\n 'defaultOptions': [],\n 'requiredOptions': []},\n {'publishedProtocol': 'http',\n 'sourceProtocol': 'https',\n 'allowedOptions': [],\n 'defaultOptions': [],\n 'requiredOptions': []},\n {'publishedProtocol': 'https',\n 'sourceProtocol': 'https',\n 'allowedOptions': [],\n 'defaultOptions': [],\n 'requiredOptions': []}],\n 'serviceProfileName': 'LLNW-Generic',\n 'useCase': 'Generic',\n 'description': 'General purpose profile allowing all user-accessible options for which the caller/shortname is entitled',\n 'serviceKey': {'name': 'delivery'},\n 'publishedUrlPath': '',\n 'sourceUrlPath': ''}}],\n 'size': 'all',\n 'offset': 0,\n 'page': 1,\n 'total': 1,\n 'sort': '_id',\n 'sort.dir': 'ascending',\n '$prev': '',\n '$next': ''}" }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rj = res.json()\n", "rj\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 9, "outputs": [], "source": [ "res = cl.get_delivery_service_instance('9e232e46-89ca-4a08-9186-7a6a7cd45c52').json()" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 10, "outputs": [ { "data": { "text/plain": "{'uuid': '9e232e46-89ca-4a08-9186-7a6a7cd45c52',\n 'isLatest': True,\n 'isEnabled': True,\n 'revision': {'createdBy': 'sonoda',\n 'createdDate': 1657529771410,\n 'versionNumber': 1},\n 'meta': {'manifestVersion': '57',\n 'serviceIdentifier': 'deliverysvcinst',\n 'serviceKey': 'delivery'},\n 'status': {'state': 'COMPLETED'},\n 'accounts': [{'shortname': 'centtest'}],\n 'shortname': 'centtest',\n 'body': {'protocolSets': [{'publishedProtocol': 'https',\n 'sourceProtocol': 'https',\n 'options': [{'name': 'agile_backup',\n 'parameters': [],\n 'source': 'direct'}]}],\n 'serviceProfileVersion': 2,\n 'serviceProfileName': 'LLNW-Generic',\n 'publishedHostname': 'centtest.s.llnwi.net',\n 'sourceHostname': 'centtest.mt.lldns.net',\n 'publishedUrlPath': '/v1/',\n 'sourceUrlPath': '/centtest/',\n 'serviceKey': {'name': 'delivery'}}}" }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 11, "outputs": [ { "data": { "text/plain": "{'success': False,\n 'errorType': 'validation',\n 'errors': {'body': [{'code': 'validatorInternal.deliverysvcinst.error.deliverySvcInstanceConflict',\n 'message': 'DeliverySvcInstance already exists with uuid [b6cf164a-1022-4d37-b752-bdece0d7f0a5]',\n 'args': ['b6cf164a-1022-4d37-b752-bdece0d7f0a5'],\n 'type': 'validator'}]}}" }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "delivery_config = {\n", " \"accounts\": [\n", " {\n", " \"shortname\": short_name\n", " }\n", " ],\n", " \"body\": {\n", " \"description\": \"string\",\n", " \"protocolSets\": [\n", " {\n", " \"options\": [\n", " {\n", " \"name\": \"fivemin_ttl\",\n", " \"parameters\": []\n", " }\n", " ],\n", " \"publishedProtocol\": \"http\",\n", " \"sourceProtocol\": \"http\"\n", " }\n", " ],\n", " \"publishedHostname\": \"316.shiqi.tsdb.work\",\n", " \"publishedUrlPath\": \"/\",\n", " \"serviceKey\": {\n", " \"name\": \"delivery\"\n", " },\n", " \"serviceProfileName\": \"LLNW-Generic\",\n", " \"serviceProfileVersion\": 2,\n", " \"sourceHostname\": \"54.255.244.22\",\n", " \"sourceUrlPath\": \"/\"\n", " },\n", " \"meta\": {\n", " \"allowManualDuplicate\": True\n", " }\n", "}\n", "cl.validate_delivery_service_instance(delivery_config=delivery_config).json()\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 12, "outputs": [ { "data": { "text/plain": "{'success': False,\n 'errorType': 'validation',\n 'errors': {'body': [{'code': 'validatorInternal.deliverysvcinst.error.deliverySvcInstanceConflict',\n 'message': 'DeliverySvcInstance already exists with uuid [b6cf164a-1022-4d37-b752-bdece0d7f0a5]',\n 'args': ['b6cf164a-1022-4d37-b752-bdece0d7f0a5'],\n 'type': 'validator'}]}}" }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cl.create_delivery_service_instance(delivery_config=delivery_config).json()\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 13, "outputs": [], "source": [ "import grpc\n", "import llnw_pb2_grpc\n", "from llnw_pb2 import *\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 14, "outputs": [], "source": [ "username = \"chl20000826@163.com\"\n", "shared_key = \"0f4912881c27a33dcfcf2ab6e2dc286c065a559000926bc9d1fc25d4228bb5cd\"\n", "short_name = \"centtest\"\n", "base=Base(username=username, key=shared_key)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 15, "outputs": [], "source": [ "channel = grpc.insecure_channel('localhost:50052')\n", "stub = llnw_pb2_grpc.DeliveryServiceStub(channel)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 16, "outputs": [ { "data": { "text/plain": "deliveries {\n uuid: \"9e232e46-89ca-4a08-9186-7a6a7cd45c52\"\n isEnabled: true\n shortname: \"centtest\"\n status: \"COMPLETED\"\n sourceHostname: \"centtest.mt.lldns.net\"\n publishedHostname: \"centtest.s.llnwi.net\"\n sourceUrlPath: \"/centtest/\"\n publishedUrlPath: \"/v1/\"\n protocolSets {\n sourceProtocol: \"https\"\n publishedProtocol: \"https\"\n options {\n name: \"agile_backup\"\n source: \"direct\"\n }\n }\n}\ndeliveries {\n uuid: \"8a0aae8f-d658-46d7-93af-29fe656e293c\"\n isEnabled: true\n shortname: \"centtest\"\n status: \"COMPLETED\"\n sourceHostname: \"test01.advancecloud.net\"\n publishedHostname: \"test01.advancecloud.net\"\n sourceUrlPath: \"/\"\n publishedUrlPath: \"/\"\n protocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"https\"\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n options {\n name: \"force_tcphost\"\n parameters: \"54.255.244.22\"\n source: \"direct\"\n }\n }\n protocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"http\"\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n options {\n name: \"force_tcphost\"\n parameters: \"54.255.244.22\"\n source: \"direct\"\n }\n }\n}\ndeliveries {\n uuid: \"e4ff684c-c5f5-4caa-aa74-71eaebd93b5d\"\n isEnabled: true\n shortname: \"centtest\"\n status: \"COMPLETED\"\n sourceHostname: \"test03.advancecloud.net\"\n publishedHostname: \"test03.advancecloud.net\"\n sourceUrlPath: \"/\"\n publishedUrlPath: \"/\"\n protocolSets {\n sourceProtocol: \"https\"\n publishedProtocol: \"https\"\n options {\n name: \"req_send_header\"\n parameters: \"abc\"\n parameters: \"123\"\n source: \"direct\"\n }\n options {\n name: \"req_send_header\"\n parameters: \"def\"\n parameters: \"456\"\n source: \"direct\"\n }\n options {\n name: \"reply_send_header\"\n parameters: \"123\"\n parameters: \"456\"\n source: \"direct\"\n }\n options {\n name: \"reply_send_header\"\n parameters: \"test\"\n parameters: \"abc\"\n source: \"direct\"\n }\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n options {\n name: \"force_tcphost\"\n parameters: \"www.baidu.com\"\n source: \"direct\"\n }\n }\n protocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"http\"\n options {\n name: \"req_send_header\"\n parameters: \"abc\"\n parameters: \"123\"\n source: \"direct\"\n }\n options {\n name: \"req_send_header\"\n parameters: \"def\"\n parameters: \"456\"\n source: \"direct\"\n }\n options {\n name: \"reply_send_header\"\n parameters: \"123\"\n parameters: \"456\"\n source: \"direct\"\n }\n options {\n name: \"reply_send_header\"\n parameters: \"test\"\n parameters: \"abc\"\n source: \"direct\"\n }\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n options {\n name: \"force_tcphost\"\n parameters: \"www.baidu.com\"\n source: \"direct\"\n }\n }\n}\ndeliveries {\n uuid: \"aa120007-ac20-45f9-9722-b945024cbb5f\"\n isEnabled: true\n shortname: \"centtest\"\n status: \"COMPLETED\"\n sourceHostname: \"test02.advancecloud.net\"\n publishedHostname: \"test02.advancecloud.net\"\n sourceUrlPath: \"/\"\n publishedUrlPath: \"/\"\n protocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"https\"\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n options {\n name: \"force_tcphost\"\n parameters: \"54.255.244.11\"\n source: \"direct\"\n }\n }\n protocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"http\"\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n options {\n name: \"force_tcphost\"\n parameters: \"54.255.244.11\"\n source: \"direct\"\n }\n }\n}\ndeliveries {\n uuid: \"b6cf164a-1022-4d37-b752-bdece0d7f0a5\"\n isEnabled: true\n shortname: \"centtest\"\n status: \"COMPLETED\"\n sourceHostname: \"54.255.244.22\"\n publishedHostname: \"316.shiqi.tsdb.work\"\n sourceUrlPath: \"/\"\n publishedUrlPath: \"/\"\n protocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"http\"\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n }\n}" }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "e = stub.ListDelivery(ShortNameRequest(base=base, shortName=short_name))\n", "e" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 17, "outputs": [ { "data": { "text/plain": "uuid: \"b6cf164a-1022-4d37-b752-bdece0d7f0a5\"\nisEnabled: true\nshortname: \"centtest\"\nstatus: \"COMPLETED\"\nsourceHostname: \"54.255.244.22\"\npublishedHostname: \"316.shiqi.tsdb.work\"\nsourceUrlPath: \"/\"\npublishedUrlPath: \"/\"\nprotocolSets {\n sourceProtocol: \"http\"\n publishedProtocol: \"http\"\n options {\n name: \"fivemin_ttl\"\n source: \"direct\"\n }\n}" }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "e = stub.GetDelivery(IdRequest(base=base,id=\"b6cf164a-1022-4d37-b752-bdece0d7f0a5\"))\n", "e" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 21, "outputs": [ { "ename": "KeyError", "evalue": "'uuid'", "output_type": "error", "traceback": [ "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", "\u001B[1;31mKeyError\u001B[0m Traceback (most recent call last)", "Cell \u001B[1;32mIn[21], line 2\u001B[0m\n\u001B[0;32m 1\u001B[0m delivery_config\n\u001B[1;32m----> 2\u001B[0m \u001B[43mdelivery_config\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43muuid\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m]\u001B[49m\u001B[38;5;241m|\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m\n", "\u001B[1;31mKeyError\u001B[0m: 'uuid'" ] } ], "source": [ "delivery_config\n", "delivery_config['uuid']|None\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 24, "outputs": [], "source": [ "import pydash\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 31, "outputs": [], "source": [ "pydash.objects.get(delivery_config,\"accounts[0].shortname.a\")\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 26, "outputs": [ { "data": { "text/plain": "{'accounts': [{'shortname': 'centtest'}],\n 'body': {'description': 'string',\n 'protocolSets': [{'options': [{'name': 'fivemin_ttl', 'parameters': []}],\n 'publishedProtocol': 'http',\n 'sourceProtocol': 'http'}],\n 'publishedHostname': '316.shiqi.tsdb.work',\n 'publishedUrlPath': '/',\n 'serviceKey': {'name': 'delivery'},\n 'serviceProfileName': 'LLNW-Generic',\n 'serviceProfileVersion': 2,\n 'sourceHostname': '54.255.244.22',\n 'sourceUrlPath': '/'},\n 'meta': {'allowManualDuplicate': True}}" }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "delivery_config\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 37, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "from ll_sdk.config_api import ConfigApiClient\n", "username = \"chl20000826@163.com\"\n", "shared_key = \"0f4912881c27a33dcfcf2ab6e2dc286c065a559000926bc9d1fc25d4228bb5cd\"\n", "short_name = \"centtest\"\n", "cl = ConfigApiClient('apis.llnw.com', username, shared_key)\n", "\n", "storage = {\n", " \"accessKey\": \"AKIASB76IRYZX5KCSXMB\",\n", " \"bucketName\": \"cengcloud-dev\",\n", " \"location\": \"amazon_s3\",\n", " \"path\": \"223-0303.chl.tsdb.work/edgio/\",\n", " \"region\": \"ap-southeast-1\",\n", " \"secretKey\": \"PXgElj+slvVII8H0DKoMtM2rvmr34mxegP+HHRsb\"\n", "}\n", "\n", "config = {\n", " \"compressionType\": \"lz4\",\n", " \"isActive\": \"true\",\n", " \"logFields\": [\"sc-request-id\",\"s-host\",\"datetime\",\"c-country-code\",\"sc-status\",\"c-ip\",\"cs-uri\",\"sc-bytes\"],\n", " \"name\": \"test032101\",\n", " \"serviceType\": \"http\",\n", " \"storage\": storage\n", "}\n", "\n", "uuid = \"1af891bf-cf7e-4294-ad66-f63721d33db9\"\n", "\n", "# print(cl.create_lds(shortname=short_name, config={\"body\": config}).json())\n", "# print(cl.list_lds(shortname=short_name).json())\n", "print(cl.delete_lds(shortname=short_name, uuid=uuid))" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 3, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'uuid': 'f2857b25-885d-4a5f-9d15-6c21e5069235', 'isLatest': True, 'isEnabled': True, 'revision': {'createdBy': 'chl', 'createdDate': 1680015611739, 'versionNumber': 1}, 'meta': {'manifestVersion': '9', 'serviceIdentifier': 'sslcert'}, 'status': {'state': 'PENDING'}, 'accounts': [{'shortname': 'centtest'}], 'shortname': 'centtest', 'body': {'certName': 'certTest032702', 'intermediateCerts': [{'intermediateCert': 'http://crt.trust-provider.cn/TrustAsiaRSADVTLSCAG2.crt', 'issuedBy': 'C=GB,ST=Greater Manchester,L=Salford,O=Comodo CA Limited,CN=AAA Certificate Services', 'issuedTo': 'C=CN,O=TrustAsia Technologies\\\\, Inc.,CN=TrustAsia RSA DV TLS CA G2'}], 'certType': 'singleserver', 'fingerprints': ['cert0117.com.cdn.sensordb.site'], 'uploadDate': 1680015610466, 'effectiveDate': 1673913600000, 'expirationDate': 1705535999000, 'nonPublishable': False, 'certStatus': 'New', 'vipMappings': [{'architecture': 'gen', 'vipType': 'sni', 'vips': []}], 'contentType': 'default'}}\n" ] } ], "source": [ "from ll_sdk.config_api import ConfigApiClient\n", "username = \"chl20000826@163.com\"\n", "shared_key = \"0f4912881c27a33dcfcf2ab6e2dc286c065a559000926bc9d1fc25d4228bb5cd\"\n", "short_name = \"centtest\"\n", "cl = ConfigApiClient('apis.llnw.com', username, shared_key)\n", "\n", "config = {\n", " \"accounts\": [\n", " {\n", " \"shortname\": short_name\n", " }\n", " ],\n", " \"body\":{\n", " \"cert\": \"-----BEGIN CERTIFICATE-----\\nMIIGhTCCBO2gAwIBAgIRAKuX7LEJMl0mNnMAzuTaDN4wDQYJKoZIhvcNAQEMBQAw\\nWTELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs\\nIEluYy4xIzAhBgNVBAMTGlRydXN0QXNpYSBSU0EgRFYgVExTIENBIEcyMB4XDTIz\\nMDExNzAwMDAwMFoXDTI0MDExNzIzNTk1OVowKTEnMCUGA1UEAxMeY2VydDAxMTcu\\nY29tLmNkbi5zZW5zb3JkYi5zaXRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\\nCgKCAQEAyGFlHLgS34usG761LeRj5evUB/uBTCQm8kPb3xa2ltI1dA1Q8tvYMnrL\\nCXDOb6HBRO642OIvjwkTwxuMdoP3fc5ETT9auNFd/krlmjb/hDUrsvylvSra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Gy6XBgql4QtkkhhPFemMb7j4bTB6bgJ4lqImARA2Glkowysh\\r\\nNA/0L4HZBa++gIZkFW0ZGtwtXBJu07tgFFIbSWQ0RxObip3qitIFyGPJ30kXhyeY\\r\\ncBmioKaBYHW2xZWcuVQNjmlG1wVxWqYOrX7DLEa5wqgwrjWTlZ4=\\r\\n-----END RSA PRIVATE KEY-----\",\n", " \"certName\": \"certTest032702\",\n", " \"contentType\": \"default\"\n", " }\n", "}\n", "print(cl.create_customer_certificate(cert_config=config).json())" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 6, "outputs": [ { "ename": "ImportError", "evalue": "cannot import name 'tzset' from 'time' (unknown location)", "output_type": "error", "traceback": [ "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", "\u001B[1;31mImportError\u001B[0m Traceback (most recent call last)", "Cell \u001B[1;32mIn[6], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mll_sdk\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mreporting_api\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m ReportingClient\n\u001B[0;32m 2\u001B[0m username \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mmia@cengcloud.cn\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m 3\u001B[0m shared_key \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m87a50e95c691320611cbaf9c57666beaf308f86f3234e16e0925c4258f4b8edc\u001B[39m\u001B[38;5;124m\"\u001B[39m\n", "File \u001B[1;32mD:\\Work\\CDN\\new\\cdn-python\\src\\ll_sdk\\reporting_api.py:7\u001B[0m\n\u001B[0;32m 5\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mitertools\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m chain\n\u001B[0;32m 6\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mll_sdk\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mbase_client\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m BaseRestReportingClient\n\u001B[1;32m----> 7\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mll_sdk\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mreporting_api_helper\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mtime_utils\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _timespan \u001B[38;5;28;01mas\u001B[39;00m timespan\n\u001B[0;32m 9\u001B[0m __all__ \u001B[38;5;241m=\u001B[39m [\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mReportingClient\u001B[39m\u001B[38;5;124m'\u001B[39m]\n\u001B[0;32m 10\u001B[0m __docformat__ \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m'\u001B[39m\u001B[38;5;124mrestructuredtext\u001B[39m\u001B[38;5;124m'\u001B[39m\n", "File \u001B[1;32mD:\\Work\\CDN\\new\\cdn-python\\src\\ll_sdk\\utils\\reporting_api_helper\\time_utils.py:4\u001B[0m\n\u001B[0;32m 1\u001B[0m \u001B[38;5;66;03m#!/usr/bin/env python\u001B[39;00m\n\u001B[0;32m 2\u001B[0m \u001B[38;5;66;03m# -*- coding: utf-8 -*-\u001B[39;00m\n\u001B[1;32m----> 4\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtime\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m tzset\n\u001B[0;32m 5\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01mos\u001B[39;00m\n\u001B[0;32m 6\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mdatetime\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m datetime\n", "\u001B[1;31mImportError\u001B[0m: cannot import name 'tzset' from 'time' (unknown location)" ] } ], "source": [ "from ll_sdk.reporting_api import ReportingClient\n", "username = \"mia@cengcloud.cn\"\n", "shared_key = \"87a50e95c691320611cbaf9c57666beaf308f86f3234e16e0925c4258f4b8edc\"\n", "rc = ReportingClient('apis.llnw.com', username, shared_key)\n", "\n", "shortname = [\"ccloud02\"]\n", "service = [\"HTTP\", \"HTTPS\"]\n", "granularity = \"HOUR\"\n", "requestedFields = [\"totalRequests\", \"datetime\"]\n", "startDate = \"1685548860000\"\n", "endDate = \"1685635260000\"\n", "sortField = [\"datetime\"]\n", "\n", "print(rc.traffic_geo(shortname,service,granularity,requestedFields,startDate,endDate,sortField))" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": null, "outputs": [], "source": [], "metadata": { "collapsed": false } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }