@incident-io/pulumi 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +69 -0
- package/alertAttribute.d.ts +230 -0
- package/alertAttribute.d.ts.map +1 -0
- package/alertAttribute.js +219 -0
- package/alertAttribute.js.map +1 -0
- package/alertRoute.d.ts +511 -0
- package/alertRoute.d.ts.map +1 -0
- package/alertRoute.js +432 -0
- package/alertRoute.js.map +1 -0
- package/alertSource.d.ts +347 -0
- package/alertSource.d.ts.map +1 -0
- package/alertSource.js +241 -0
- package/alertSource.js.map +1 -0
- package/alertSourceAttribute.d.ts +180 -0
- package/alertSourceAttribute.d.ts.map +1 -0
- package/alertSourceAttribute.js +107 -0
- package/alertSourceAttribute.js.map +1 -0
- package/alertSourceAttributeBeta.d.ts +188 -0
- package/alertSourceAttributeBeta.d.ts.map +1 -0
- package/alertSourceAttributeBeta.js +115 -0
- package/alertSourceAttributeBeta.js.map +1 -0
- package/alertSourceBeta.d.ts +244 -0
- package/alertSourceBeta.d.ts.map +1 -0
- package/alertSourceBeta.js +138 -0
- package/alertSourceBeta.js.map +1 -0
- package/apiKey.d.ts +276 -0
- package/apiKey.d.ts.map +1 -0
- package/apiKey.js +211 -0
- package/apiKey.js.map +1 -0
- package/catalogEntries.d.ts +241 -0
- package/catalogEntries.d.ts.map +1 -0
- package/catalogEntries.js +242 -0
- package/catalogEntries.js.map +1 -0
- package/catalogEntry.d.ts +183 -0
- package/catalogEntry.d.ts.map +1 -0
- package/catalogEntry.js +159 -0
- package/catalogEntry.js.map +1 -0
- package/catalogType.d.ts +169 -0
- package/catalogType.d.ts.map +1 -0
- package/catalogType.js +132 -0
- package/catalogType.js.map +1 -0
- package/catalogTypeAttribute.d.ts +190 -0
- package/catalogTypeAttribute.d.ts.map +1 -0
- package/catalogTypeAttribute.js +153 -0
- package/catalogTypeAttribute.js.map +1 -0
- package/config/index.d.ts +2 -0
- package/config/index.d.ts.map +1 -0
- package/config/index.js +21 -0
- package/config/index.js.map +1 -0
- package/config/vars.d.ts +13 -0
- package/config/vars.d.ts.map +1 -0
- package/config/vars.js +49 -0
- package/config/vars.js.map +1 -0
- package/customField.d.ts +260 -0
- package/customField.d.ts.map +1 -0
- package/customField.js +226 -0
- package/customField.js.map +1 -0
- package/customFieldOption.d.ts +107 -0
- package/customFieldOption.d.ts.map +1 -0
- package/customFieldOption.js +116 -0
- package/customFieldOption.js.map +1 -0
- package/escalationPath.d.ts +257 -0
- package/escalationPath.d.ts.map +1 -0
- package/escalationPath.js +228 -0
- package/escalationPath.js.map +1 -0
- package/escalationPathBeta.d.ts +134 -0
- package/escalationPathBeta.d.ts.map +1 -0
- package/escalationPathBeta.js +105 -0
- package/escalationPathBeta.js.map +1 -0
- package/getAlertAttribute.d.ts +81 -0
- package/getAlertAttribute.d.ts.map +1 -0
- package/getAlertAttribute.js +75 -0
- package/getAlertAttribute.js.map +1 -0
- package/getAlertSource.d.ts +169 -0
- package/getAlertSource.d.ts.map +1 -0
- package/getAlertSource.js +103 -0
- package/getAlertSource.js.map +1 -0
- package/getAlertSourceAttribute.d.ts +131 -0
- package/getAlertSourceAttribute.d.ts.map +1 -0
- package/getAlertSourceAttribute.js +85 -0
- package/getAlertSourceAttribute.js.map +1 -0
- package/getAlertSourceAttributeBeta.d.ts +131 -0
- package/getAlertSourceAttributeBeta.d.ts.map +1 -0
- package/getAlertSourceAttributeBeta.js +85 -0
- package/getAlertSourceAttributeBeta.js.map +1 -0
- package/getApiKey.d.ts +167 -0
- package/getApiKey.d.ts.map +1 -0
- package/getApiKey.js +145 -0
- package/getApiKey.js.map +1 -0
- package/getCatalogEntry.d.ts +77 -0
- package/getCatalogEntry.d.ts.map +1 -0
- package/getCatalogEntry.js +59 -0
- package/getCatalogEntry.js.map +1 -0
- package/getCatalogType.d.ts +163 -0
- package/getCatalogType.d.ts.map +1 -0
- package/getCatalogType.js +135 -0
- package/getCatalogType.js.map +1 -0
- package/getCatalogTypeAttribute.d.ts +73 -0
- package/getCatalogTypeAttribute.d.ts.map +1 -0
- package/getCatalogTypeAttribute.js +53 -0
- package/getCatalogTypeAttribute.js.map +1 -0
- package/getCustomField.d.ts +67 -0
- package/getCustomField.d.ts.map +1 -0
- package/getCustomField.js +51 -0
- package/getCustomField.js.map +1 -0
- package/getCustomFieldOption.d.ts +65 -0
- package/getCustomFieldOption.d.ts.map +1 -0
- package/getCustomFieldOption.js +55 -0
- package/getCustomFieldOption.js.map +1 -0
- package/getEscalationPath.d.ts +100 -0
- package/getEscalationPath.d.ts.map +1 -0
- package/getEscalationPath.js +83 -0
- package/getEscalationPath.js.map +1 -0
- package/getEscalationPathBeta.d.ts +100 -0
- package/getEscalationPathBeta.d.ts.map +1 -0
- package/getEscalationPathBeta.js +83 -0
- package/getEscalationPathBeta.js.map +1 -0
- package/getIncidentRole.d.ts +111 -0
- package/getIncidentRole.d.ts.map +1 -0
- package/getIncidentRole.js +105 -0
- package/getIncidentRole.js.map +1 -0
- package/getIncidentTemplate.d.ts +98 -0
- package/getIncidentTemplate.d.ts.map +1 -0
- package/getIncidentTemplate.js +95 -0
- package/getIncidentTemplate.js.map +1 -0
- package/getIncidentTimestamp.d.ts +107 -0
- package/getIncidentTimestamp.d.ts.map +1 -0
- package/getIncidentTimestamp.js +109 -0
- package/getIncidentTimestamp.js.map +1 -0
- package/getIncidentType.d.ts +121 -0
- package/getIncidentType.d.ts.map +1 -0
- package/getIncidentType.js +107 -0
- package/getIncidentType.js.map +1 -0
- package/getIpAllowlist.d.ts +62 -0
- package/getIpAllowlist.d.ts.map +1 -0
- package/getIpAllowlist.js +77 -0
- package/getIpAllowlist.js.map +1 -0
- package/getPolicy.d.ts +97 -0
- package/getPolicy.d.ts.map +1 -0
- package/getPolicy.js +91 -0
- package/getPolicy.js.map +1 -0
- package/getRichText.d.ts +111 -0
- package/getRichText.d.ts.map +1 -0
- package/getRichText.js +107 -0
- package/getRichText.js.map +1 -0
- package/getSchedule.d.ts +89 -0
- package/getSchedule.d.ts.map +1 -0
- package/getSchedule.js +87 -0
- package/getSchedule.js.map +1 -0
- package/getScheduleBeta.d.ts +85 -0
- package/getScheduleBeta.d.ts.map +1 -0
- package/getScheduleBeta.js +83 -0
- package/getScheduleBeta.js.map +1 -0
- package/getScheduleReplica.d.ts +116 -0
- package/getScheduleReplica.d.ts.map +1 -0
- package/getScheduleReplica.js +79 -0
- package/getScheduleReplica.js.map +1 -0
- package/getScheduleRotation.d.ts +166 -0
- package/getScheduleRotation.d.ts.map +1 -0
- package/getScheduleRotation.js +127 -0
- package/getScheduleRotation.js.map +1 -0
- package/getScheduleRotationBeta.d.ts +122 -0
- package/getScheduleRotationBeta.d.ts.map +1 -0
- package/getScheduleRotationBeta.js +83 -0
- package/getScheduleRotationBeta.js.map +1 -0
- package/getScheduleSyncRule.d.ts +91 -0
- package/getScheduleSyncRule.d.ts.map +1 -0
- package/getScheduleSyncRule.js +79 -0
- package/getScheduleSyncRule.js.map +1 -0
- package/getScheduleSyncTarget.d.ts +100 -0
- package/getScheduleSyncTarget.d.ts.map +1 -0
- package/getScheduleSyncTarget.js +93 -0
- package/getScheduleSyncTarget.js.map +1 -0
- package/getSecret.d.ts +115 -0
- package/getSecret.d.ts.map +1 -0
- package/getSecret.js +97 -0
- package/getSecret.js.map +1 -0
- package/getSeverity.d.ts +117 -0
- package/getSeverity.d.ts.map +1 -0
- package/getSeverity.js +115 -0
- package/getSeverity.js.map +1 -0
- package/getStatus.d.ts +125 -0
- package/getStatus.d.ts.map +1 -0
- package/getStatus.js +119 -0
- package/getStatus.js.map +1 -0
- package/getUser.d.ts +52 -0
- package/getUser.d.ts.map +1 -0
- package/getUser.js +61 -0
- package/getUser.js.map +1 -0
- package/getWorkflow.d.ts +103 -0
- package/getWorkflow.d.ts.map +1 -0
- package/getWorkflow.js +77 -0
- package/getWorkflow.js.map +1 -0
- package/incidentRole.d.ts +109 -0
- package/incidentRole.d.ts.map +1 -0
- package/incidentRole.js +111 -0
- package/incidentRole.js.map +1 -0
- package/incidentTemplate.d.ts +200 -0
- package/incidentTemplate.d.ts.map +1 -0
- package/incidentTemplate.js +207 -0
- package/incidentTemplate.js.map +1 -0
- package/index.d.ts +188 -0
- package/index.d.ts.map +1 -0
- package/index.js +303 -0
- package/index.js.map +1 -0
- package/maintenanceWindow.d.ts +255 -0
- package/maintenanceWindow.d.ts.map +1 -0
- package/maintenanceWindow.js +148 -0
- package/maintenanceWindow.js.map +1 -0
- package/package.json +33 -0
- package/policy.d.ts +476 -0
- package/policy.d.ts.map +1 -0
- package/policy.js +387 -0
- package/policy.js.map +1 -0
- package/provider.d.ts +62 -0
- package/provider.d.ts.map +1 -0
- package/provider.js +80 -0
- package/provider.js.map +1 -0
- package/schedule.d.ts +120 -0
- package/schedule.d.ts.map +1 -0
- package/schedule.js +114 -0
- package/schedule.js.map +1 -0
- package/scheduleBeta.d.ts +104 -0
- package/scheduleBeta.d.ts.map +1 -0
- package/scheduleBeta.js +98 -0
- package/scheduleBeta.js.map +1 -0
- package/scheduleReplica.d.ts +178 -0
- package/scheduleReplica.d.ts.map +1 -0
- package/scheduleReplica.js +134 -0
- package/scheduleReplica.js.map +1 -0
- package/scheduleRotation.d.ts +287 -0
- package/scheduleRotation.d.ts.map +1 -0
- package/scheduleRotation.js +224 -0
- package/scheduleRotation.js.map +1 -0
- package/scheduleRotationBeta.d.ts +184 -0
- package/scheduleRotationBeta.d.ts.map +1 -0
- package/scheduleRotationBeta.js +121 -0
- package/scheduleRotationBeta.js.map +1 -0
- package/scheduleSyncRule.d.ts +154 -0
- package/scheduleSyncRule.d.ts.map +1 -0
- package/scheduleSyncRule.js +146 -0
- package/scheduleSyncRule.js.map +1 -0
- package/scheduleSyncTarget.d.ts +108 -0
- package/scheduleSyncTarget.d.ts.map +1 -0
- package/scheduleSyncTarget.js +106 -0
- package/scheduleSyncTarget.js.map +1 -0
- package/secret.d.ts +276 -0
- package/secret.d.ts.map +1 -0
- package/secret.js +234 -0
- package/secret.js.map +1 -0
- package/severity.d.ts +96 -0
- package/severity.d.ts.map +1 -0
- package/severity.js +102 -0
- package/severity.js.map +1 -0
- package/status.d.ts +121 -0
- package/status.d.ts.map +1 -0
- package/status.js +120 -0
- package/status.js.map +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +34 -0
- package/types/index.js.map +1 -0
- package/types/input.d.ts +23630 -0
- package/types/input.d.ts.map +1 -0
- package/types/input.js +5 -0
- package/types/input.js.map +1 -0
- package/types/output.d.ts +19726 -0
- package/types/output.d.ts.map +1 -0
- package/types/output.js +5 -0
- package/types/output.js.map +1 -0
- package/utilities.d.ts +5 -0
- package/utilities.d.ts.map +1 -0
- package/utilities.js +114 -0
- package/utilities.js.map +1 -0
- package/workflow.d.ts +736 -0
- package/workflow.d.ts.map +1 -0
- package/workflow.js +608 -0
- package/workflow.js.map +1 -0
package/apiKey.d.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
/**
|
|
3
|
+
* Manage API keys for your organization.
|
|
4
|
+
*
|
|
5
|
+
* This API lets you view, create, update, delete, and rotate API keys programmatically, including configuring account-level roles and roles scoped to specific teams.
|
|
6
|
+
*
|
|
7
|
+
* Common use cases include:
|
|
8
|
+
* - **API key rotation**: You can issue a new access token for any API key using the `Rotate` endpoint.
|
|
9
|
+
* - **Managing keys at scale**: use the `Show`, `List`, `Create`, `Update`, and `Delete` endpoints to automate API key lifecycle management.
|
|
10
|
+
*
|
|
11
|
+
* ## Permissions model
|
|
12
|
+
*
|
|
13
|
+
* To use these endpoints, your API key must have the `apiKeysManage` role granted at either the account level or for specific teams.
|
|
14
|
+
*
|
|
15
|
+
* In addition, the following rules apply, when a "caller" API key is managing a "target" API key:
|
|
16
|
+
*
|
|
17
|
+
* - A caller key can only assign roles whose scopes are a subset of its own scopes. For example, a key with `viewer` and `incidentCreator` can assign those roles to a target key, but cannot assign the `incidentEditor` role, since it has additional scopes.
|
|
18
|
+
* - The same applies at the team level: A caller key with `schedulesEditor` at the account level can create a target key with that role for a specific team, but a key with `schedulesEditor` only for one team (Team A, say) cannot assign it at the account level or for another team, Team B.
|
|
19
|
+
* - The `apiKeysManage` role cannot be assigned via the API. To create a key with that role, you must go to Settings → API keys in the dashboard, and click "Add new", creating a key with the "View, create, edit, delete or rotate API keys" role (`apiKeysManage`).
|
|
20
|
+
* - The `Delete` endpoint does not check whether the calling API key holds the scopes of the key being deleted. However, a team-scoped key can only delete keys belonging to its teams.
|
|
21
|
+
* - To rotate the token of an API key, use the Rotate endpoint or by clicking "Rotate token" on any API key listed in the dashboard. The same permissions limitations apply as when creating or updating an API key.
|
|
22
|
+
*
|
|
23
|
+
* ## Finding role names and team IDs
|
|
24
|
+
*
|
|
25
|
+
* To find valid values for `roleNames`, `teamIds`, and `teamRoleNames`, go to Settings → API keys in the dashboard. Click to either edit an existing key or create a new one, select the desired roles and teams, and then use the copy button to get hold of the role and team identifiers as JSON.
|
|
26
|
+
*
|
|
27
|
+
* Manages an API key: the credential an integration authenticates to incident.io with, and the roles that decide what it may do.
|
|
28
|
+
*
|
|
29
|
+
* ## The token
|
|
30
|
+
*
|
|
31
|
+
* incident.io returns a key's token when it issues one - when the key is created, and each time it is rotated - and at no other time. A read cannot recover it, so Terraform keeps it in state, in the `token` attribute. It is marked sensitive, so Terraform will not print it, but **anything that can read your state can read the token**: treat the state file as the credential it now contains, and pass `token` on to wherever it is needed through a sensitive output or variable rather than copying it around.
|
|
32
|
+
*
|
|
33
|
+
* A key adopted with `pulumi import` has no token, because the one it was created with is gone and cannot be re-read. Rotate it to get a token Terraform can hand on.
|
|
34
|
+
*
|
|
35
|
+
* ## Rotating
|
|
36
|
+
*
|
|
37
|
+
* `tokenVersion` is your own counter, and changing it - conventionally by incrementing it - is what asks incident.io to rotate the key. The plan says so, `token` becomes known after apply, and the previous token keeps working for `rotationGracePeriodMinutes` so that whatever holds it has a window to pick up the new one.
|
|
38
|
+
*
|
|
39
|
+
* Editing a key's roles or name never rotates it: the token outlives its permissions, and a key whose scopes you have just narrowed carries on working. Rotate deliberately if a permissions change means the old token should stop being accepted.
|
|
40
|
+
*
|
|
41
|
+
* ## Roles
|
|
42
|
+
*
|
|
43
|
+
* `roleNames` grants a role across the whole account. `teamRoleNames` grants roles only for the teams in `teamIds`, so those two go together: set both, or neither.
|
|
44
|
+
*
|
|
45
|
+
* incident.io will not let a key grant more than its own bearer holds, so the key running Terraform has to already have every role it assigns. It also refuses to assign `apiKeysManage` at all, which means a Terraform-managed key cannot itself manage keys.
|
|
46
|
+
*
|
|
47
|
+
* Neither rule is decided by this provider - which roles your own key holds is not something a configuration can know - so the plan asks incident.io whether the key it describes would be accepted. A role you cannot grant is reported when you plan, rather than part way through an apply. If that check cannot be reached the plan warns and carries on, so the rejection may still arrive at apply time.
|
|
48
|
+
*
|
|
49
|
+
* ## Example Usage
|
|
50
|
+
*
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
53
|
+
* import * as incident from "@incident-io/pulumi";
|
|
54
|
+
*
|
|
55
|
+
* // incident.io returns an API key's token when it issues one - on create, and on each
|
|
56
|
+
* // rotation - and never again. Terraform keeps it in state, so anything that can read your
|
|
57
|
+
* // state can read the token: treat the state file as the credential it now holds.
|
|
58
|
+
* const ci = new incident.ApiKey("ci", {
|
|
59
|
+
* name: "CI deploy key",
|
|
60
|
+
* comments: "Requested in #ask-infra, used by the deploy pipeline",
|
|
61
|
+
* roleNames: [
|
|
62
|
+
* "viewer",
|
|
63
|
+
* "catalog_viewer",
|
|
64
|
+
* ],
|
|
65
|
+
* });
|
|
66
|
+
* export const ciApiKeyToken = ci.token;
|
|
67
|
+
* // Rotating is asked for by changing token_version - conventionally by incrementing it.
|
|
68
|
+
* // That's the change Terraform can see, since the token itself is invisible to a plan.
|
|
69
|
+
* // The previous token keeps working for rotation_grace_period_minutes, giving whatever
|
|
70
|
+
* // holds it a window to pick up the new one.
|
|
71
|
+
* const rotatedQuarterly = new incident.ApiKey("rotated_quarterly", {
|
|
72
|
+
* name: "Terraform state reader",
|
|
73
|
+
* roleNames: ["viewer"],
|
|
74
|
+
* tokenVersion: 2,
|
|
75
|
+
* rotationGracePeriodMinutes: 60,
|
|
76
|
+
* });
|
|
77
|
+
* // A key can be scoped to particular teams instead of the whole account. team_ids says
|
|
78
|
+
* // which teams, and team_role_names says what the key may do for them, so the two go
|
|
79
|
+
* // together: set both, or neither. An account with no account-level roles leaves
|
|
80
|
+
* // role_names out entirely.
|
|
81
|
+
* const platformTeamSchedules = new incident.ApiKey("platform_team_schedules", {
|
|
82
|
+
* name: "Platform team schedule sync",
|
|
83
|
+
* teamIds: ["01G0J1EXE7AXZ2C93K61WBPYEH"],
|
|
84
|
+
* teamRoleNames: [
|
|
85
|
+
* "schedules_editor",
|
|
86
|
+
* "on_call_editor",
|
|
87
|
+
* ],
|
|
88
|
+
* });
|
|
89
|
+
* // Editing a key's roles never rotates it: the token outlives its permissions. Rotate
|
|
90
|
+
* // deliberately if narrowing a key's scopes should also stop the old token being accepted.
|
|
91
|
+
* const narrowed = new incident.ApiKey("narrowed", {
|
|
92
|
+
* name: "Read-only reporting key",
|
|
93
|
+
* roleNames: ["viewer"],
|
|
94
|
+
* tokenVersion: 3,
|
|
95
|
+
* rotationGracePeriodMinutes: 0,
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* ## Import
|
|
100
|
+
*
|
|
101
|
+
* Import is supported using an `import` block or the `pulumi import` command:
|
|
102
|
+
*
|
|
103
|
+
* The `pulumi import` command can be used, for example:
|
|
104
|
+
*
|
|
105
|
+
* !/bin/bash
|
|
106
|
+
*
|
|
107
|
+
* Import an API key using its ID
|
|
108
|
+
* Replace the ID with a real ID from your incident.io organization
|
|
109
|
+
*
|
|
110
|
+
* ```sh
|
|
111
|
+
* $ pulumi import incident:index/apiKey:ApiKey example 01ABC123DEF456GHI789JKL
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* An imported key has no token: the one it was issued with went to whoever created it and
|
|
115
|
+
* can't be read back, so `token` is null. It has no tokenVersion either, so a config that
|
|
116
|
+
* sets one will rotate the key on the first apply - which is also the only way to get a
|
|
117
|
+
* token for a key Terraform has adopted. The plan says so before it happens.
|
|
118
|
+
*/
|
|
119
|
+
export declare class ApiKey extends pulumi.CustomResource {
|
|
120
|
+
/**
|
|
121
|
+
* Get an existing ApiKey resource's state with the given name, ID, and optional extra
|
|
122
|
+
* properties used to qualify the lookup.
|
|
123
|
+
*
|
|
124
|
+
* @param name The _unique_ name of the resulting resource.
|
|
125
|
+
* @param id The _unique_ provider ID of the resource to lookup.
|
|
126
|
+
* @param state Any extra arguments used during the lookup.
|
|
127
|
+
* @param opts Optional settings to control the behavior of the CustomResource.
|
|
128
|
+
*/
|
|
129
|
+
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ApiKeyState, opts?: pulumi.CustomResourceOptions): ApiKey;
|
|
130
|
+
/**
|
|
131
|
+
* Returns true if the given object is an instance of ApiKey. This is designed to work even
|
|
132
|
+
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
|
133
|
+
*/
|
|
134
|
+
static isInstance(obj: any): obj is ApiKey;
|
|
135
|
+
/**
|
|
136
|
+
* Freeform notes about this API key
|
|
137
|
+
*/
|
|
138
|
+
readonly comments: pulumi.Output<string | undefined>;
|
|
139
|
+
/**
|
|
140
|
+
* When the API key was created
|
|
141
|
+
*/
|
|
142
|
+
readonly createdAt: pulumi.Output<string>;
|
|
143
|
+
/**
|
|
144
|
+
* When the key was last used to authenticate a request
|
|
145
|
+
*/
|
|
146
|
+
readonly lastUsedAt: pulumi.Output<string>;
|
|
147
|
+
/**
|
|
148
|
+
* The name of the API key, for the user's reference
|
|
149
|
+
*/
|
|
150
|
+
readonly name: pulumi.Output<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Account-level roles to assign to the API key. These roles apply across the entire account, not scoped to specific teams. Pass an empty array if no account-level roles are needed.
|
|
153
|
+
*/
|
|
154
|
+
readonly roleNames: pulumi.Output<string[]>;
|
|
155
|
+
/**
|
|
156
|
+
* How long the previous token keeps working after a rotation, in minutes, giving whatever holds it a window to pick up the new one. Defaults to 30. Set it to 0 to retire the old token immediately, at the cost of breaking anything still using it. incident.io documents an hour as the longest a rotated token stays valid, so it may reject a longer period. Only read when a change to `tokenVersion` rotates the key.
|
|
157
|
+
*/
|
|
158
|
+
readonly rotationGracePeriodMinutes: pulumi.Output<number>;
|
|
159
|
+
/**
|
|
160
|
+
* IDs of teams to scope the `teamRoleNames` to. If provided, `teamRoleNames` must also be a non-empty array, and vice versa. Pass an empty array if the key should not be scoped to any teams.
|
|
161
|
+
*/
|
|
162
|
+
readonly teamIds: pulumi.Output<string[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Roles to grant for the teams specified in `teamIds`. If provided, `teamIds` must also be a non-empty array, and vice versa. Pass an empty array if no team-level roles are needed.
|
|
165
|
+
*
|
|
166
|
+
* API key role name that may be granted for team-scoped access. Possible values are: `catalogEditor`, `schedulesEditor`, `schedulesReader`, `scheduleOverridesEditor`, `onCallEditor`, `escalationCreator`, `apiKeysManage`, `workflowsEditor`, `privateWorkflowsEditor`, `secretsManage`, `secretsUse`, `heartbeatsPing`, `telemetryQueryRestricted`, `telemetryDataSourceUpdate`.
|
|
167
|
+
*/
|
|
168
|
+
readonly teamRoleNames: pulumi.Output<string[]>;
|
|
169
|
+
/**
|
|
170
|
+
* The bearer token to authenticate as this key, which incident.io returns only when it issues one: on create, and on each rotation. Terraform stores it, because nothing can read it back afterwards, so anything with access to your state can read it. Null for a key adopted with `terraform import`, whose token was issued before Terraform knew about it - rotate the key to get one.
|
|
171
|
+
*/
|
|
172
|
+
readonly token: pulumi.Output<string>;
|
|
173
|
+
/**
|
|
174
|
+
* When the current token for this API was last issued. This is the last time the token was rotated, or when it was initially created. Older tokens may remain valid for up to an hour after they have been rotated, configured when you call the rotate endpoint.
|
|
175
|
+
*/
|
|
176
|
+
readonly tokenLastIssuedAt: pulumi.Output<string>;
|
|
177
|
+
/**
|
|
178
|
+
* The version of the token this configuration holds. Terraform stores this number, so changing it - conventionally by incrementing it - is what asks incident.io to rotate the key. It is your own counter, and incident.io never sees it. Leave it unset to manage a key's name and roles without ever rotating it.
|
|
179
|
+
*/
|
|
180
|
+
readonly tokenVersion: pulumi.Output<number | undefined>;
|
|
181
|
+
/**
|
|
182
|
+
* Create a ApiKey resource with the given unique name, arguments, and options.
|
|
183
|
+
*
|
|
184
|
+
* @param name The _unique_ name of the resource.
|
|
185
|
+
* @param args The arguments to use to populate this resource's properties.
|
|
186
|
+
* @param opts A bag of options that control this resource's behavior.
|
|
187
|
+
*/
|
|
188
|
+
constructor(name: string, args?: ApiKeyArgs, opts?: pulumi.CustomResourceOptions);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Input properties used for looking up and filtering ApiKey resources.
|
|
192
|
+
*/
|
|
193
|
+
export interface ApiKeyState {
|
|
194
|
+
/**
|
|
195
|
+
* Freeform notes about this API key
|
|
196
|
+
*/
|
|
197
|
+
comments?: pulumi.Input<string | undefined>;
|
|
198
|
+
/**
|
|
199
|
+
* When the API key was created
|
|
200
|
+
*/
|
|
201
|
+
createdAt?: pulumi.Input<string | undefined>;
|
|
202
|
+
/**
|
|
203
|
+
* When the key was last used to authenticate a request
|
|
204
|
+
*/
|
|
205
|
+
lastUsedAt?: pulumi.Input<string | undefined>;
|
|
206
|
+
/**
|
|
207
|
+
* The name of the API key, for the user's reference
|
|
208
|
+
*/
|
|
209
|
+
name?: pulumi.Input<string | undefined>;
|
|
210
|
+
/**
|
|
211
|
+
* Account-level roles to assign to the API key. These roles apply across the entire account, not scoped to specific teams. Pass an empty array if no account-level roles are needed.
|
|
212
|
+
*/
|
|
213
|
+
roleNames?: pulumi.Input<pulumi.Input<string>[] | undefined>;
|
|
214
|
+
/**
|
|
215
|
+
* How long the previous token keeps working after a rotation, in minutes, giving whatever holds it a window to pick up the new one. Defaults to 30. Set it to 0 to retire the old token immediately, at the cost of breaking anything still using it. incident.io documents an hour as the longest a rotated token stays valid, so it may reject a longer period. Only read when a change to `tokenVersion` rotates the key.
|
|
216
|
+
*/
|
|
217
|
+
rotationGracePeriodMinutes?: pulumi.Input<number | undefined>;
|
|
218
|
+
/**
|
|
219
|
+
* IDs of teams to scope the `teamRoleNames` to. If provided, `teamRoleNames` must also be a non-empty array, and vice versa. Pass an empty array if the key should not be scoped to any teams.
|
|
220
|
+
*/
|
|
221
|
+
teamIds?: pulumi.Input<pulumi.Input<string>[] | undefined>;
|
|
222
|
+
/**
|
|
223
|
+
* Roles to grant for the teams specified in `teamIds`. If provided, `teamIds` must also be a non-empty array, and vice versa. Pass an empty array if no team-level roles are needed.
|
|
224
|
+
*
|
|
225
|
+
* API key role name that may be granted for team-scoped access. Possible values are: `catalogEditor`, `schedulesEditor`, `schedulesReader`, `scheduleOverridesEditor`, `onCallEditor`, `escalationCreator`, `apiKeysManage`, `workflowsEditor`, `privateWorkflowsEditor`, `secretsManage`, `secretsUse`, `heartbeatsPing`, `telemetryQueryRestricted`, `telemetryDataSourceUpdate`.
|
|
226
|
+
*/
|
|
227
|
+
teamRoleNames?: pulumi.Input<pulumi.Input<string>[] | undefined>;
|
|
228
|
+
/**
|
|
229
|
+
* The bearer token to authenticate as this key, which incident.io returns only when it issues one: on create, and on each rotation. Terraform stores it, because nothing can read it back afterwards, so anything with access to your state can read it. Null for a key adopted with `terraform import`, whose token was issued before Terraform knew about it - rotate the key to get one.
|
|
230
|
+
*/
|
|
231
|
+
token?: pulumi.Input<string | undefined>;
|
|
232
|
+
/**
|
|
233
|
+
* When the current token for this API was last issued. This is the last time the token was rotated, or when it was initially created. Older tokens may remain valid for up to an hour after they have been rotated, configured when you call the rotate endpoint.
|
|
234
|
+
*/
|
|
235
|
+
tokenLastIssuedAt?: pulumi.Input<string | undefined>;
|
|
236
|
+
/**
|
|
237
|
+
* The version of the token this configuration holds. Terraform stores this number, so changing it - conventionally by incrementing it - is what asks incident.io to rotate the key. It is your own counter, and incident.io never sees it. Leave it unset to manage a key's name and roles without ever rotating it.
|
|
238
|
+
*/
|
|
239
|
+
tokenVersion?: pulumi.Input<number | undefined>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The set of arguments for constructing a ApiKey resource.
|
|
243
|
+
*/
|
|
244
|
+
export interface ApiKeyArgs {
|
|
245
|
+
/**
|
|
246
|
+
* Freeform notes about this API key
|
|
247
|
+
*/
|
|
248
|
+
comments?: pulumi.Input<string | undefined>;
|
|
249
|
+
/**
|
|
250
|
+
* The name of the API key, for the user's reference
|
|
251
|
+
*/
|
|
252
|
+
name?: pulumi.Input<string | undefined>;
|
|
253
|
+
/**
|
|
254
|
+
* Account-level roles to assign to the API key. These roles apply across the entire account, not scoped to specific teams. Pass an empty array if no account-level roles are needed.
|
|
255
|
+
*/
|
|
256
|
+
roleNames?: pulumi.Input<pulumi.Input<string>[] | undefined>;
|
|
257
|
+
/**
|
|
258
|
+
* How long the previous token keeps working after a rotation, in minutes, giving whatever holds it a window to pick up the new one. Defaults to 30. Set it to 0 to retire the old token immediately, at the cost of breaking anything still using it. incident.io documents an hour as the longest a rotated token stays valid, so it may reject a longer period. Only read when a change to `tokenVersion` rotates the key.
|
|
259
|
+
*/
|
|
260
|
+
rotationGracePeriodMinutes?: pulumi.Input<number | undefined>;
|
|
261
|
+
/**
|
|
262
|
+
* IDs of teams to scope the `teamRoleNames` to. If provided, `teamRoleNames` must also be a non-empty array, and vice versa. Pass an empty array if the key should not be scoped to any teams.
|
|
263
|
+
*/
|
|
264
|
+
teamIds?: pulumi.Input<pulumi.Input<string>[] | undefined>;
|
|
265
|
+
/**
|
|
266
|
+
* Roles to grant for the teams specified in `teamIds`. If provided, `teamIds` must also be a non-empty array, and vice versa. Pass an empty array if no team-level roles are needed.
|
|
267
|
+
*
|
|
268
|
+
* API key role name that may be granted for team-scoped access. Possible values are: `catalogEditor`, `schedulesEditor`, `schedulesReader`, `scheduleOverridesEditor`, `onCallEditor`, `escalationCreator`, `apiKeysManage`, `workflowsEditor`, `privateWorkflowsEditor`, `secretsManage`, `secretsUse`, `heartbeatsPing`, `telemetryQueryRestricted`, `telemetryDataSourceUpdate`.
|
|
269
|
+
*/
|
|
270
|
+
teamRoleNames?: pulumi.Input<pulumi.Input<string>[] | undefined>;
|
|
271
|
+
/**
|
|
272
|
+
* The version of the token this configuration holds. Terraform stores this number, so changing it - conventionally by incrementing it - is what asks incident.io to rotate the key. It is your own counter, and incident.io never sees it. Leave it unset to manage a key's name and roles without ever rotating it.
|
|
273
|
+
*/
|
|
274
|
+
tokenVersion?: pulumi.Input<number | undefined>;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=apiKey.d.ts.map
|
package/apiKey.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKey.d.ts","sourceRoot":"","sources":["../apiKey.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,qBAAa,MAAO,SAAQ,MAAM,CAAC,cAAc;IAC7C;;;;;;;;OAQG;WACW,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,qBAAqB,GAAG,MAAM;IAO9H;;;OAGG;WACW,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM;IAOjD;;OAEG;IACH,SAAwB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC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CAAC;IAC7D;;OAEG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9D;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;IAC3D;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;IACjE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACnD"}
|
package/apiKey.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
|
|
3
|
+
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ApiKey = void 0;
|
|
29
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
30
|
+
const utilities = __importStar(require("./utilities"));
|
|
31
|
+
/**
|
|
32
|
+
* Manage API keys for your organization.
|
|
33
|
+
*
|
|
34
|
+
* This API lets you view, create, update, delete, and rotate API keys programmatically, including configuring account-level roles and roles scoped to specific teams.
|
|
35
|
+
*
|
|
36
|
+
* Common use cases include:
|
|
37
|
+
* - **API key rotation**: You can issue a new access token for any API key using the `Rotate` endpoint.
|
|
38
|
+
* - **Managing keys at scale**: use the `Show`, `List`, `Create`, `Update`, and `Delete` endpoints to automate API key lifecycle management.
|
|
39
|
+
*
|
|
40
|
+
* ## Permissions model
|
|
41
|
+
*
|
|
42
|
+
* To use these endpoints, your API key must have the `apiKeysManage` role granted at either the account level or for specific teams.
|
|
43
|
+
*
|
|
44
|
+
* In addition, the following rules apply, when a "caller" API key is managing a "target" API key:
|
|
45
|
+
*
|
|
46
|
+
* - A caller key can only assign roles whose scopes are a subset of its own scopes. For example, a key with `viewer` and `incidentCreator` can assign those roles to a target key, but cannot assign the `incidentEditor` role, since it has additional scopes.
|
|
47
|
+
* - The same applies at the team level: A caller key with `schedulesEditor` at the account level can create a target key with that role for a specific team, but a key with `schedulesEditor` only for one team (Team A, say) cannot assign it at the account level or for another team, Team B.
|
|
48
|
+
* - The `apiKeysManage` role cannot be assigned via the API. To create a key with that role, you must go to Settings → API keys in the dashboard, and click "Add new", creating a key with the "View, create, edit, delete or rotate API keys" role (`apiKeysManage`).
|
|
49
|
+
* - The `Delete` endpoint does not check whether the calling API key holds the scopes of the key being deleted. However, a team-scoped key can only delete keys belonging to its teams.
|
|
50
|
+
* - To rotate the token of an API key, use the Rotate endpoint or by clicking "Rotate token" on any API key listed in the dashboard. The same permissions limitations apply as when creating or updating an API key.
|
|
51
|
+
*
|
|
52
|
+
* ## Finding role names and team IDs
|
|
53
|
+
*
|
|
54
|
+
* To find valid values for `roleNames`, `teamIds`, and `teamRoleNames`, go to Settings → API keys in the dashboard. Click to either edit an existing key or create a new one, select the desired roles and teams, and then use the copy button to get hold of the role and team identifiers as JSON.
|
|
55
|
+
*
|
|
56
|
+
* Manages an API key: the credential an integration authenticates to incident.io with, and the roles that decide what it may do.
|
|
57
|
+
*
|
|
58
|
+
* ## The token
|
|
59
|
+
*
|
|
60
|
+
* incident.io returns a key's token when it issues one - when the key is created, and each time it is rotated - and at no other time. A read cannot recover it, so Terraform keeps it in state, in the `token` attribute. It is marked sensitive, so Terraform will not print it, but **anything that can read your state can read the token**: treat the state file as the credential it now contains, and pass `token` on to wherever it is needed through a sensitive output or variable rather than copying it around.
|
|
61
|
+
*
|
|
62
|
+
* A key adopted with `pulumi import` has no token, because the one it was created with is gone and cannot be re-read. Rotate it to get a token Terraform can hand on.
|
|
63
|
+
*
|
|
64
|
+
* ## Rotating
|
|
65
|
+
*
|
|
66
|
+
* `tokenVersion` is your own counter, and changing it - conventionally by incrementing it - is what asks incident.io to rotate the key. The plan says so, `token` becomes known after apply, and the previous token keeps working for `rotationGracePeriodMinutes` so that whatever holds it has a window to pick up the new one.
|
|
67
|
+
*
|
|
68
|
+
* Editing a key's roles or name never rotates it: the token outlives its permissions, and a key whose scopes you have just narrowed carries on working. Rotate deliberately if a permissions change means the old token should stop being accepted.
|
|
69
|
+
*
|
|
70
|
+
* ## Roles
|
|
71
|
+
*
|
|
72
|
+
* `roleNames` grants a role across the whole account. `teamRoleNames` grants roles only for the teams in `teamIds`, so those two go together: set both, or neither.
|
|
73
|
+
*
|
|
74
|
+
* incident.io will not let a key grant more than its own bearer holds, so the key running Terraform has to already have every role it assigns. It also refuses to assign `apiKeysManage` at all, which means a Terraform-managed key cannot itself manage keys.
|
|
75
|
+
*
|
|
76
|
+
* Neither rule is decided by this provider - which roles your own key holds is not something a configuration can know - so the plan asks incident.io whether the key it describes would be accepted. A role you cannot grant is reported when you plan, rather than part way through an apply. If that check cannot be reached the plan warns and carries on, so the rejection may still arrive at apply time.
|
|
77
|
+
*
|
|
78
|
+
* ## Example Usage
|
|
79
|
+
*
|
|
80
|
+
* ```typescript
|
|
81
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
82
|
+
* import * as incident from "@incident-io/pulumi";
|
|
83
|
+
*
|
|
84
|
+
* // incident.io returns an API key's token when it issues one - on create, and on each
|
|
85
|
+
* // rotation - and never again. Terraform keeps it in state, so anything that can read your
|
|
86
|
+
* // state can read the token: treat the state file as the credential it now holds.
|
|
87
|
+
* const ci = new incident.ApiKey("ci", {
|
|
88
|
+
* name: "CI deploy key",
|
|
89
|
+
* comments: "Requested in #ask-infra, used by the deploy pipeline",
|
|
90
|
+
* roleNames: [
|
|
91
|
+
* "viewer",
|
|
92
|
+
* "catalog_viewer",
|
|
93
|
+
* ],
|
|
94
|
+
* });
|
|
95
|
+
* export const ciApiKeyToken = ci.token;
|
|
96
|
+
* // Rotating is asked for by changing token_version - conventionally by incrementing it.
|
|
97
|
+
* // That's the change Terraform can see, since the token itself is invisible to a plan.
|
|
98
|
+
* // The previous token keeps working for rotation_grace_period_minutes, giving whatever
|
|
99
|
+
* // holds it a window to pick up the new one.
|
|
100
|
+
* const rotatedQuarterly = new incident.ApiKey("rotated_quarterly", {
|
|
101
|
+
* name: "Terraform state reader",
|
|
102
|
+
* roleNames: ["viewer"],
|
|
103
|
+
* tokenVersion: 2,
|
|
104
|
+
* rotationGracePeriodMinutes: 60,
|
|
105
|
+
* });
|
|
106
|
+
* // A key can be scoped to particular teams instead of the whole account. team_ids says
|
|
107
|
+
* // which teams, and team_role_names says what the key may do for them, so the two go
|
|
108
|
+
* // together: set both, or neither. An account with no account-level roles leaves
|
|
109
|
+
* // role_names out entirely.
|
|
110
|
+
* const platformTeamSchedules = new incident.ApiKey("platform_team_schedules", {
|
|
111
|
+
* name: "Platform team schedule sync",
|
|
112
|
+
* teamIds: ["01G0J1EXE7AXZ2C93K61WBPYEH"],
|
|
113
|
+
* teamRoleNames: [
|
|
114
|
+
* "schedules_editor",
|
|
115
|
+
* "on_call_editor",
|
|
116
|
+
* ],
|
|
117
|
+
* });
|
|
118
|
+
* // Editing a key's roles never rotates it: the token outlives its permissions. Rotate
|
|
119
|
+
* // deliberately if narrowing a key's scopes should also stop the old token being accepted.
|
|
120
|
+
* const narrowed = new incident.ApiKey("narrowed", {
|
|
121
|
+
* name: "Read-only reporting key",
|
|
122
|
+
* roleNames: ["viewer"],
|
|
123
|
+
* tokenVersion: 3,
|
|
124
|
+
* rotationGracePeriodMinutes: 0,
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* ## Import
|
|
129
|
+
*
|
|
130
|
+
* Import is supported using an `import` block or the `pulumi import` command:
|
|
131
|
+
*
|
|
132
|
+
* The `pulumi import` command can be used, for example:
|
|
133
|
+
*
|
|
134
|
+
* !/bin/bash
|
|
135
|
+
*
|
|
136
|
+
* Import an API key using its ID
|
|
137
|
+
* Replace the ID with a real ID from your incident.io organization
|
|
138
|
+
*
|
|
139
|
+
* ```sh
|
|
140
|
+
* $ pulumi import incident:index/apiKey:ApiKey example 01ABC123DEF456GHI789JKL
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* An imported key has no token: the one it was issued with went to whoever created it and
|
|
144
|
+
* can't be read back, so `token` is null. It has no tokenVersion either, so a config that
|
|
145
|
+
* sets one will rotate the key on the first apply - which is also the only way to get a
|
|
146
|
+
* token for a key Terraform has adopted. The plan says so before it happens.
|
|
147
|
+
*/
|
|
148
|
+
class ApiKey extends pulumi.CustomResource {
|
|
149
|
+
/**
|
|
150
|
+
* Get an existing ApiKey resource's state with the given name, ID, and optional extra
|
|
151
|
+
* properties used to qualify the lookup.
|
|
152
|
+
*
|
|
153
|
+
* @param name The _unique_ name of the resulting resource.
|
|
154
|
+
* @param id The _unique_ provider ID of the resource to lookup.
|
|
155
|
+
* @param state Any extra arguments used during the lookup.
|
|
156
|
+
* @param opts Optional settings to control the behavior of the CustomResource.
|
|
157
|
+
*/
|
|
158
|
+
static get(name, id, state, opts) {
|
|
159
|
+
return new ApiKey(name, state, { ...opts, id: id });
|
|
160
|
+
}
|
|
161
|
+
/** @internal */
|
|
162
|
+
static __pulumiType = 'incident:index/apiKey:ApiKey';
|
|
163
|
+
/**
|
|
164
|
+
* Returns true if the given object is an instance of ApiKey. This is designed to work even
|
|
165
|
+
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
|
166
|
+
*/
|
|
167
|
+
static isInstance(obj) {
|
|
168
|
+
if (obj === undefined || obj === null) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return obj['__pulumiType'] === ApiKey.__pulumiType;
|
|
172
|
+
}
|
|
173
|
+
constructor(name, argsOrState, opts) {
|
|
174
|
+
let resourceInputs = {};
|
|
175
|
+
opts = opts || {};
|
|
176
|
+
if (opts.id) {
|
|
177
|
+
const state = argsOrState;
|
|
178
|
+
resourceInputs["comments"] = state?.comments;
|
|
179
|
+
resourceInputs["createdAt"] = state?.createdAt;
|
|
180
|
+
resourceInputs["lastUsedAt"] = state?.lastUsedAt;
|
|
181
|
+
resourceInputs["name"] = state?.name;
|
|
182
|
+
resourceInputs["roleNames"] = state?.roleNames;
|
|
183
|
+
resourceInputs["rotationGracePeriodMinutes"] = state?.rotationGracePeriodMinutes;
|
|
184
|
+
resourceInputs["teamIds"] = state?.teamIds;
|
|
185
|
+
resourceInputs["teamRoleNames"] = state?.teamRoleNames;
|
|
186
|
+
resourceInputs["token"] = state?.token;
|
|
187
|
+
resourceInputs["tokenLastIssuedAt"] = state?.tokenLastIssuedAt;
|
|
188
|
+
resourceInputs["tokenVersion"] = state?.tokenVersion;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const args = argsOrState;
|
|
192
|
+
resourceInputs["comments"] = args?.comments;
|
|
193
|
+
resourceInputs["name"] = args?.name;
|
|
194
|
+
resourceInputs["roleNames"] = args?.roleNames;
|
|
195
|
+
resourceInputs["rotationGracePeriodMinutes"] = args?.rotationGracePeriodMinutes;
|
|
196
|
+
resourceInputs["teamIds"] = args?.teamIds;
|
|
197
|
+
resourceInputs["teamRoleNames"] = args?.teamRoleNames;
|
|
198
|
+
resourceInputs["tokenVersion"] = args?.tokenVersion;
|
|
199
|
+
resourceInputs["createdAt"] = undefined /*out*/;
|
|
200
|
+
resourceInputs["lastUsedAt"] = undefined /*out*/;
|
|
201
|
+
resourceInputs["token"] = undefined /*out*/;
|
|
202
|
+
resourceInputs["tokenLastIssuedAt"] = undefined /*out*/;
|
|
203
|
+
}
|
|
204
|
+
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
|
|
205
|
+
const secretOpts = { additionalSecretOutputs: ["token"] };
|
|
206
|
+
opts = pulumi.mergeOptions(opts, secretOpts);
|
|
207
|
+
super(ApiKey.__pulumiType, name, resourceInputs, opts);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.ApiKey = ApiKey;
|
|
211
|
+
//# sourceMappingURL=apiKey.js.map
|
package/apiKey.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKey.js","sourceRoot":"","sources":["../apiKey.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjF,uDAAyC;AACzC,uDAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,MAAa,MAAO,SAAQ,MAAM,CAAC,cAAc;IAC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