Add DnsRecord and ApplicationDeploymentRequest #124

Merged
telackey merged 1 commits from telackey/dns into main 2023-12-07 22:19:11 +00:00
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")