Add DnsRecord and ApplicationDeploymentRequest (#124)
Some checks failed
Pull Request Labeler / triage (push) Successful in 3s
Lint / Run flake8 on python integration tests (push) Failing after 27s
Tests / cleanup-runs (push) Has been skipped
Lint / Run golangci-lint (push) Successful in 3m44s
Tests / test-importer (push) Failing after 1m28s
Tests / sdk_tests (push) Failing after 3m12s
Run Gosec / Gosec (push) Failing after 8m26s
Tests / test-rpc (push) Failing after 5m22s
Tests / test-unit-cover (push) Failing after 8m46s
CodeQL / Analyze (go) (push) Failing after 1m57s

> Note: This has a breaking protobuf change, but that is known and OK, as the previous release has not been deployed externally.

```
message DnsRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string version        = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string resource_type  = 4 [(gogoproto.moretags) = "json:\"resourceType\" yaml:\"resourceType\""];
  string value          = 5 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message ApplicationDeploymentRequest {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string version        = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string application    = 4 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
  string dns            = 5 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
  string config         = 6 [(gogoproto.moretags) = "json:\"config\" yaml:\"config\""];
  repeated string crn   = 7 [(gogoproto.moretags) = "json:\"crn\" yaml:\"crn\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
```

Also rename WebAppDeploymentRecord to ApplicationDeploymentRecord.

Reviewed-on: cerc-io/laconicd#124
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
This commit is contained in:
Thomas E Lackey 2023-12-07 22:19:10 +00:00 committed by Thomas E Lackey
parent 880367d5df
commit 47d086111d
5 changed files with 1402 additions and 135 deletions

View File

@ -41,7 +41,7 @@ message ApplicationRecord {
string license = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""]; string license = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
string author = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""]; string author = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""]; string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""]; string repository_ref = 9 [(gogoproto.moretags) = "json:\"repositoryRef\" yaml:\"repositoryRef\""];
string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""]; string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""]; string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
string engines = 12 [(gogoproto.moretags) = "json:\"engines\" yaml:\"engines\""]; string engines = 12 [(gogoproto.moretags) = "json:\"engines\" yaml:\"engines\""];
@ -51,13 +51,37 @@ message ApplicationRecord {
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""]; repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
} }
message WebAppDeploymentRecord { message DnsRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string version = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string resource_type = 4 [(gogoproto.moretags) = "json:\"resourceType\" yaml:\"resourceType\""];
string value = 5 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message ApplicationDeploymentRequest {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string version = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string application = 4 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
string dns = 5 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
string config = 6 [(gogoproto.moretags) = "json:\"config\" yaml:\"config\""];
repeated string crn = 7 [(gogoproto.moretags) = "json:\"crn\" yaml:\"crn\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message ApplicationDeploymentRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""]; string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""]; string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string application = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""]; string application = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
string url = 6 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""]; string url = 6 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""];
string dns = 7 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
string request = 8 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""]; string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""]; repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
} }
@ -72,3 +96,4 @@ message GeneralRecord {
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""]; string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""]; repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -58,9 +58,21 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
) )
registry.RegisterInterface( registry.RegisterInterface(
"vulcanize.registry.v1beta1.WebAppDeploymentRecord", "vulcanize.registry.v1beta1.ApplicationDeploymentRequest",
(*Attributes)(nil), (*Attributes)(nil),
&WebAppDeploymentRecord{}, &ApplicationDeploymentRequest{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.ApplicationDeploymentRecord",
(*Attributes)(nil),
&ApplicationDeploymentRecord{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.DnsRecord",
(*Attributes)(nil),
&DnsRecord{},
) )
registry.RegisterInterface( registry.RegisterInterface(

View File

@ -77,9 +77,27 @@ func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, e
} }
return codectypes.NewAnyWithValue(&attributes) return codectypes.NewAnyWithValue(&attributes)
} }
case "WebAppDeploymentRecord": case "ApplicationDeploymentRequest":
{ {
var attributes WebAppDeploymentRecord var attributes ApplicationDeploymentRequest
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
case "ApplicationDeploymentRecord":
{
var attributes ApplicationDeploymentRecord
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
case "DnsRecord":
{
var attributes DnsRecord
err := json.Unmarshal(bz, &attributes) err := json.Unmarshal(bz, &attributes)
if err != nil { if err != nil {
return &codectypes.Any{}, err return &codectypes.Any{}, err
@ -180,9 +198,35 @@ func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) {
panic("JSON marshal error") panic("JSON marshal error")
} }
} }
case "WebAppDeploymentRecord": case "ApplicationDeploymentRequest":
{ {
var attributes WebAppDeploymentRecord var attributes ApplicationDeploymentRequest
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 "ApplicationDeploymentRecord":
{
var attributes ApplicationDeploymentRecord
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 "DnsRecord":
{
var attributes DnsRecord
err := proto.Unmarshal(any.Value, &attributes) err := proto.Unmarshal(any.Value, &attributes)
if err != nil { if err != nil {
panic("Proto unmarshal error") panic("Proto unmarshal error")