-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
140 lines (130 loc) · 4.83 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
from ulauncher.api.shared.action.RenderResultListAction import RenderResultListAction
from ulauncher.api.shared.action.OpenUrlAction import OpenUrlAction
class GCPLauncherExtension(Extension):
def __init__(self):
super(GCPLauncherExtension, self).__init__()
self.subscribe(KeywordQueryEvent, KeywordQueryEventListener())
class KeywordQueryEventListener(EventListener):
def on_event(self, event, extension):
actions = list()
query = event.get_argument() or ""
array = [
[
"Dashboard",
OpenUrlAction("https://console.cloud.google.com/home/dashboard"),
"images/gcp_logo.png"
],
[
"Compute Engine",
OpenUrlAction("https://console.cloud.google.com/compute"),
"images/compute_icon.png"
],
[
"Kubernetes Engine",
OpenUrlAction("https://console.cloud.google.com/kubernetes"),
"images/kube_icon.png"
],
[
"Cloud SQL",
OpenUrlAction("https://console.cloud.google.com/sql"),
"images/sql_icon.png"
],
[
"App Engine",
OpenUrlAction("https://console.cloud.google.com/appengine"),
"images/app_engine_icon.png"
],
[
"Cloud Functions",
OpenUrlAction("https://console.cloud.google.com/functions"),
"images/cloud_functions_icon.png"
],
[
"Datastore",
OpenUrlAction("https://console.cloud.google.com/datastore"),
"images/datastore.png"
],
[
"BigQuery",
OpenUrlAction("https://console.cloud.google.com/bigquery"),
"images/big_query.png"
],
[
"Storage",
OpenUrlAction("https://console.cloud.google.com/storage"),
"images/storage_icon.png"
],
[
"VPC Network",
OpenUrlAction("https://console.cloud.google.com/networking"),
"images/vpc_network_icon.png"
],
[
"Network Services",
OpenUrlAction("https://console.cloud.google.com/net-services"),
"images/network_services_icon.png"
],
[
"Cloud Build",
OpenUrlAction("https://console.cloud.google.com/cloud-build"),
"images/build_icon.png"
],
[
"Container Registry",
OpenUrlAction("https://console.cloud.google.com/gcr"),
"images/container_registry_icon.png"
],
[
"Security",
OpenUrlAction("https://console.cloud.google.com/security"),
"images/security_icon.png"
],
[
"IAM Admin",
OpenUrlAction("https://console.cloud.google.com/iam-admin"),
"images/iam_admin_icon.png"
],
[
"Filestore",
OpenUrlAction("https://console.cloud.google.com/filestore"),
"images/filestore_icon.png"
],
[
"Stackdriver Logging",
OpenUrlAction("https://console.cloud.google.com/logs"),
"images/logging_icon.png"
],
[
"Stackdriver Monitoring",
OpenUrlAction("https://console.cloud.google.com/monitoring"),
"images/monitoring_icon.png"
],
[
"Billing",
OpenUrlAction("https://console.cloud.google.com/billing"),
"images/billing_icon.png"
],
[
"Marketplace",
OpenUrlAction("https://console.cloud.google.com/marketplace"),
"images/marketplace_icon.png"
],
[
"Pricing Calculator",
OpenUrlAction("https://cloud.google.com/products/calculator"),
"images/pricing_calculator_icon.png"
]
]
if query != "":
array = [x for x in array if query.lower() in x[0].lower()]
for val in array:
actions.append(
ExtensionResultItem(name=val[0], on_enter=val[1], icon=val[2])
)
return RenderResultListAction(actions)
if __name__ == '__main__':
GCPLauncherExtension().run()