MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / revoke

Function revoke

dwave/cloud/cli.py:1105–1123  ·  view source on GitHub ↗

Revoke access and/or refresh token(s) for Leap API.

(*, config_file, profile, token_type, json_output, output)

Source from the content-addressed store, hash-verified

1103@json_output
1104@standardized_output
1105def revoke(*, config_file, profile, token_type, json_output, output):
1106 """Revoke access and/or refresh token(s) for Leap API."""
1107
1108 token_key = token_type.replace('-', '_')
1109 token_pretty = token_type.replace('-', ' ').capitalize()
1110
1111 config = validate_config_v1(load_config(config_file=config_file, profile=profile))
1112
1113 with LeapAuthFlow.from_config_model(config) as flow:
1114 if not flow.token or not token_key in flow.token:
1115 raise CLIError('Token not found. Please run "dwave auth login".', code=100)
1116
1117 # revoke
1118 revoked = flow.revoke_token(token=flow.token[token_key], token_type_hint=token_key)
1119
1120 if not revoked:
1121 raise CLIError(f'{token_pretty} revocation failed.', code=102)
1122
1123 output(f'{token_pretty} successfully revoked.')
1124
1125
1126@cli.group()

Callers

nothing calls this directly

Calls 6

validate_config_v1Function · 0.90
load_configFunction · 0.90
CLIErrorClass · 0.90
outputFunction · 0.85
revoke_tokenMethod · 0.80
from_config_modelMethod · 0.45

Tested by

no test coverage detected