-
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 (#236)
* chore: add support to delete system label application rule * fix build failure * address review comments --------- Co-authored-by: saxenakshitiz <[email protected]>
- Loading branch information
1 parent
834e663
commit b5cf2f4
Showing
11 changed files
with
196 additions
and
29 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; | ||
|
||
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
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
...label/application/rule/config/service/impl/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; | ||
|
||
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