forked from NixOS/nixops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-storage.nix
151 lines (128 loc) · 3.97 KB
/
azure-storage.nix
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
143
144
145
146
147
148
149
150
151
{ config, lib, pkgs, uuid, name, resources, ... }:
with lib;
with (import ./lib.nix lib);
let
retention_policy_options = { enable ? false }: {
enable = mkOption {
default = enable;
example = true;
type = types.bool;
description = "Whether a retention policy is enabled for the service.";
};
days = mkOption {
default = 7;
example = 3;
type = types.int;
description = ''
Indicates the number of days that metrics or logging data is retained.
All data older than this value will be deleted.
'';
};
};
metrics_options = { enable ? false }: {
enable = mkOption {
default = enable;
example = true;
type = types.bool;
description = "Whether metrics are enabled for the service.";
};
includeAPIs = mkOption {
default = enable;
example = true;
type = types.bool;
description = ''
Whether metrics should generate summary statistics
for called API operations.
'';
};
retentionPolicy = retention_policy_options { inherit enable; };
};
logging_options = {
delete = mkOption {
default = false;
example = true;
type = types.bool;
description = "Whether delete requests should be logged.";
};
read = mkOption {
default = false;
example = true;
type = types.bool;
description = "Whether read requests should be logged.";
};
write = mkOption {
default = false;
example = true;
type = types.bool;
description = "Whether write requests should be logged.";
};
retentionPolicy = retention_policy_options {};
};
service_options = {
logging = logging_options;
hourMetrics = metrics_options { enable = true; };
minuteMetrics = metrics_options {};
};
in
{
options = (import ./azure-mgmt-credentials.nix lib "storage") // {
name = mkOption {
example = "my-storage";
type = types.str;
description = ''
Name of the Azure storage account.
Must be globally-unique, between 3 and 24 characters in length,
and must consist of numbers and lower-case letters only.
'';
};
resourceGroup = mkOption {
example = "xxx-my-group";
type = types.either types.str (resource "azure-resource-group");
description = "The name or resource of an Azure resource group to create the storage in.";
};
location = mkOption {
example = "westus";
type = types.str;
description = "The Azure data center location where the storage should be created.";
};
customDomain = mkOption {
default = "";
example = "mydomain.org";
type = types.str;
description = "User domain assigned to the storage account. Name is the CNAME source.";
};
accountType = mkOption {
default = "Standard_LRS";
type = types.str;
description = ''
Specifies whether the account supports locally-redundant storage,
geo-redundant storage, zone-redundant storage, or read access
geo-redundant storage.
Possible values are: Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS, Premium_LRS
'';
};
activeKey = mkOption {
default = "primary";
type = types.str;
description = ''
Specifies which of the access keys should be used by containers, tables and queues.
The keys provide the same access, but can be independently regenerated which allows
seamless key replacement.
Possible values are: primary, secondary.
'';
};
tags = mkOption {
default = {};
example = { environment = "production"; };
type = types.attrsOf types.str;
description = "Tag name/value pairs to associate with the storage.";
};
blobService = service_options;
queueService = service_options;
tableService = service_options;
};
config = {
_type = "azure-storage";
resourceGroup = mkDefault resources.azureResourceGroups.def-group;
};
}