Skip to content

Commit e6abb32

Browse files
authored
feat: adds support for app configuration as a destination (#64)
Signed-off-by: nitish-sudo <[email protected]>
1 parent 3a9c434 commit e6abb32

26 files changed

+1168
-5
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-04T09:44:21Z",
6+
"generated_at": "2025-09-25T01:16:58Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -136,7 +136,7 @@
136136
"hashed_secret": "9bf92274d58c3655b80055ad2ab17540f71d3058",
137137
"is_secret": false,
138138
"is_verified": false,
139-
"line_number": 3290,
139+
"line_number": 3295,
140140
"type": "Secret Keyword",
141141
"verified_result": null
142142
}

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,26 @@ Response<TemplateResponse> ceAppTemplateResponse = eventNotificationsService.cre
664664

665665
For Code Engine template supported template type values: ibmenapp.notification and ibmenjob.notification
666666

667+
#### App Configuration Template
668+
669+
```java
670+
TemplateConfigOneOfAppConfigurationTemplateConfig appConfigTemplateConfig = new TemplateConfigOneOfAppConfigurationTemplateConfig.Builder()
671+
.body("base 64 encoded json content")
672+
.build();
673+
674+
CreateTemplateOptions appConfigTemplateNotificationOptions = new CreateTemplateOptions.Builder()
675+
.instanceId(<instanceId>)
676+
.name(<name>)
677+
.description(<description>)
678+
.type(<template-type>)
679+
.params(appConfigTemplateConfig)
680+
.build();
681+
682+
Response<TemplateResponse> appConfigTemplateResponse = eventNotificationsService.createTemplate(appConfigTemplateNotificationOptions).execute();
683+
```
684+
685+
For App Configuration template supported template type values: app_configuration.notification
686+
667687
### List Templates
668688

669689
```java
@@ -861,6 +881,27 @@ Response<Template> ceAppTemplateResponse = eventNotificationsService.replaceTemp
861881

862882
For Code Engine template supported template type values: ibmenapp.notification and ibmenjob.notification
863883

884+
#### App Configuration Template
885+
886+
```java
887+
TemplateConfigOneOfAppConfigurationTemplateConfig appConfigTemplateConfig = new TemplateConfigOneOfAppConfigurationTemplateConfig.Builder()
888+
.body("base 64 encoded json content")
889+
.build();
890+
891+
ReplaceTemplateOptions appConfigTemplateNotificationOptions = new ReplaceTemplateOptions.Builder()
892+
.instanceId(<instanceId>)
893+
.id(<codeEngineJobTemplateID>)
894+
.name(<name>)
895+
.description(<description>)
896+
.type(<template-type>)
897+
.params(appConfigTemplateConfig)
898+
.build();
899+
900+
Response<Template> appConfigTemplateResponse = eventNotificationsService.replaceTemplate(appConfigTemplateNotificationOptions).execute();
901+
```
902+
903+
For App Configuration template supported template type values: app_configuration.notification
904+
864905
### Delete Template
865906

866907
```java
@@ -943,6 +984,40 @@ Subscription subscription = response.getResult();
943984
System.out.println(subscription);
944985
```
945986

987+
### ⚠️ Special Consideration for App Configuration Destination
988+
989+
When creating or updating a subscription for an **App Configuration** destination, the `attributes` object has a specific rule:
990+
991+
- You must include **either** `feature_flag_enabled` **or** `template_id_notification`
992+
- You **cannot** include both properties together
993+
994+
This ensures that a subscription is created for the correct use case — either **feature flag evaluation** or **notification templating**, but not both at once.
995+
996+
#### ✅ Valid Example (Feature Flag Evaluation)
997+
998+
```java
999+
SubscriptionCreateAttributesAppConfigurationAttributes appConfigCreateAttributes = new SubscriptionCreateAttributesAppConfigurationAttributes.Builder()
1000+
.featureFlagEnabled(true)
1001+
.build();
1002+
```
1003+
1004+
#### ✅ Valid Example (template association)
1005+
1006+
```java
1007+
SubscriptionCreateAttributesAppConfigurationAttributes appConfigUpdateAttributes = new SubscriptionCreateAttributesAppConfigurationAttributes.Builder()
1008+
.templateIdNotification(appConfigTemplateID)
1009+
.build();
1010+
```
1011+
1012+
#### ❌ Invalid Example (Not Allowed)
1013+
1014+
```java
1015+
SubscriptionCreateAttributesAppConfigurationAttributes appConfigUpdateAttributes = new SubscriptionCreateAttributesAppConfigurationAttributes.Builder()
1016+
.featureFlagEnabled(true)
1017+
.templateIdNotification(appConfigTemplateID)
1018+
.build();
1019+
```
1020+
9461021
### List Subscriptions
9471022

9481023
```java
@@ -1436,6 +1511,8 @@ Find `event_notifications.env.hide` in the repo and rename it to `event_notifica
14361511
- `EVENT_NOTIFICATIONS_EVENT_STREAMS_ENDPOINT` - Event streams end point
14371512
- `EVENT_NOTIFICATIONS_CODE_ENGINE_APP_TEMPLATE_BODY` - base 64 encoded json body for Code Engine Application
14381513
- `EVENT_NOTIFICATIONS_CODE_ENGINE_JOB_TEMPLATE_BODY` - base 64 encoded json body for Code Engine Job
1514+
- `EVENT_NOTIFICATIONS_APP_CONFIG_CRN` - CRN of App Configuration instance
1515+
- `EVENT_NOTIFICATIONS_APP_CONFIG_TEMPLATE_BODY` - base 64 encoded json body for App Configuration
14391516

14401517
## Questions
14411518

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public interface Type {
6060
String SMS_CUSTOM = "sms_custom";
6161
/** event_streams. */
6262
String EVENT_STREAMS = "event_streams";
63+
/** app_configuration. */
64+
String APP_CONFIGURATION = "app_configuration";
6365
}
6466

6567
protected String instanceId;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public interface Type {
6060
String SMS_CUSTOM = "sms_custom";
6161
/** event_streams. */
6262
String EVENT_STREAMS = "event_streams";
63+
/** app_configuration. */
64+
String APP_CONFIGURATION = "app_configuration";
6365
}
6466

6567
protected String id;

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* - DestinationConfigOneOfIBMCloudObjectStorageDestinationConfig
3939
* - DestinationConfigOneOfHuaweiDestinationConfig
4040
* - DestinationConfigOneOfEventStreamsDestinationConfig
41+
* - DestinationConfigOneOfAppConfigurationDestinationConfig
4142
*/
4243
public class DestinationConfigOneOf extends GenericModel {
4344

@@ -131,6 +132,10 @@ public interface Type {
131132
protected String endpoint;
132133
protected String crn;
133134
protected String topic;
135+
@SerializedName("environment_id")
136+
protected String environmentId;
137+
@SerializedName("feature_id")
138+
protected String featureId;
134139

135140
protected DestinationConfigOneOf() { }
136141

@@ -566,5 +571,27 @@ public String crn() {
566571
public String topic() {
567572
return topic;
568573
}
574+
575+
/**
576+
* Gets the environmentId.
577+
*
578+
* Environment ID of App Configuration.
579+
*
580+
* @return the environmentId
581+
*/
582+
public String environmentId() {
583+
return environmentId;
584+
}
585+
586+
/**
587+
* Gets the featureId.
588+
*
589+
* Feature ID of App Configuration.
590+
*
591+
* @return the featureId
592+
*/
593+
public String featureId() {
594+
return featureId;
595+
}
569596
}
570597

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2025.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.ibm.cloud.eventnotifications.event_notifications.v1.model;
14+
15+
/**
16+
* Payload describing a App Configuration destination configuration.
17+
*/
18+
public class DestinationConfigOneOfAppConfigurationDestinationConfig extends DestinationConfigOneOf {
19+
20+
/**
21+
* The App Configuration Destination type.
22+
*/
23+
public interface Type {
24+
/** features. */
25+
String FEATURES = "features";
26+
}
27+
28+
29+
/**
30+
* Builder.
31+
*/
32+
public static class Builder {
33+
private String type;
34+
private String crn;
35+
private String environmentId;
36+
private String featureId;
37+
38+
/**
39+
* Instantiates a new Builder from an existing DestinationConfigOneOfAppConfigurationDestinationConfig instance.
40+
*
41+
* @param destinationConfigOneOfAppConfigurationDestinationConfig the instance to initialize the Builder with
42+
*/
43+
public Builder(DestinationConfigOneOf destinationConfigOneOfAppConfigurationDestinationConfig) {
44+
this.type = destinationConfigOneOfAppConfigurationDestinationConfig.type;
45+
this.crn = destinationConfigOneOfAppConfigurationDestinationConfig.crn;
46+
this.environmentId = destinationConfigOneOfAppConfigurationDestinationConfig.environmentId;
47+
this.featureId = destinationConfigOneOfAppConfigurationDestinationConfig.featureId;
48+
}
49+
50+
/**
51+
* Instantiates a new builder.
52+
*/
53+
public Builder() {
54+
}
55+
56+
/**
57+
* Instantiates a new builder with required properties.
58+
*
59+
* @param type the type
60+
* @param crn the crn
61+
* @param environmentId the environmentId
62+
* @param featureId the featureId
63+
*/
64+
public Builder(String type, String crn, String environmentId, String featureId) {
65+
this.type = type;
66+
this.crn = crn;
67+
this.environmentId = environmentId;
68+
this.featureId = featureId;
69+
}
70+
71+
/**
72+
* Builds a DestinationConfigOneOfAppConfigurationDestinationConfig.
73+
*
74+
* @return the new DestinationConfigOneOfAppConfigurationDestinationConfig instance
75+
*/
76+
public DestinationConfigOneOfAppConfigurationDestinationConfig build() {
77+
return new DestinationConfigOneOfAppConfigurationDestinationConfig(this);
78+
}
79+
80+
/**
81+
* Set the type.
82+
*
83+
* @param type the type
84+
* @return the DestinationConfigOneOfAppConfigurationDestinationConfig builder
85+
*/
86+
public Builder type(String type) {
87+
this.type = type;
88+
return this;
89+
}
90+
91+
/**
92+
* Set the crn.
93+
*
94+
* @param crn the crn
95+
* @return the DestinationConfigOneOfAppConfigurationDestinationConfig builder
96+
*/
97+
public Builder crn(String crn) {
98+
this.crn = crn;
99+
return this;
100+
}
101+
102+
/**
103+
* Set the environmentId.
104+
*
105+
* @param environmentId the environmentId
106+
* @return the DestinationConfigOneOfAppConfigurationDestinationConfig builder
107+
*/
108+
public Builder environmentId(String environmentId) {
109+
this.environmentId = environmentId;
110+
return this;
111+
}
112+
113+
/**
114+
* Set the featureId.
115+
*
116+
* @param featureId the featureId
117+
* @return the DestinationConfigOneOfAppConfigurationDestinationConfig builder
118+
*/
119+
public Builder featureId(String featureId) {
120+
this.featureId = featureId;
121+
return this;
122+
}
123+
}
124+
125+
protected DestinationConfigOneOfAppConfigurationDestinationConfig() { }
126+
127+
protected DestinationConfigOneOfAppConfigurationDestinationConfig(Builder builder) {
128+
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type,
129+
"type cannot be null");
130+
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.crn,
131+
"crn cannot be null");
132+
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.environmentId,
133+
"environmentId cannot be null");
134+
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.featureId,
135+
"featureId cannot be null");
136+
type = builder.type;
137+
crn = builder.crn;
138+
environmentId = builder.environmentId;
139+
featureId = builder.featureId;
140+
}
141+
142+
/**
143+
* New builder.
144+
*
145+
* @return a DestinationConfigOneOfAppConfigurationDestinationConfig builder
146+
*/
147+
public Builder newBuilder() {
148+
return new Builder(this);
149+
}
150+
}
151+

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public interface Type {
5959
String SMS_CUSTOM = "sms_custom";
6060
/** event_streams. */
6161
String EVENT_STREAMS = "event_streams";
62+
/** app_configuration. */
63+
String APP_CONFIGURATION = "app_configuration";
6264
}
6365

6466
protected String id;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public interface Type {
5858
String SMS_CUSTOM = "sms_custom";
5959
/** event_streams. */
6060
String EVENT_STREAMS = "event_streams";
61+
/** app_configuration. */
62+
String APP_CONFIGURATION = "app_configuration";
6163
}
6264

6365
protected String id;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public interface DestinationType {
6161
String SMS_CUSTOM = "sms_custom";
6262
/** event_streams. */
6363
String EVENT_STREAMS = "event_streams";
64+
/** app_configuration. */
65+
String APP_CONFIGURATION = "app_configuration";
6466
}
6567

6668
@SerializedName("id")

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* - SubscriptionAttributesServiceNowAttributesResponse
3434
* - SubscriptionAttributesEventStreamsAttributesResponse
3535
* - SubscriptionAttributesCodeEngineAttributesResponse
36+
* - SubscriptionAttributesAppConfigurationAttributesResponse
3637
*/
3738
public class SubscriptionAttributes extends DynamicModel<Object> {
3839

@@ -66,6 +67,8 @@ public class SubscriptionAttributes extends DynamicModel<Object> {
6667
protected String assignedTo;
6768
@SerializedName("assignment_group")
6869
protected String assignmentGroup;
70+
@SerializedName("feature_flag_enabled")
71+
protected Boolean featureFlagEnabled;
6972

7073
protected SubscriptionAttributes() {
7174
super(new TypeToken<Object>() { });
@@ -235,4 +238,15 @@ public String getAssignedTo() {
235238
public String getAssignmentGroup() {
236239
return this.assignmentGroup;
237240
}
241+
242+
/**
243+
* Gets the featureFlagEnabled.
244+
*
245+
* App Configuration enable feature flag attribute.
246+
*
247+
* @return the featureFlagEnabled
248+
*/
249+
public Boolean isFeatureFlagEnabled() {
250+
return this.featureFlagEnabled;
251+
}
238252
}

0 commit comments

Comments
 (0)