cortexapps-cli 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl

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.
@@ -22,7 +22,7 @@ def add(
22
22
 
23
23
  if file_input:
24
24
  if alias or api_key or is_default or host:
25
- raise typer.BadParameter("When providing a custom event definition file, do not specify any other custom event attributes")
25
+ raise typer.BadParameter("When providing a configuration file, do not specify any other attributes")
26
26
  data = json.loads("".join([line for line in file_input]))
27
27
  else:
28
28
  data = {
@@ -168,3 +168,70 @@ def validate_all(
168
168
 
169
169
  r = client.post("api/v1/github/configurations")
170
170
  print_json(data=r)
171
+
172
+ @app.command()
173
+ def add_personal(
174
+ ctx: typer.Context,
175
+ alias: str = typer.Option(..., "--alias", "-a", help="Alias for this configuration"),
176
+ access_token: str = typer.Option(..., "--access-token", "-at", help="Access Token"),
177
+ host: str = typer.Option(None, "--host", "-h", help="Optional host name"),
178
+ is_default: bool = typer.Option(False, "--is-default", "-i", help="If this is the default configuration"),
179
+ file_input: Annotated[typer.FileText, typer.Option("--file", "-f", help="JSON file containing configurations, if command line options not used; can be passed as stdin with -, example: -f-")] = None,
180
+ ):
181
+ """
182
+ Add a single personal configuration
183
+ """
184
+
185
+ client = ctx.obj["client"]
186
+
187
+ if file_input:
188
+ if alias or access_token or is_default or host:
189
+ raise typer.BadParameter("When providing a configuration file, do not specify any other attributes")
190
+ data = json.loads("".join([line for line in file_input]))
191
+ else:
192
+ data = {
193
+ "alias": alias,
194
+ "accessToken": access_token,
195
+ "apiHost": host,
196
+ "isDefault": is_default,
197
+ }
198
+
199
+ # remove any data elements that are None - can only be is_default
200
+ data = {k: v for k, v in data.items() if v is not None}
201
+
202
+ r = client.post("api/v1/github/configurations/personal", data=data)
203
+ print_json(data=r)
204
+
205
+ @app.command()
206
+ def delete_personal(
207
+ ctx: typer.Context,
208
+ alias: str = typer.Option(..., "--alias", "-a", help="The alias of the configuration"),
209
+ ):
210
+ """
211
+ Delete a personal configuration
212
+ """
213
+
214
+ client = ctx.obj["client"]
215
+
216
+ r = client.delete("api/v1/github/configurations/personal/" + alias)
217
+ print_json(data=r)
218
+
219
+ @app.command()
220
+ def update_personal(
221
+ ctx: typer.Context,
222
+ alias: str = typer.Option(..., "--alias", "-a", help="The alias of the configuration"),
223
+ is_default: bool = typer.Option(False, "--is-default", "-i", help="If this is the default configuration"),
224
+ ):
225
+ """
226
+ Update a personal configuration
227
+ """
228
+
229
+ client = ctx.obj["client"]
230
+
231
+ data = {
232
+ "alias": alias,
233
+ "isDefault": is_default
234
+ }
235
+
236
+ r = client.put("api/v1/github/configurations/personal/" + alias, data=data)
237
+ print_json(data=r)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cortexapps-cli
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Command Line Interface for cortexapps
5
5
  License: MIT
6
6
  Author: Cortex Apps
@@ -23,7 +23,7 @@ cortexapps_cli/commands/integrations_commands/azure_resources.py,sha256=o40WLnBj
23
23
  cortexapps_cli/commands/integrations_commands/circleci.py,sha256=XODqSkR05qh4cvF4RLmgYc0Xy9A_1Ix8PssoW_PWlgo,4270
24
24
  cortexapps_cli/commands/integrations_commands/coralogix.py,sha256=aNr1TnOYfEqYBYHTB0oGFUiUzHjsC5Rbn_bs1lBcLN8,4440
25
25
  cortexapps_cli/commands/integrations_commands/datadog.py,sha256=PymAzZF26V5Dt7vH3IlO6Ssd2iiRkJPH64X0jpywQo8,4407
26
- cortexapps_cli/commands/integrations_commands/github.py,sha256=v1oIZIeIJQloEreUKS0K9Cg_mW9oKWJnUAKqDhcaFvc,4250
26
+ cortexapps_cli/commands/integrations_commands/github.py,sha256=MRWYmrCn3XcXC8vcXEPVtZ5U2uSSP5xKwiK-1uSuL0A,6482
27
27
  cortexapps_cli/commands/integrations_commands/gitlab.py,sha256=wuS4RcmXpYXirYJwPublxJTJxKR7taRVLjQI89cMefw,4250
28
28
  cortexapps_cli/commands/integrations_commands/incidentio.py,sha256=k44VRJJP_UYI5rfO1GosPukEB8VBmEIPtZby1OrReX4,4290
29
29
  cortexapps_cli/commands/integrations_commands/launchdarkly.py,sha256=SNVnhGPy6nYUxiTTKXDQfHLwpwyM2GrQiJAIk_fnhUw,4310
@@ -47,12 +47,11 @@ cortexapps_cli/commands/scorecards.py,sha256=NJ42icpcom200wZs03fNdsOn0StlOmVjBqd
47
47
  cortexapps_cli/commands/scorecards_commands/exemptions.py,sha256=BsS2ucv4PLUwfIF4YjonEcL-rGaUaO4BnKTFwTt1ObI,3609
48
48
  cortexapps_cli/commands/teams.py,sha256=ia-RzXbf5_v1FtBaRW-8f8pGtgo5n2KVUW7LtvflxjY,7264
49
49
  cortexapps_cli/commands/workflows.py,sha256=B4AMlCs_ry80Sq_9hczra1N6bOnRBsK9yuXP70kt5oI,4556
50
- cortexapps_cli/cortex.py,sha256=aW9649Tom5vW_5Jm7pH-NMudp8gR-0JgEXcvnG4KgxA,158546
51
50
  cortexapps_cli/cortex_client.py,sha256=E8tKiMNdz-sCaRd8Z7tqulsKbth7D36calJNe2e1lrM,7197
52
51
  cortexapps_cli/models/team.py,sha256=DZ_MmXLLhi4AoT3sng-JEUOWSafFQH_FqY0xODusdtg,6460
53
52
  cortexapps_cli/utils.py,sha256=zJilDiFhL-cYdp5LA251rED7vdc0EIEivCZpCqQRvmI,6992
54
- cortexapps_cli-1.0.0.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
55
- cortexapps_cli-1.0.0.dist-info/METADATA,sha256=QxwXjrPTtPz3ZEX0aLE6mzrVAh5sTTI3zL_vCPlu7Z8,20821
56
- cortexapps_cli-1.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
57
- cortexapps_cli-1.0.0.dist-info/entry_points.txt,sha256=YffF7CawiDnK0vE7Fg9mAItnXoSjLvVkW3IdHhumz84,49
58
- cortexapps_cli-1.0.0.dist-info/RECORD,,
53
+ cortexapps_cli-1.0.2.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
54
+ cortexapps_cli-1.0.2.dist-info/METADATA,sha256=p8KSmF9Rs6y4ef6EeSCowMKJfR6IIr0CU9SUPe3utG4,20821
55
+ cortexapps_cli-1.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
56
+ cortexapps_cli-1.0.2.dist-info/entry_points.txt,sha256=YffF7CawiDnK0vE7Fg9mAItnXoSjLvVkW3IdHhumz84,49
57
+ cortexapps_cli-1.0.2.dist-info/RECORD,,