Skip to content

Commit 7ceb5a8

Browse files
authored
chore: support for clone smtp user credentials (#66)
Signed-off-by: nitish <[email protected]>
1 parent d71b511 commit 7ceb5a8

File tree

9 files changed

+141
-29
lines changed

9 files changed

+141
-29
lines changed

.secrets.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-09-25T01:16:58Z",
6+
"generated_at": "2025-10-28T04:20:32Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -142,7 +142,7 @@
142142
}
143143
]
144144
},
145-
"version": "0.13.1+ibm.62.dss",
145+
"version": "0.13.1+ibm.64.dss",
146146
"word_list": {
147147
"file": null,
148148
"hash": null

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ SDK Methods to consume
157157
- [SMTP Configurations](#SMTPConfigurations)
158158
- [Create SMTP Configuration](#create-smtp-configuration)
159159
- [Create SMTP User](#create-smtp-user)
160+
- [Clone SMTP User](#clone-smtp-user)
160161
- [Get SMTP Configuration](#get-smtp-configuration)
161162
- [Get SMTP User](#get-smtp-user)
162163
- [Get SMTP Allowed Ips](#get-smtp-allowed-ips)
@@ -1193,6 +1194,21 @@ SMTPUserResponse responseObj = response.getResult();
11931194

11941195
```
11951196

1197+
### Clone SMTP User
1198+
1199+
```java
1200+
1201+
CreateSmtpUserOptions createSmtpUserOptionsModel = new CreateSmtpUserOptions.Builder()
1202+
.instanceId(<instanceId>)
1203+
.id(<smtpConfigID>)
1204+
.usernameToClone(<smtpUserToClone>)
1205+
.build();
1206+
1207+
Response<SMTPUserResponse> response = eventNotificationsService.createSmtpUser(createSmtpUserOptionsModel).execute();
1208+
SMTPUserResponse responseObj = response.getResult();
1209+
1210+
```
1211+
11961212
### Get SMTP Configuration
11971213

11981214
```java
@@ -1513,6 +1529,7 @@ Find `event_notifications.env.hide` in the repo and rename it to `event_notifica
15131529
- `EVENT_NOTIFICATIONS_CODE_ENGINE_JOB_TEMPLATE_BODY` - base 64 encoded json body for Code Engine Job
15141530
- `EVENT_NOTIFICATIONS_APP_CONFIG_CRN` - CRN of App Configuration instance
15151531
- `EVENT_NOTIFICATIONS_APP_CONFIG_TEMPLATE_BODY` - base 64 encoded json body for App Configuration
1532+
- `EVENT_NOTIFICATIONS_SMTP_USER_TO_CLONE` - SMTP username to be cloned
15161533

15171534
## Questions
15181535

modules/event-notifications/src/main/java/com/ibm/cloud/eventnotifications/event_notifications/v1/EventNotifications.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,9 @@ public ServiceCall<SMTPUserResponse> createSmtpUser(CreateSmtpUserOptions create
15001500
builder.header(header.getKey(), header.getValue());
15011501
}
15021502
builder.header("Accept", "application/json");
1503+
if (createSmtpUserOptions.usernameToClone() != null) {
1504+
builder.query("username_to_clone", String.valueOf(createSmtpUserOptions.usernameToClone()));
1505+
}
15031506
final JsonObject contentJson = new JsonObject();
15041507
if (createSmtpUserOptions.description() != null) {
15051508
contentJson.addProperty("description", createSmtpUserOptions.description());

modules/event-notifications/src/main/java/com/ibm/cloud/eventnotifications/event_notifications/v1/model/CreateSmtpUserOptions.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class CreateSmtpUserOptions extends GenericModel {
2222
protected String instanceId;
2323
protected String id;
2424
protected String description;
25+
protected String usernameToClone;
2526

2627
/**
2728
* Builder.
@@ -30,6 +31,7 @@ public static class Builder {
3031
private String instanceId;
3132
private String id;
3233
private String description;
34+
private String usernameToClone;
3335

3436
/**
3537
* Instantiates a new Builder from an existing CreateSmtpUserOptions instance.
@@ -40,6 +42,7 @@ private Builder(CreateSmtpUserOptions createSmtpUserOptions) {
4042
this.instanceId = createSmtpUserOptions.instanceId;
4143
this.id = createSmtpUserOptions.id;
4244
this.description = createSmtpUserOptions.description;
45+
this.usernameToClone = createSmtpUserOptions.usernameToClone;
4346
}
4447

4548
/**
@@ -100,6 +103,17 @@ public Builder description(String description) {
100103
this.description = description;
101104
return this;
102105
}
106+
107+
/**
108+
* Set the usernameToClone.
109+
*
110+
* @param usernameToClone the usernameToClone
111+
* @return the CreateSmtpUserOptions builder
112+
*/
113+
public Builder usernameToClone(String usernameToClone) {
114+
this.usernameToClone = usernameToClone;
115+
return this;
116+
}
103117
}
104118

105119
protected CreateSmtpUserOptions() { }
@@ -112,6 +126,7 @@ protected CreateSmtpUserOptions(Builder builder) {
112126
instanceId = builder.instanceId;
113127
id = builder.id;
114128
description = builder.description;
129+
usernameToClone = builder.usernameToClone;
115130
}
116131

117132
/**
@@ -155,5 +170,16 @@ public String id() {
155170
public String description() {
156171
return description;
157172
}
173+
174+
/**
175+
* Gets the usernameToClone.
176+
*
177+
* provide name of the user to clone.
178+
*
179+
* @return the usernameToClone
180+
*/
181+
public String usernameToClone() {
182+
return usernameToClone;
183+
}
158184
}
159185

modules/event-notifications/src/main/java/com/ibm/cloud/eventnotifications/event_notifications/v1/model/SMTPUserResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public String getUsername() {
9292
/**
9393
* Gets the password.
9494
*
95-
* password.
95+
* Password for SMTP user; Cloned SMTP user response do not include a password.
9696
*
9797
* @return the password
9898
*/

0 commit comments

Comments
 (0)