-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
52 lines (42 loc) · 1.89 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
"""An Azure RM Python Pulumi program"""
import pulumi
import pulumi_azure_native as azure
config = pulumi.Config()
prefix = config.require("prefix")
resource_group = azure.resources.ResourceGroup("rg",
resource_group_name="{}-cloud-news-summarizer".format(prefix))
account = azure.storage.StorageAccount("table-sa",
resource_group_name=resource_group.name,
allow_blob_public_access=False,
sku=azure.storage.SkuArgs(
name=azure.storage.SkuName.STANDARD_ZRS,
),
kind=azure.storage.Kind.STORAGE_V2,
account_name="{}cloudnews".format(prefix))
checkpoint_table = azure.storage.Table("checkpoint-table",
account_name=account.name,
resource_group_name=resource_group.name,
table_name="rsscheckpoint")
timer_queue = azure.storage.Queue("timer-queue",
account_name=account.name,
resource_group_name=resource_group.name,
queue_name="timerqueue")
process_queue = azure.storage.Queue("process-queue",
account_name=account.name,
resource_group_name=resource_group.name,
queue_name="processqueue")
cognitive_account = azure.cognitiveservices.Account("cognitive-account",
account_name="{}-cloud-news-cognitive".format(prefix),
kind="TextAnalytics",
resource_group_name=resource_group.name,
sku=azure.cognitiveservices.SkuArgs(name="S"))
pulumi.export("rg-name", resource_group.name)
pulumi.export("sa-name", account.name)
pulumi.export("table-name", checkpoint_table.name)
pulumi.export("timer-queue-name", timer_queue.name)
pulumi.export("process-queue-name", process_queue.name)
pulumi.export("cognitive-name", cognitive_account.name)
cognitive_endpoint = pulumi.Output.all(resource_group.name, cognitive_account.name)\
.apply(lambda args: azure.cognitiveservices.get_account(resource_group_name=args[0], account_name=args[1]))\
.apply(lambda properties: properties.properties.endpoint)
pulumi.export("cognitive-endpoint", cognitive_endpoint)