-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add support to delete system label application rule
- Loading branch information
saxenakshitiz
committed
Sep 2, 2024
1 parent
834e663
commit 84fee07
Showing
10 changed files
with
195 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ertrace/label/application/rule/config/service/DeletedSystemLabelApplicationRuleStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.hypertrace.label.application.rule.config.service; | ||
|
||
import com.google.protobuf.Value; | ||
import java.util.Optional; | ||
import lombok.SneakyThrows; | ||
import org.hypertrace.config.objectstore.IdentifiedObjectStore; | ||
import org.hypertrace.config.proto.converter.ConfigProtoConverter; | ||
import org.hypertrace.config.service.change.event.api.ConfigChangeEventGenerator; | ||
import org.hypertrace.config.service.v1.ConfigServiceGrpc.ConfigServiceBlockingStub; | ||
import org.hypertrace.label.application.rule.config.service.impl.v1.DeletedSystemLabelApplicationRule; | ||
|
||
public class DeletedSystemLabelApplicationRuleStore | ||
extends IdentifiedObjectStore<DeletedSystemLabelApplicationRule> { | ||
|
||
private static final String DELETED_SYSTEM_LABEL_APPLICATION_RULE_CONFIG_RESOURCE_NAME = | ||
"deleted-system-label-application-rule-config"; | ||
private static final String LABEL_APPLICATION_RULE_CONFIG_RESOURCE_NAMESPACE = "labels"; | ||
|
||
DeletedSystemLabelApplicationRuleStore( | ||
ConfigServiceBlockingStub stub, ConfigChangeEventGenerator configChangeEventGenerator) { | ||
super( | ||
stub, | ||
LABEL_APPLICATION_RULE_CONFIG_RESOURCE_NAMESPACE, | ||
DELETED_SYSTEM_LABEL_APPLICATION_RULE_CONFIG_RESOURCE_NAME, | ||
configChangeEventGenerator); | ||
} | ||
|
||
@Override | ||
protected Optional<DeletedSystemLabelApplicationRule> buildDataFromValue(Value value) { | ||
try { | ||
DeletedSystemLabelApplicationRule.Builder builder = | ||
DeletedSystemLabelApplicationRule.newBuilder(); | ||
ConfigProtoConverter.mergeFromValue(value, builder); | ||
return Optional.of(builder.build()); | ||
} catch (Exception e) { | ||
return Optional.empty(); | ||
} | ||
} | ||
|
||
@SneakyThrows | ||
@Override | ||
protected Value buildValueFromData(DeletedSystemLabelApplicationRule object) { | ||
return ConfigProtoConverter.convertToValue(object); | ||
} | ||
|
||
@Override | ||
protected String getContextFromData(DeletedSystemLabelApplicationRule object) { | ||
return object.getId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
label-application-rule-config-service-impl/src/main/proto/buf.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: v1 | ||
breaking: | ||
use: | ||
- PACKAGE | ||
- WIRE_JSON | ||
lint: | ||
use: | ||
- DEFAULT |
9 changes: 9 additions & 0 deletions
9
...race/label/application/rule/config/service/v1/deleted_system_label_application_rule.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
syntax="proto3"; | ||
|
||
package org.hypertrace.label.application.rule.config.service.impl.v1; | ||
Check failure on line 3 in label-application-rule-config-service-impl/src/main/proto/org/hypertrace/label/application/rule/config/service/v1/deleted_system_label_application_rule.proto GitHub Actions / validate-protos
|
||
|
||
option java_multiple_files = true; | ||
|
||
message DeletedSystemLabelApplicationRule { | ||
string id = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters