@backstage-community/plugin-splunk-on-call 0.4.24

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/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # Splunk On-Call
2
+
3
+ ## Overview
4
+
5
+ This plugin displays Splunk On-Call (formerly VictorOps) information associated with an entity.
6
+
7
+ It also provides the ability to trigger new incidents to specific users and/or specific teams from within Backstage.
8
+
9
+ This plugin requires that entities feature either a `splunk.com/on-call-team` or a `splunk.com/on-call-routing-key` annotation. See below for further details.
10
+
11
+ This plugin provides:
12
+
13
+ - A list of incidents
14
+ - A way to trigger a new incident to specific users and/or teams
15
+ - A way to acknowledge/resolve an incident
16
+ - Information details about the persons on-call
17
+
18
+ ## Setup instructions
19
+
20
+ Install the plugin:
21
+
22
+ ```bash
23
+ # From your Backstage root directory
24
+ yarn --cwd packages/app add @backstage-community/plugin-splunk-on-call
25
+ ```
26
+
27
+ Add it to your `EntityPage`:
28
+
29
+ ```ts
30
+ // packages/app/src/components/catalog/EntityPage.tsx
31
+ import {
32
+ isSplunkOnCallAvailable,
33
+ EntitySplunkOnCallCard,
34
+ } from '@backstage-community/plugin-splunk-on-call';
35
+ // ...
36
+ const overviewContent = (
37
+ <Grid container spacing={3} alignItems="stretch">
38
+ <EntitySwitch>
39
+ <EntitySwitch.Case if={isSplunkOnCallAvailable}>
40
+ <Grid item md={6}>
41
+ <EntitySplunkOnCallCard />
42
+ </Grid>
43
+ </EntitySwitch.Case>
44
+ </EntitySwitch>
45
+ ```
46
+
47
+ ### `readOnly` mode
48
+
49
+ To suppress the rendering of the actionable create-acknowledge-resolve incident buttons and UI controls, the `EntitySplunkOnCallCard` can also be instantiated in `readOnly` mode:
50
+
51
+ ```ts
52
+ <EntitySplunkOnCallCard readOnly />
53
+ ```
54
+
55
+ ## Client configuration
56
+
57
+ In order to be able to perform certain actions (create-acknowledge-resolve an action), you need to provide a REST Endpoint.
58
+
59
+ To enable the REST Endpoint integration you can go on https://portal.victorops.com/ inside Integrations > 3rd Party Integrations > REST – Generic.
60
+ You can now copy the URL to notify: `<SPLUNK_ON_CALL_REST_ENDPOINT>/$routing_key`
61
+
62
+ In `app-config.yaml`:
63
+
64
+ ```yaml
65
+ splunkOnCall:
66
+ eventsRestEndpoint: <SPLUNK_ON_CALL_REST_ENDPOINT>
67
+ ```
68
+
69
+ In order to make the API calls, you need to provide a new proxy config which will redirect to the Splunk On-Call API endpoint and add authentication information in the headers:
70
+
71
+ ```yaml
72
+ # app-config.yaml
73
+ proxy:
74
+ # ...
75
+ '/splunk-on-call':
76
+ target: https://api.victorops.com/api-public
77
+ headers:
78
+ X-VO-Api-Id: ${SPLUNK_ON_CALL_API_ID}
79
+ X-VO-Api-Key: ${SPLUNK_ON_CALL_API_KEY}
80
+ ```
81
+
82
+ In addition, to make certain API calls (trigger-resolve-acknowledge an incident) you need to add the `PATCH` method to the backend `cors` methods list: `[GET, POST, PUT, DELETE, PATCH]`.
83
+
84
+ **WARNING**: In current implementation, the Splunk OnCall plugin requires the `/splunk-on-call` proxy endpoint be exposed by the Backstage backend as an unprotected endpoint, in effect enabling Splunk OnCall API access using the configured `SPLUNK_ON_CALL_API_KEY` for any user or process with access to the `/splunk-on-call` Backstage backend endpoint. See below for further configuration options enabling protection of this endpoint. If you regard this as problematic, consider using the plugin in `readOnly` mode (`<EntitySplunkOnCallCard readOnly />`) using the following proxy configuration:
85
+
86
+ ```yaml
87
+ proxy:
88
+ '/splunk-on-call':
89
+ target: https://api.victorops.com/api-public
90
+ headers:
91
+ X-VO-Api-Id: ${SPLUNK_ON_CALL_API_ID}
92
+ X-VO-Api-Key: ${SPLUNK_ON_CALL_API_KEY}
93
+ # prohibit the `/splunk-on-call` proxy endpoint from servicing non-GET requests
94
+ allowedMethods: ['GET']
95
+ ```
96
+
97
+ ### Adding your team name to the entity annotation
98
+
99
+ The information displayed for each entity is based on either an associated team name or an associated routing key.
100
+
101
+ To use this plugin for an entity, the entity must be labeled with either a `splunk.com/on-call-team` or a `splunk.com/on-call-routing-key` annotation.
102
+
103
+ For example, by specifying a `splunk.com/on-call-team`, the plugin displays Splunk On-Call data associated with the specified team:
104
+
105
+ ```yaml
106
+ annotations:
107
+ splunk.com/on-call-team: <SPLUNK_ON_CALL_TEAM_NAME>
108
+ ```
109
+
110
+ Alternatively, by specifying a `splunk.com/on-call-routing-key`, the plugin displays Splunk On-Call data associated with _each_ of the teams associated with the specified routing key:
111
+
112
+ ```yaml
113
+ annotations:
114
+ splunk.com/on-call-routing-key: <SPLUNK_ON_CALL_ROUTING_KEY>
115
+ ```
116
+
117
+ ### Create the Routing Key
118
+
119
+ To be able to use the REST Endpoint seen above, you must have created a routing key with the **same name** as the provided team.
120
+
121
+ You can create a new routing key on https://portal.victorops.com/ by going to Settings > Routing Keys.
122
+
123
+ You can read [Create & Manage Alert Routing Keys](https://help.victorops.com/knowledge-base/routing-keys/#routing-key-tips-tricks) for further information.
124
+
125
+ ## Providing the API key and API id
126
+
127
+ In order for the client to make requests to the [Splunk On-Call API](https://portal.victorops.com/public/api-docs.html#/) it needs an [API ID and an API Key](https://help.victorops.com/knowledge-base/api/).
128
+
129
+ Then start the backend passing the values as an environment variable:
130
+
131
+ ```bash
132
+ $ SPLUNK_ON_CALL_API_KEY='' SPLUNK_ON_CALL_API_ID='' yarn start
133
+ ```
134
+
135
+ This will proxy the request by adding `X-VO-Api-Id` and `X-VO-Api-Key` headers with the provided values.
136
+
137
+ You can also add the values in your helm template:
138
+
139
+ ```yaml
140
+ # backend-secret.yaml
141
+ stringData:
142
+ # ...
143
+ SPLUNK_ON_CALL_API_ID: { { .Values.auth.splunkOnCallApiId } }
144
+ SPLUNK_ON_CALL_API_KEY: { { .Values.auth.splunkOnCallApiKey } }
145
+ ```
146
+
147
+ To enable it you need to provide them in the chart's values:
148
+
149
+ ```yaml
150
+ # values.yaml
151
+ auth:
152
+ # ...
153
+ splunkOnCallApiId: h
154
+ splunkOnCallApiKey: h
155
+ ```
package/config.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright 2021 The Backstage Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface Config {
17
+ /**
18
+ * Splunk On Call Plugin specific configs
19
+ */
20
+ splunkOnCall?: {
21
+ /**
22
+ * @visibility frontend
23
+ */
24
+ eventsRestEndpoint?: string;
25
+ };
26
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="282" height="173" fill="none" viewBox="0 0 282 173"><path fill="#000" fill-opacity=".05" fill-rule="evenodd" d="M16.4571 45.1637C11.0514 46.1711 7.48574 51.3699 8.49306 56.7756C9.50039 62.1814 14.6992 65.747 20.105 64.7397L27.5528 63.3518C25.4791 65.5835 24.4525 68.7347 25.0535 71.9596C26.0608 77.3653 31.2596 80.931 36.6654 79.9236L89.691 70.0427C89.7016 70.1067 89.7129 70.1708 89.7249 70.2349C90.3258 73.4598 92.4185 76.0298 95.1569 77.3647L91.9031 77.971C86.4974 78.9784 82.9318 84.1772 83.9391 89.583C84.9464 94.9887 90.1452 98.5543 95.551 97.547L250.098 68.7482C255.504 67.7409 259.069 62.5421 258.062 57.1363C257.461 53.9114 255.368 51.3414 252.63 50.0065L257.835 49.0366C263.241 48.0292 266.807 42.8304 265.799 37.4247C264.792 32.0189 259.593 28.4533 254.187 29.4606L161.492 46.7338C161.481 46.6697 161.47 46.6056 161.458 46.5415C160.857 43.3166 158.764 40.7466 156.026 39.4117L165.025 37.7347C170.431 36.7274 173.997 31.5286 172.989 26.1228C171.982 20.7171 166.783 17.1514 161.378 18.1588L16.4571 45.1637ZM24.3031 122.54C23.2958 117.134 26.8614 111.936 32.2672 110.928L190.856 81.3762C196.262 80.3688 201.461 83.9345 202.468 89.3402C203.476 94.746 199.91 99.9448 194.504 100.952L189.963 101.798C190.493 102.057 190.999 102.362 191.474 102.708L246.43 92.4677C251.835 91.4604 257.034 95.026 258.041 100.432C258.642 103.657 257.616 106.808 255.542 109.04L256.649 108.833C262.055 107.826 267.253 111.392 268.261 116.797C269.268 122.203 265.702 127.402 260.297 128.409L95.5591 159.107C90.1534 160.114 84.9545 156.549 83.9472 151.143C82.9399 145.737 86.5055 140.538 91.9113 139.531L103.94 137.29C103.41 137.031 102.904 136.726 102.429 136.38L29.1002 150.044C23.6944 151.051 18.4956 147.486 17.4882 142.08C16.4809 136.674 20.0465 131.475 25.4523 130.468L29.7352 129.67C26.9967 128.335 24.904 125.765 24.3031 122.54Z" clip-rule="evenodd"/><circle cx="188" cy="55" r="6" fill="#69DDC7"/><circle cx="91" cy="92" r="6" fill="#69DDC7"/><path fill="#69DDC7" d="M121 114L95.5 88L86.5 96L121 130L192.5 59L183.5 51L121 114Z"/></svg>
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import Grid from '@material-ui/core/Grid';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+ import { E as EntitySplunkOnCallCard } from './index-D8KSFXg5.esm.js';
5
+ import { Page, Header, Content, ContentHeader, SupportButton } from '@backstage/core-components';
6
+ import '@backstage/core-plugin-api';
7
+ import 'react-use/esm/useAsync';
8
+ import '@backstage/plugin-catalog-react';
9
+ import '@material-ui/core/Card';
10
+ import '@material-ui/core/CardContent';
11
+ import '@material-ui/core/CardHeader';
12
+ import '@material-ui/core/Divider';
13
+ import '@material-ui/core/Typography';
14
+ import '@material-ui/icons/AlarmAdd';
15
+ import '@material-ui/icons/Web';
16
+ import '@material-ui/lab/Alert';
17
+ import '@material-ui/core/Button';
18
+ import '@material-ui/core/List';
19
+ import '@material-ui/core/ListSubheader';
20
+ import '@material-ui/core/ListItem';
21
+ import '@material-ui/core/ListItemIcon';
22
+ import '@material-ui/core/ListItemText';
23
+ import '@material-ui/core/ListItemSecondaryAction';
24
+ import '@material-ui/core/Tooltip';
25
+ import '@material-ui/core/IconButton';
26
+ import '@material-ui/core/Avatar';
27
+ import '@material-ui/icons/Email';
28
+ import '@material-ui/icons/Done';
29
+ import '@material-ui/icons/DoneAll';
30
+ import 'luxon';
31
+ import '@material-ui/icons/OpenInBrowser';
32
+ import 'react-use/esm/useAsyncFn';
33
+ import '../assets/emptystate.svg';
34
+ import '@material-ui/core/Dialog';
35
+ import '@material-ui/core/DialogTitle';
36
+ import '@material-ui/core/TextField';
37
+ import '@material-ui/core/DialogActions';
38
+ import '@material-ui/core/DialogContent';
39
+ import '@material-ui/core/CircularProgress';
40
+ import '@material-ui/core/Select';
41
+ import '@material-ui/core/MenuItem';
42
+ import '@material-ui/core/FormControl';
43
+ import '@material-ui/core/InputLabel';
44
+
45
+ const useStyles = makeStyles(() => ({
46
+ overflowXScroll: {
47
+ overflowX: "scroll"
48
+ }
49
+ }));
50
+ const SplunkOnCallPage = (props) => {
51
+ const { title, subtitle, pageTitle } = props;
52
+ const classes = useStyles();
53
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title, subtitle }), /* @__PURE__ */ React.createElement(Content, { className: classes.overflowXScroll }, /* @__PURE__ */ React.createElement(ContentHeader, { title: pageTitle }, /* @__PURE__ */ React.createElement(SupportButton, null, "This is used to help you automate incident management.")), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "row" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 4 }, /* @__PURE__ */ React.createElement(EntitySplunkOnCallCard, null)))));
54
+ };
55
+ SplunkOnCallPage.defaultProps = {
56
+ title: "Splunk On-Call",
57
+ subtitle: "Automate incident management",
58
+ pageTitle: "Dashboard"
59
+ };
60
+
61
+ export { SplunkOnCallPage };
62
+ //# sourceMappingURL=SplunkOnCallPage-D9lfarwB.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplunkOnCallPage-D9lfarwB.esm.js","sources":["../../src/components/SplunkOnCallPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { EntitySplunkOnCallCard } from './EntitySplunkOnCallCard';\nimport {\n Content,\n ContentHeader,\n Page,\n Header,\n SupportButton,\n} from '@backstage/core-components';\n\nconst useStyles = makeStyles(() => ({\n overflowXScroll: {\n overflowX: 'scroll',\n },\n}));\n\n/** @public */\nexport type SplunkOnCallPageProps = {\n title?: string;\n subtitle?: string;\n pageTitle?: string;\n};\n\nexport const SplunkOnCallPage = (props: SplunkOnCallPageProps): JSX.Element => {\n const { title, subtitle, pageTitle } = props;\n const classes = useStyles();\n\n return (\n <Page themeId=\"tool\">\n <Header title={title} subtitle={subtitle} />\n <Content className={classes.overflowXScroll}>\n <ContentHeader title={pageTitle}>\n <SupportButton>\n This is used to help you automate incident management.\n </SupportButton>\n </ContentHeader>\n <Grid container spacing={3} direction=\"row\">\n <Grid item xs={12} sm={6} md={4}>\n <EntitySplunkOnCallCard />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n\nSplunkOnCallPage.defaultProps = {\n title: 'Splunk On-Call',\n subtitle: 'Automate incident management',\n pageTitle: 'Dashboard',\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,eAAiB,EAAA;AAAA,IACf,SAAW,EAAA,QAAA;AAAA,GACb;AACF,CAAE,CAAA,CAAA,CAAA;AASW,MAAA,gBAAA,GAAmB,CAAC,KAA8C,KAAA;AAC7E,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AACvC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,MAAO,EAAA,EAAA,KAAA,EAAc,UAAoB,CAC1C,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,mCACzB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAO,SACpB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,EAAA,wDAEf,CACF,CAAA,sCACC,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAG,WAAU,KACpC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EAAI,EAAA,EAAA,EAAI,GAAG,EAAI,EAAA,CAAA,EAAA,sCAC3B,sBAAuB,EAAA,IAAA,CAC1B,CACF,CACF,CACF,CAAA,CAAA;AAEJ,EAAA;AAEA,gBAAA,CAAiB,YAAe,GAAA;AAAA,EAC9B,KAAO,EAAA,gBAAA;AAAA,EACP,QAAU,EAAA,8BAAA;AAAA,EACV,SAAW,EAAA,WAAA;AACb,CAAA;;;;"}