Skip to content

Commit

Permalink
flatten protos and update backend and frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Nov 5, 2024
1 parent 34ddeea commit 9dfbfc5
Show file tree
Hide file tree
Showing 18 changed files with 838 additions and 1,148 deletions.
1,131 changes: 531 additions & 600 deletions backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go

Large diffs are not rendered by default.

44 changes: 18 additions & 26 deletions backend/protos/mgmt/v1alpha1/transformer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -517,37 +517,29 @@ message GetTransformPiiEntitiesResponse {

message GenerateBusinessName {}

enum GenerateIpAddressVersion {
enum GenerateIpAddressType {
// Unspecified defaults to ipv4
GENERATE_IP_ADDRESS_VERSION_UNSPECIFIED = 0;
// Generates a random ipv4
GENERATE_IP_ADDRESS_VERSION_V4 = 1;
GENERATE_IP_ADDRESS_TYPE_UNSPECIFIED = 0;
// Generates a random ipv4_public
GENERATE_IP_ADDRESS_TYPE_V4_PUBLIC = 1;
// Generates a random ipv4_private_a
GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_A = 2;
// Generates a random ipv4_private_b
GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_B = 3;
// Generates a random ipv4_private_c
GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_C = 4;
// Generates a random ipv4_linklocal
GENERATE_IP_ADDRESS_TYPE_V4_LINK_LOCAL = 5;
// Generates a random ipv4_multicast
GENERATE_IP_ADDRESS_TYPE_V4_MULTICAST = 6;
// Generates a random ipv4_loopback
GENERATE_IP_ADDRESS_TYPE_V4_LOOPBACK = 7;
// Generates a random ipv6
GENERATE_IP_ADDRESS_VERSION_V6 = 2;
}

enum GenerateIpAddressClass {
// Unspecified defaults to public
GENERATE_IP_ADDRESS_CLASS_UNSPECIFIED = 0;
// Generates a random ipv4 public address
GENERATE_IP_ADDRESS_CLASS_PUBLIC = 1;
// Generates a random ipv4 private-a ip address
GENERATE_IP_ADDRESS_CLASS_PRIVATE_A = 2;
// Generates a random ipv4 private-b ip address
GENERATE_IP_ADDRESS_CLASS_PRIVATE_B = 3;
// Generates a random ipv4 private-c ip address
GENERATE_IP_ADDRESS_CLASS_PRIVATE_C = 4;
// Generates a random ipv4 link-local ip address
GENERATE_IP_ADDRESS_CLASS_LINK_LOCAL = 5;
// Generates a random ipv4 multicast ip address
GENERATE_IP_ADDRESS_CLASS_MULTICAST = 6;
// Generates a random ipv4 loopback address
GENERATE_IP_ADDRESS_CLASS_LOOPBACK = 7;
GENERATE_IP_ADDRESS_TYPE_V6 = 8;
}

message GenerateIpAddress {
optional GenerateIpAddressVersion version = 1;
optional GenerateIpAddressClass class = 2;
optional GenerateIpAddressType ip_type = 1;
}

service TransformersService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ var (

defaultInvalidEmailAction = mgmtv1alpha1.InvalidEmailAction_INVALID_EMAIL_ACTION_REJECT

defaultGeneratePublicIp = mgmtv1alpha1.GenerateIpAddressClass_GENERATE_IP_ADDRESS_CLASS_PUBLIC

defaultGenerateIpv4 = mgmtv1alpha1.GenerateIpAddressVersion_GENERATE_IP_ADDRESS_VERSION_V4
defaultGenerateIpv4 = mgmtv1alpha1.GenerateIpAddressType_GENERATE_IP_ADDRESS_TYPE_V4_PUBLIC

// base transformers
baseSystemTransformers = []*mgmtv1alpha1.SystemTransformer{
Expand Down Expand Up @@ -653,8 +651,7 @@ var (
Config: &mgmtv1alpha1.TransformerConfig{
Config: &mgmtv1alpha1.TransformerConfig_GenerateIpAddressConfig{
GenerateIpAddressConfig: &mgmtv1alpha1.GenerateIpAddress{
Class: &defaultGeneratePublicIp,
Version: &defaultGenerateIpv4,
IpType: &defaultGenerateIpv4,
},
},
},
Expand Down
9 changes: 3 additions & 6 deletions backend/sql/postgresql/models/transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ type GenerateCountryConfig struct {
type GenerateBusinessNameConfig struct{}

type GenerateIpAddressConfig struct {
Version *int32 `json:"version,omitempty"`
Class *int32 `json:"class,omitempty"`
IpType *int32 `json:"ipType,omitempty"`
}

func (t *JobMappingTransformerModel) FromTransformerDto(tr *mgmtv1alpha1.JobMappingTransformer) error {
Expand Down Expand Up @@ -387,8 +386,7 @@ func (t *TransformerConfig) FromTransformerConfigDto(tr *mgmtv1alpha1.Transforme
t.GenerateBusinessName = &GenerateBusinessNameConfig{}
case *mgmtv1alpha1.TransformerConfig_GenerateIpAddressConfig:
t.GenerateIpAddress = &GenerateIpAddressConfig{
Class: (*int32)(tr.GetGenerateIpAddressConfig().Class),
Version: (*int32)(tr.GetGenerateIpAddressConfig().Version),
IpType: (*int32)(tr.GetGenerateIpAddressConfig().IpType),
}
default:
t = &TransformerConfig{}
Expand Down Expand Up @@ -740,8 +738,7 @@ func (t *TransformerConfig) ToTransformerConfigDto() *mgmtv1alpha1.TransformerCo
return &mgmtv1alpha1.TransformerConfig{
Config: &mgmtv1alpha1.TransformerConfig_GenerateIpAddressConfig{
GenerateIpAddressConfig: &mgmtv1alpha1.GenerateIpAddress{
Class: (*mgmtv1alpha1.GenerateIpAddressClass)(t.GenerateIpAddress.Class),
Version: (*mgmtv1alpha1.GenerateIpAddressVersion)(t.GenerateIpAddress.Version),
IpType: (*mgmtv1alpha1.GenerateIpAddressType)(t.GenerateIpAddress.IpType),
},
},
}
Expand Down
56 changes: 23 additions & 33 deletions docs/openapi/mgmt/v1alpha1/anonymization.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,19 @@ components:
- GENERATE_EMAIL_TYPE_UNSPECIFIED
- GENERATE_EMAIL_TYPE_UUID_V4
- GENERATE_EMAIL_TYPE_FULLNAME
mgmt.v1alpha1.GenerateIpAddressClass:
mgmt.v1alpha1.GenerateIpAddressType:
type: string
title: GenerateIpAddressClass
title: GenerateIpAddressType
enum:
- GENERATE_IP_ADDRESS_CLASS_UNSPECIFIED
- GENERATE_IP_ADDRESS_CLASS_PUBLIC
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_A
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_B
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_C
- GENERATE_IP_ADDRESS_CLASS_LINK_LOCAL
- GENERATE_IP_ADDRESS_CLASS_MULTICAST
- GENERATE_IP_ADDRESS_CLASS_LOOPBACK
mgmt.v1alpha1.GenerateIpAddressVersion:
type: string
title: GenerateIpAddressVersion
enum:
- GENERATE_IP_ADDRESS_VERSION_UNSPECIFIED
- GENERATE_IP_ADDRESS_VERSION_V4
- GENERATE_IP_ADDRESS_VERSION_V6
- GENERATE_IP_ADDRESS_TYPE_UNSPECIFIED
- GENERATE_IP_ADDRESS_TYPE_V4_PUBLIC
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_A
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_B
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_C
- GENERATE_IP_ADDRESS_TYPE_V4_LINK_LOCAL
- GENERATE_IP_ADDRESS_TYPE_V4_MULTICAST
- GENERATE_IP_ADDRESS_TYPE_V4_LOOPBACK
- GENERATE_IP_ADDRESS_TYPE_V6
mgmt.v1alpha1.InvalidEmailAction:
type: string
title: InvalidEmailAction
Expand Down Expand Up @@ -552,27 +546,23 @@ components:
allOf:
- anyOf:
- required:
- class
- not:
anyOf:
- required:
- class
- anyOf:
- required:
- version
- ipType
- not:
anyOf:
- required:
- version
- ipType
anyOf:
- required:
- ipType
- not:
anyOf:
- required:
- ipType
properties:
version:
allOf:
- title: version
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressVersion'
class:
ipType:
allOf:
- title: class
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressClass'
- title: ip_type
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressType'
title: GenerateIpAddress
additionalProperties: false
mgmt.v1alpha1.GenerateJavascript:
Expand Down
56 changes: 23 additions & 33 deletions docs/openapi/mgmt/v1alpha1/job.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1024,25 +1024,19 @@ components:
- GENERATE_EMAIL_TYPE_UNSPECIFIED
- GENERATE_EMAIL_TYPE_UUID_V4
- GENERATE_EMAIL_TYPE_FULLNAME
mgmt.v1alpha1.GenerateIpAddressClass:
mgmt.v1alpha1.GenerateIpAddressType:
type: string
title: GenerateIpAddressClass
title: GenerateIpAddressType
enum:
- GENERATE_IP_ADDRESS_CLASS_UNSPECIFIED
- GENERATE_IP_ADDRESS_CLASS_PUBLIC
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_A
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_B
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_C
- GENERATE_IP_ADDRESS_CLASS_LINK_LOCAL
- GENERATE_IP_ADDRESS_CLASS_MULTICAST
- GENERATE_IP_ADDRESS_CLASS_LOOPBACK
mgmt.v1alpha1.GenerateIpAddressVersion:
type: string
title: GenerateIpAddressVersion
enum:
- GENERATE_IP_ADDRESS_VERSION_UNSPECIFIED
- GENERATE_IP_ADDRESS_VERSION_V4
- GENERATE_IP_ADDRESS_VERSION_V6
- GENERATE_IP_ADDRESS_TYPE_UNSPECIFIED
- GENERATE_IP_ADDRESS_TYPE_V4_PUBLIC
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_A
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_B
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_C
- GENERATE_IP_ADDRESS_TYPE_V4_LINK_LOCAL
- GENERATE_IP_ADDRESS_TYPE_V4_MULTICAST
- GENERATE_IP_ADDRESS_TYPE_V4_LOOPBACK
- GENERATE_IP_ADDRESS_TYPE_V6
mgmt.v1alpha1.InvalidEmailAction:
type: string
title: InvalidEmailAction
Expand Down Expand Up @@ -2096,27 +2090,23 @@ components:
allOf:
- anyOf:
- required:
- class
- not:
anyOf:
- required:
- class
- anyOf:
- required:
- version
- ipType
- not:
anyOf:
- required:
- version
- ipType
anyOf:
- required:
- ipType
- not:
anyOf:
- required:
- ipType
properties:
version:
allOf:
- title: version
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressVersion'
class:
ipType:
allOf:
- title: class
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressClass'
- title: ip_type
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressType'
title: GenerateIpAddress
additionalProperties: false
mgmt.v1alpha1.GenerateJavascript:
Expand Down
56 changes: 23 additions & 33 deletions docs/openapi/mgmt/v1alpha1/transformer.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,25 +398,19 @@ components:
- GENERATE_EMAIL_TYPE_UNSPECIFIED
- GENERATE_EMAIL_TYPE_UUID_V4
- GENERATE_EMAIL_TYPE_FULLNAME
mgmt.v1alpha1.GenerateIpAddressClass:
mgmt.v1alpha1.GenerateIpAddressType:
type: string
title: GenerateIpAddressClass
title: GenerateIpAddressType
enum:
- GENERATE_IP_ADDRESS_CLASS_UNSPECIFIED
- GENERATE_IP_ADDRESS_CLASS_PUBLIC
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_A
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_B
- GENERATE_IP_ADDRESS_CLASS_PRIVATE_C
- GENERATE_IP_ADDRESS_CLASS_LINK_LOCAL
- GENERATE_IP_ADDRESS_CLASS_MULTICAST
- GENERATE_IP_ADDRESS_CLASS_LOOPBACK
mgmt.v1alpha1.GenerateIpAddressVersion:
type: string
title: GenerateIpAddressVersion
enum:
- GENERATE_IP_ADDRESS_VERSION_UNSPECIFIED
- GENERATE_IP_ADDRESS_VERSION_V4
- GENERATE_IP_ADDRESS_VERSION_V6
- GENERATE_IP_ADDRESS_TYPE_UNSPECIFIED
- GENERATE_IP_ADDRESS_TYPE_V4_PUBLIC
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_A
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_B
- GENERATE_IP_ADDRESS_TYPE_V4_PRIVATE_C
- GENERATE_IP_ADDRESS_TYPE_V4_LINK_LOCAL
- GENERATE_IP_ADDRESS_TYPE_V4_MULTICAST
- GENERATE_IP_ADDRESS_TYPE_V4_LOOPBACK
- GENERATE_IP_ADDRESS_TYPE_V6
mgmt.v1alpha1.InvalidEmailAction:
type: string
title: InvalidEmailAction
Expand Down Expand Up @@ -928,27 +922,23 @@ components:
allOf:
- anyOf:
- required:
- class
- not:
anyOf:
- required:
- class
- anyOf:
- required:
- version
- ipType
- not:
anyOf:
- required:
- version
- ipType
anyOf:
- required:
- ipType
- not:
anyOf:
- required:
- ipType
properties:
version:
allOf:
- title: version
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressVersion'
class:
ipType:
allOf:
- title: class
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressClass'
- title: ip_type
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddressType'
title: GenerateIpAddress
additionalProperties: false
mgmt.v1alpha1.GenerateJavascript:
Expand Down
Loading

0 comments on commit 9dfbfc5

Please sign in to comment.