forked from Azure/logicapps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Azure-Blob-Auto-Tier.json
142 lines (141 loc) · 4.37 KB
/
Azure-Blob-Auto-Tier.json
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
141
142
{
"id": "/providers/Microsoft.Logic/galleries/public/templates/431e1640-9e1d-4e74-8c91-b948dc17c49f",
"type": "Microsoft.Logic/galleries/templates",
"name": "431e1640-9e1d-4e74-8c91-b948dc17c49f",
"properties": {
"author": {
"displayName": "Yuan Zheng"
},
"categoryNames": [
"schedule"
],
"description": "Once a month, scan a storage account and tier all blobs older than the defined value to Cool or Archive tier.",
"displayName": "Auto tier Azure blobs based on the last modified time.",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Condition": {
"actions": {
"Tier_blob": {
"description": "If blob is older than the defined value, tier it to Cool or Archive tier",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/SetBlobTierByPath",
"queries": {
"newTier": "",
"path": "@items('For_each')?['Path']"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"description": "Check LastModified timestamp and whether older than the tier age variable",
"expression": "@less(ticks(items('For_each')?['LastModified']), ticks(addDays(utcnow(), variables('TierAgeInDays'))))",
"runAfter": {},
"type": "If"
}
},
"description": "Scan all blobs in this folder",
"foreach": "@body('List_blobs')?['value']",
"runAfter": {
"List_blobs": [
"Succeeded"
]
},
"type": "Foreach"
},
"List_blobs": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/datasets/default/foldersV2/",
"queries": {
"useFlatListing": true
}
},
"runAfter": {
"Set_tier_age_variable_": [
"Succeeded"
]
},
"runtimeConfiguration": {
"paginationPolicy": {
"minimumItemCount": 5000
}
},
"type": "ApiConnection"
},
"Set_tier_age_variable_": {
"description": "A variable to configure the auto tier age in days. Configured in negative number. Default is -180 (180 days old).",
"inputs": {
"variables": [
{
"name": "TierAgeInDays",
"type": "Integer",
"value": -180
}
]
},
"runAfter": {},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Month",
"interval": 1
},
"type": "Recurrence"
}
}
},
"connectionReferences": {
"azureblob": {
"connection": {
"id": ""
},
"api": {
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureblob"
}
}
},
"apiSummaries": [
{
"type": "recurrence",
"displayName": "${Resources.RECURRENCE_TRIGGER_DISPLAYNAME}",
"iconUri": "${Images.RecurrenceIcon}",
"brandColor": "#1F85FF"
},
{
"type": "ApiConnection",
"displayName": "Azure Blob",
"iconUri": "https://logicappsresources.blob.core.windows.net/icons/azureblob.png",
"brandColor": "#804998"
}
],
"changedTime": "2017-12-19T00:00:54.000Z",
"createdTime": "2017-12-19T00:00:54.000Z",
"popularity": 10
}
}