Add ApplicationDeploymentRemovalRequests #130

Merged
telackey merged 1 commits from telackey/apprm into main 2023-12-21 21:21:03 +00:00
5 changed files with 1030 additions and 86 deletions

View File

@ -101,6 +101,24 @@ message ApplicationDeploymentRecord {
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message ApplicationDeploymentRemovalRequest {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string version = 2 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string deployment = 3 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
string request = 4 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message ApplicationDeploymentRemovalRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string version = 2 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string deployment = 3 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
string request = 4 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message GeneralRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];

View File

@ -346,7 +346,8 @@ func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) erro
}
}
case "WebsiteRegistrationRecord", "ApplicationRecord", "ApplicationDeploymentRequest",
"ApplicationDeploymentRecord", "ApplicationArtifact", "DnsRecord", "GeneralRecord":
"ApplicationDeploymentRecord", "ApplicationArtifact", "ApplicationDeploymentRemovalRequest",
"ApplicationDeploymentRemovalRecord", "DnsRecord", "GeneralRecord":
{
// #nosec G705
for key := range record.Attributes {

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,18 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&ApplicationArtifact{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.ApplicationDeploymentRemovalRequest",
(*Attributes)(nil),
&ApplicationDeploymentRemovalRequest{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.ApplicationDeploymentRemovalRecord",
(*Attributes)(nil),
&ApplicationDeploymentRemovalRecord{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.DnsRecord",
(*Attributes)(nil),

View File

@ -95,6 +95,24 @@ func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, e
}
return codectypes.NewAnyWithValue(&attributes)
}
case "ApplicationDeploymentRemovalRequest":
{
var attributes ApplicationDeploymentRemovalRequest
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
case "ApplicationDeploymentRemovalRecord":
{
var attributes ApplicationDeploymentRemovalRecord
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
case "ApplicationArtifact":
{
var attributes ApplicationArtifact
@ -228,6 +246,32 @@ func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) {
panic("Proto unmarshal error")
}
bz, err = json.Marshal(attributes)
if err != nil {
panic("JSON marshal error")
}
}
case "ApplicationDeploymentRemovalRequest":
{
var attributes ApplicationDeploymentRemovalRequest
err := proto.Unmarshal(any.Value, &attributes)
if err != nil {
panic("Proto unmarshal error")
}
bz, err = json.Marshal(attributes)
if err != nil {
panic("JSON marshal error")
}
}
case "ApplicationDeploymentRemovalRecord":
{
var attributes ApplicationDeploymentRemovalRecord
err := proto.Unmarshal(any.Value, &attributes)
if err != nil {
panic("Proto unmarshal error")
}
bz, err = json.Marshal(attributes)
if err != nil {
panic("JSON marshal error")