Skip to content

Commit ba21602

Browse files
CCM-13135: adding README
1 parent 5dc7527 commit ba21602

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

scripts/config/vale/styles/config/vocabularies/words/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ temp_dir
9090
Terraform
9191
toolchain
9292
Trufflehog
93+
uat
9394
updateReadme
9495
Uploader
9596
uuid

utils/client-management/README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# client-management
2+
3+
TypeScript Library / CLI utility for managing comms manager client configuration. These are currently stored in SSM Parameter Store.
4+
5+
## Usage
6+
7+
### CLI Usage
8+
9+
From the repo root run:
10+
11+
```bash
12+
cd utils/client-management
13+
npm run-script cli -- <command> [options]
14+
```
15+
16+
### Library Usage
17+
18+
Install the package as `@client-management`
19+
20+
Instantiate an instance of the library as follows. The library should take an implementation of an `IParameterStore` to define how the library will interact with SSM (e.g. caching vs non-caching).
21+
22+
```ts
23+
import { ClientManagement } from '@client-management';
24+
25+
const cm = ClientManagement({ parameterStore: new ParameterStore() });
26+
```
27+
28+
### Global Options
29+
30+
#### CLI Options
31+
32+
- `--environment` - The name of the environment to run the command on e.g. 'de-<shortcode>', 'uat', 'prod'. Required.
33+
- `--format` - print data in json or tabular format. Default is `table`.
34+
35+
#### Library Options
36+
37+
```ts
38+
const cm = ClientManagement({
39+
parameterStore: new ParameterStore(),
40+
configOverrides: { environment: 'de-miha12' },
41+
});
42+
```
43+
44+
## Commands
45+
46+
### Client Configuration Commands
47+
48+
- [Put Client](#put-client)
49+
- [List Clients](#list-clients)
50+
- [Get Client](#get-client)
51+
- [Delete Client](#delete-client)
52+
53+
#### Put Client
54+
55+
Insert a new client or update an existing one. Omit the `--client-id` option to insert a new client. Include it to update an existing client. Note: the INT and PROD clientIds should be the same ID.
56+
57+
##### Put Client Options
58+
59+
- `--client-id` - the ID of the client to update. (defaults to uuid. Should typically be excluded unless overwriting an existing client)
60+
- `--name` - the display name of the client. Will throw an error if this name is already taken. (required)
61+
- `--mesh-mailbox-id` - the mesh mailbox id for this client.
62+
- `--sender-ods-code` - the ODS code associated with this client. (required if --allow-ods-override is not set)
63+
- `--allow-ods-override` - allow ODS code to be overridden on a per-request basis for this client. (boolean, required if --sender-ods-code is not set)
64+
- `--allow-alternative-contact-details` - allow PDS contact details to be overridden on a per-request basis for this client. (boolean)
65+
- `--unprefixed-name` - does not include the prefix for the name of the citizen in communications.
66+
- `--allow-anonymous-patient` - allow client to send to anonymous patients.
67+
- `--ignore-security-flag` - allow client to send to s-flag patients.
68+
- `--allow-rfr-override` - allow client to send to patients with a Reason for Removal.
69+
- `--allow-rfr-override-codes` - comma separated list of Reason for Removal codes to permit sending of messages to. (zero, one or more of DEA EMB SCT NIT TRA ORR AFL AFN CAN CGA DIS LDN OPA RDI RDR RFI RPR SDL SDN)
70+
- `--apim-id` - the APIM ID, this is optional.
71+
72+
##### Put Client Examples
73+
74+
```bash
75+
pnpm --filter @client-management cli put-client \
76+
--name vaccs \
77+
--mesh-mailbox-id X71803 \
78+
--sender-ods-code X71803 \
79+
--allow-ods-override \
80+
--allow-alternative-contact-details \
81+
--unprefixed-name \
82+
--allow-anonymous-patient \
83+
--ignore-security-flag \
84+
--allow-rfr-override \
85+
--allowRfrOverrideCodes ORR,SCT \
86+
--environment de-cljo1 \
87+
--apim-id 65d68dae-f056-4c17-be03-769fc3b42881
88+
```
89+
90+
```ts
91+
const client = await cm.putClient({
92+
name: 'vaccs',
93+
meshMailboxId: 'X71803',
94+
});
95+
```
96+
97+
#### List Clients
98+
99+
Return a list of all existing clients
100+
101+
##### List Clients Examples
102+
103+
```bash
104+
pnpm --filter @client-management cli list-clients \
105+
--environment de-cljo1
106+
```
107+
108+
```ts
109+
const clients = await cm.listClients();
110+
```
111+
112+
#### Get Client
113+
114+
Return an individual client by clientId
115+
116+
##### Get Client Examples
117+
118+
```bash
119+
pnpm --filter @client-management cli get-client \
120+
--client-id 38a8223e-f92c-490b-8955-3493bd3a08f9 \
121+
--environment de-cljo1
122+
```
123+
124+
```ts
125+
const client = await cm.getClient({
126+
clientId: '38a8223e-f92c-490b-8955-3493bd3a08f9',
127+
});
128+
```
129+
130+
#### Delete Client
131+
132+
Delete an individual client by clientId. If provided, the delete-metadata flag will trigger deletion of all metadata items belonging to the client.
133+
134+
##### Delete Client Examples
135+
136+
```bash
137+
pnpm --filter @client-management cli delete-client \
138+
--client-id 38a8223e-f92c-490b-8955-3493bd3a08f9 \
139+
--environment de-cljo1
140+
```
141+
142+
```ts
143+
const client = await cm.getClientByName({
144+
clientId: '38a8223e-f92c-490b-8955-3493bd3a08f9',
145+
});
146+
```

0 commit comments

Comments
 (0)