From 2c76f7b8730f6fdfd8e7aef19f5aed3b4258ed7a Mon Sep 17 00:00:00 2001 From: Murad Biashimov Date: Mon, 26 May 2025 10:55:29 +0200 Subject: [PATCH] fix: kafka native acl enum duplicates --- generator/main.go | 3 +- generator/models.go | 21 ++++--- handler/domain/domain.go | 28 +++------ handler/kafka/kafka.go | 76 ++++++++++------------- handler/vpc/vpc.go | 131 ++++++++++++++++++++++----------------- 5 files changed, 128 insertions(+), 131 deletions(-) diff --git a/generator/main.go b/generator/main.go index c03e001..68df916 100644 --- a/generator/main.go +++ b/generator/main.go @@ -11,6 +11,7 @@ import ( "os" "path/filepath" "regexp" + "slices" "sort" "strconv" "strings" @@ -22,7 +23,6 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/exp/maps" - "golang.org/x/exp/slices" "gopkg.in/yaml.v3" ) @@ -422,7 +422,6 @@ func exec() error { } dirPath := filepath.Join(cfg.HandlerDir, fileName) - err = os.MkdirAll(dirPath, dirMode) if err != nil { return err diff --git a/generator/models.go b/generator/models.go index 91de59d..71de0dc 100644 --- a/generator/models.go +++ b/generator/models.go @@ -316,12 +316,9 @@ func (s *Schema) init(doc *Doc, scope map[string]*Schema, name string) { } if s.isObject() || s.isEnum() { //nolint:nestif - for s.parent != nil { - v, ok := scope[s.CamelName] - if !ok { - break - } - + v, ok := scope[s.CamelName] + // Takes parent's name to resolve name collision + if ok { if v.hash() == s.hash() { v.duplicates = append(v.duplicates, s) return @@ -337,7 +334,11 @@ func (s *Schema) init(doc *Doc, scope map[string]*Schema, name string) { if parent.isPrivate() { s.CamelName = customCamelCase(parent.CamelName) } else { - s.CamelName = strings.TrimSuffix(customCamelCase(parent.CamelName), suffix) + s.CamelName + // Adds parent's name + s.CamelName = strings.TrimSuffix(parent.CamelName, suffix) + s.CamelName + if s.isEnum() { + s.CamelName = dedupCamelName(cleanEnumName.ReplaceAllString(s.CamelName, "")) + } } // Marks all have collision @@ -487,9 +488,8 @@ func getType(s *Schema) *jen.Statement { } else if s.name == "tags" { // tags are everywhere in the schema, better not to use the patch return a.String() - } else { - return a.Any() } + return a.Any() default: panic(fmt.Errorf("unknown type %q for %q and parent %q", s.Type, s.name, s.parent.name)) } @@ -522,7 +522,7 @@ func sortedKeys[T any](m map[string]T) []string { return keys } -var cleanEnumName = regexp.MustCompile("(Create|Get|Update|Delete|Stop|Cancel|Verify|Put)") +var cleanEnumName = regexp.MustCompile("(Create|Get|Update|Delete|Stop|Cancel|Verify|Put|Add)") // getEnumName enum can't have just "state" name, drills to the root until finds something func getEnumName(s *Schema) string { @@ -538,6 +538,7 @@ func getEnumName(s *Schema) string { var camelFinder = regexp.MustCompile("[A-Z]+[a-z]+") +// dedupCamelName removes duplicates: KafkaAclKafkaAcl -> KafkaAcl func dedupCamelName(src string) string { result := make([]string, 0) for _, s := range camelFinder.FindAllString(src, -1) { diff --git a/handler/domain/domain.go b/handler/domain/domain.go index 5a5f93e..a802263 100644 --- a/handler/domain/domain.go +++ b/handler/domain/domain.go @@ -138,27 +138,15 @@ type OrganizationDomainAddIn struct { // OrganizationDomainAddOut OrganizationDomainAddResponse type OrganizationDomainAddOut struct { - ChallengeToken string `json:"challenge_token"` // Random string to be used for validation - CreateTime time.Time `json:"create_time"` // Time of creating the domain - DomainId string `json:"domain_id"` // ID of the domain - DomainName string `json:"domain_name"` // Name of the domain - LinkedAuthenticationMethodIds []string `json:"linked_authentication_method_ids"` // Linked Authentication Method Ids - OrganizationId string `json:"organization_id"` // ID of the organization owning this domain - State OrganizationDomainAddStateType `json:"state"` // An enumeration. - VerificationType VerificationType `json:"verification_type"` // An enumeration. -} -type OrganizationDomainAddStateType string - -const ( - OrganizationDomainAddStateTypeDeleted OrganizationDomainAddStateType = "deleted" - OrganizationDomainAddStateTypeUnverified OrganizationDomainAddStateType = "unverified" - OrganizationDomainAddStateTypeVerified OrganizationDomainAddStateType = "verified" -) - -func OrganizationDomainAddStateTypeChoices() []string { - return []string{"deleted", "unverified", "verified"} + ChallengeToken string `json:"challenge_token"` // Random string to be used for validation + CreateTime time.Time `json:"create_time"` // Time of creating the domain + DomainId string `json:"domain_id"` // ID of the domain + DomainName string `json:"domain_name"` // Name of the domain + LinkedAuthenticationMethodIds []string `json:"linked_authentication_method_ids"` // Linked Authentication Method Ids + OrganizationId string `json:"organization_id"` // ID of the organization owning this domain + State OrganizationDomainStateType `json:"state"` // An enumeration. + VerificationType VerificationType `json:"verification_type"` // An enumeration. } - type OrganizationDomainStateType string const ( diff --git a/handler/kafka/kafka.go b/handler/kafka/kafka.go index 0a66a2d..6aeb169 100644 --- a/handler/kafka/kafka.go +++ b/handler/kafka/kafka.go @@ -382,57 +382,37 @@ type ServiceKafkaAclAddIn struct { // ServiceKafkaNativeAclAddIn ServiceKafkaNativeAclAddRequestBody type ServiceKafkaNativeAclAddIn struct { - Host *string `json:"host,omitempty"` // the host or * for all hosts - Operation OperationType `json:"operation"` // Kafka ACL operation represents an operation which an ACL grants or denies permission to perform - PatternType PatternType `json:"pattern_type"` // Kafka ACL pattern type of resource name - PermissionType ServiceKafkaNativeAclAddPermissionType `json:"permission_type"` // Kafka ACL permission type - Principal string `json:"principal"` // principal is in 'PrincipalType:name' format - ResourceName string `json:"resource_name"` // Resource pattern used to match specified resources - ResourceType ResourceType `json:"resource_type"` // Kafka ACL resource type represents a type of resource which an ACL can be applied to + Host *string `json:"host,omitempty"` // the host or * for all hosts + Operation OperationType `json:"operation"` // Kafka ACL operation represents an operation which an ACL grants or denies permission to perform + PatternType PatternType `json:"pattern_type"` // Kafka ACL pattern type of resource name + PermissionType ServiceKafkaNativeAclPermissionType `json:"permission_type"` // Kafka ACL permission type + Principal string `json:"principal"` // principal is in 'PrincipalType:name' format + ResourceName string `json:"resource_name"` // Resource pattern used to match specified resources + ResourceType ResourceType `json:"resource_type"` // Kafka ACL resource type represents a type of resource which an ACL can be applied to } // ServiceKafkaNativeAclAddOut Kafka-native ACL entry for Kafka service type ServiceKafkaNativeAclAddOut struct { - Host string `json:"host"` // the host or * for all hosts - Id string `json:"id"` // ID - Operation OperationType `json:"operation"` // Kafka ACL operation represents an operation which an ACL grants or denies permission to perform - PatternType PatternType `json:"pattern_type"` // Kafka ACL pattern type of resource name - PermissionType ServiceKafkaNativeAclAddPermissionType `json:"permission_type"` // Kafka ACL permission type - Principal string `json:"principal"` // principal is in 'principalType:name' format - ResourceName string `json:"resource_name"` // Resource pattern used to match specified resources - ResourceType ResourceType `json:"resource_type"` // Kafka ACL resource type represents a type of resource which an ACL can be applied to -} -type ServiceKafkaNativeAclAddPermissionType string - -const ( - ServiceKafkaNativeAclAddPermissionTypeAllow ServiceKafkaNativeAclAddPermissionType = "ALLOW" - ServiceKafkaNativeAclAddPermissionTypeDeny ServiceKafkaNativeAclAddPermissionType = "DENY" -) - -func ServiceKafkaNativeAclAddPermissionTypeChoices() []string { - return []string{"ALLOW", "DENY"} + Host string `json:"host"` // the host or * for all hosts + Id string `json:"id"` // ID + Operation OperationType `json:"operation"` // Kafka ACL operation represents an operation which an ACL grants or denies permission to perform + PatternType PatternType `json:"pattern_type"` // Kafka ACL pattern type of resource name + PermissionType ServiceKafkaNativeAclPermissionType `json:"permission_type"` // Kafka ACL permission type + Principal string `json:"principal"` // principal is in 'principalType:name' format + ResourceName string `json:"resource_name"` // Resource pattern used to match specified resources + ResourceType ResourceType `json:"resource_type"` // Kafka ACL resource type represents a type of resource which an ACL can be applied to } // ServiceKafkaNativeAclGetOut Kafka-native ACL entry for Kafka service type ServiceKafkaNativeAclGetOut struct { - Host string `json:"host"` // the host or * for all hosts - Id string `json:"id"` // ID - Operation OperationType `json:"operation"` // Kafka ACL operation represents an operation which an ACL grants or denies permission to perform - PatternType PatternType `json:"pattern_type"` // Kafka ACL pattern type of resource name - PermissionType ServiceKafkaNativeAclGetPermissionType `json:"permission_type"` // Kafka ACL permission type - Principal string `json:"principal"` // principal is in 'principalType:name' format - ResourceName string `json:"resource_name"` // Resource pattern used to match specified resources - ResourceType ResourceType `json:"resource_type"` // Kafka ACL resource type represents a type of resource which an ACL can be applied to -} -type ServiceKafkaNativeAclGetPermissionType string - -const ( - ServiceKafkaNativeAclGetPermissionTypeAllow ServiceKafkaNativeAclGetPermissionType = "ALLOW" - ServiceKafkaNativeAclGetPermissionTypeDeny ServiceKafkaNativeAclGetPermissionType = "DENY" -) - -func ServiceKafkaNativeAclGetPermissionTypeChoices() []string { - return []string{"ALLOW", "DENY"} + Host string `json:"host"` // the host or * for all hosts + Id string `json:"id"` // ID + Operation OperationType `json:"operation"` // Kafka ACL operation represents an operation which an ACL grants or denies permission to perform + PatternType PatternType `json:"pattern_type"` // Kafka ACL pattern type of resource name + PermissionType ServiceKafkaNativeAclPermissionType `json:"permission_type"` // Kafka ACL permission type + Principal string `json:"principal"` // principal is in 'principalType:name' format + ResourceName string `json:"resource_name"` // Resource pattern used to match specified resources + ResourceType ResourceType `json:"resource_type"` // Kafka ACL resource type represents a type of resource which an ACL can be applied to } // ServiceKafkaNativeAclListOut ServiceKafkaNativeAclListResponse @@ -440,6 +420,16 @@ type ServiceKafkaNativeAclListOut struct { Acl []AclOut `json:"acl"` // List of Aiven ACL entries for Kafka service KafkaAcl []KafkaAclOut `json:"kafka_acl"` // List of Kafka-native ACL entries } +type ServiceKafkaNativeAclPermissionType string + +const ( + ServiceKafkaNativeAclPermissionTypeAllow ServiceKafkaNativeAclPermissionType = "ALLOW" + ServiceKafkaNativeAclPermissionTypeDeny ServiceKafkaNativeAclPermissionType = "DENY" +) + +func ServiceKafkaNativeAclPermissionTypeChoices() []string { + return []string{"ALLOW", "DENY"} +} // ServiceKafkaQuotaCreateIn ServiceKafkaQuotaCreateRequestBody type ServiceKafkaQuotaCreateIn struct { diff --git a/handler/vpc/vpc.go b/handler/vpc/vpc.go index d2640fa..dc60cd1 100644 --- a/handler/vpc/vpc.go +++ b/handler/vpc/vpc.go @@ -324,20 +324,14 @@ type VpcPeeringConnectionDeleteOut struct { type VpcPeeringConnectionStateType string const ( - VpcPeeringConnectionStateTypeActive VpcPeeringConnectionStateType = "ACTIVE" - VpcPeeringConnectionStateTypeApproved VpcPeeringConnectionStateType = "APPROVED" - VpcPeeringConnectionStateTypeApprovedPeerRequested VpcPeeringConnectionStateType = "APPROVED_PEER_REQUESTED" - VpcPeeringConnectionStateTypeDeleted VpcPeeringConnectionStateType = "DELETED" - VpcPeeringConnectionStateTypeDeletedByPeer VpcPeeringConnectionStateType = "DELETED_BY_PEER" - VpcPeeringConnectionStateTypeDeleting VpcPeeringConnectionStateType = "DELETING" - VpcPeeringConnectionStateTypeError VpcPeeringConnectionStateType = "ERROR" - VpcPeeringConnectionStateTypeInvalidSpecification VpcPeeringConnectionStateType = "INVALID_SPECIFICATION" - VpcPeeringConnectionStateTypePendingPeer VpcPeeringConnectionStateType = "PENDING_PEER" - VpcPeeringConnectionStateTypeRejectedByPeer VpcPeeringConnectionStateType = "REJECTED_BY_PEER" + VpcPeeringConnectionStateTypeActive VpcPeeringConnectionStateType = "ACTIVE" + VpcPeeringConnectionStateTypeApproved VpcPeeringConnectionStateType = "APPROVED" + VpcPeeringConnectionStateTypeDeleted VpcPeeringConnectionStateType = "DELETED" + VpcPeeringConnectionStateTypeDeleting VpcPeeringConnectionStateType = "DELETING" ) func VpcPeeringConnectionStateTypeChoices() []string { - return []string{"ACTIVE", "APPROVED", "APPROVED_PEER_REQUESTED", "DELETED", "DELETED_BY_PEER", "DELETING", "ERROR", "INVALID_SPECIFICATION", "PENDING_PEER", "REJECTED_BY_PEER"} + return []string{"ACTIVE", "APPROVED", "DELETED", "DELETING"} } type VpcPeeringConnectionType string @@ -362,61 +356,86 @@ type VpcPeeringConnectionUpdateIn struct { // VpcPeeringConnectionUpdateOut VpcPeeringConnectionUpdateResponse type VpcPeeringConnectionUpdateOut struct { - CloudName string `json:"cloud_name"` // Target cloud - CreateTime time.Time `json:"create_time"` // VPC creation timestamp - NetworkCidr string `json:"network_cidr"` // IPv4 network range CIDR - PeeringConnections []PeeringConnectionOut `json:"peering_connections"` // List of peering connections - PendingBuildOnlyPeeringConnections *string `json:"pending_build_only_peering_connections,omitempty"` // VPC rebuild is scheduled - ProjectVpcId string `json:"project_vpc_id"` // Project VPC ID - State VpcPeeringConnectionUpdateVpcPeeringConnectionStateType `json:"state"` // Project VPC state - UpdateTime time.Time `json:"update_time"` // Timestamp of last change to VPC + CloudName string `json:"cloud_name"` // Target cloud + CreateTime time.Time `json:"create_time"` // VPC creation timestamp + NetworkCidr string `json:"network_cidr"` // IPv4 network range CIDR + PeeringConnections []PeeringConnectionOut `json:"peering_connections"` // List of peering connections + PendingBuildOnlyPeeringConnections *string `json:"pending_build_only_peering_connections,omitempty"` // VPC rebuild is scheduled + ProjectVpcId string `json:"project_vpc_id"` // Project VPC ID + State VpcPeeringConnectionStateType `json:"state"` // Project VPC state + UpdateTime time.Time `json:"update_time"` // Timestamp of last change to VPC } -type VpcPeeringConnectionUpdateVpcPeeringConnectionStateType string + +// VpcPeeringConnectionWithRegionDeleteOut VpcPeeringConnectionWithRegionDeleteResponse +type VpcPeeringConnectionWithRegionDeleteOut struct { + CreateTime time.Time `json:"create_time"` // VPC peering connection creation timestamp + PeerAzureAppId string `json:"peer_azure_app_id"` // Azure app registration id in UUID4 form that is allowed to create a peering to the peer vnet + PeerAzureTenantId string `json:"peer_azure_tenant_id"` // Azure tenant id in UUID4 form + PeerCloudAccount string `json:"peer_cloud_account"` // AWS account ID, GCP project ID, Azure subscription ID of the peered VPC, or string "upcloud" for UpCloud peering connections + PeerRegion *string `json:"peer_region,omitempty"` // The peer VPC's region in AWS clouds. Always null in GCP, Azure, or UpCloud clouds + PeerResourceGroup string `json:"peer_resource_group"` // Azure resource group name of the peered VPC + PeerVpc string `json:"peer_vpc"` // AWS VPC ID, GCP VPC network name, Azure Virtual network name of the peered VPC, or UpCloud VPC ID + PeeringConnectionId *string `json:"peering_connection_id,omitempty"` // VPC peering connection ID + State VpcPeeringConnectionWithRegionStateType `json:"state"` // Project VPC peering connection state + StateInfo StateInfoOut `json:"state_info"` // State-specific help or error information + UpdateTime time.Time `json:"update_time"` // Timestamp of last change to the VPC peering connection + UserPeerNetworkCidrs []string `json:"user_peer_network_cidrs"` // List of private IPv4 ranges to route through the peering connection + VpcPeeringConnectionType VpcPeeringConnectionType `json:"vpc_peering_connection_type"` // Type of network connection from the VPC +} +type VpcPeeringConnectionWithRegionStateType string const ( - VpcPeeringConnectionUpdateVpcPeeringConnectionStateTypeActive VpcPeeringConnectionUpdateVpcPeeringConnectionStateType = "ACTIVE" - VpcPeeringConnectionUpdateVpcPeeringConnectionStateTypeApproved VpcPeeringConnectionUpdateVpcPeeringConnectionStateType = "APPROVED" - VpcPeeringConnectionUpdateVpcPeeringConnectionStateTypeDeleted VpcPeeringConnectionUpdateVpcPeeringConnectionStateType = "DELETED" - VpcPeeringConnectionUpdateVpcPeeringConnectionStateTypeDeleting VpcPeeringConnectionUpdateVpcPeeringConnectionStateType = "DELETING" + VpcPeeringConnectionWithRegionStateTypeActive VpcPeeringConnectionWithRegionStateType = "ACTIVE" + VpcPeeringConnectionWithRegionStateTypeApproved VpcPeeringConnectionWithRegionStateType = "APPROVED" + VpcPeeringConnectionWithRegionStateTypeApprovedPeerRequested VpcPeeringConnectionWithRegionStateType = "APPROVED_PEER_REQUESTED" + VpcPeeringConnectionWithRegionStateTypeDeleted VpcPeeringConnectionWithRegionStateType = "DELETED" + VpcPeeringConnectionWithRegionStateTypeDeletedByPeer VpcPeeringConnectionWithRegionStateType = "DELETED_BY_PEER" + VpcPeeringConnectionWithRegionStateTypeDeleting VpcPeeringConnectionWithRegionStateType = "DELETING" + VpcPeeringConnectionWithRegionStateTypeError VpcPeeringConnectionWithRegionStateType = "ERROR" + VpcPeeringConnectionWithRegionStateTypeInvalidSpecification VpcPeeringConnectionWithRegionStateType = "INVALID_SPECIFICATION" + VpcPeeringConnectionWithRegionStateTypePendingPeer VpcPeeringConnectionWithRegionStateType = "PENDING_PEER" + VpcPeeringConnectionWithRegionStateTypeRejectedByPeer VpcPeeringConnectionWithRegionStateType = "REJECTED_BY_PEER" ) -func VpcPeeringConnectionUpdateVpcPeeringConnectionStateTypeChoices() []string { - return []string{"ACTIVE", "APPROVED", "DELETED", "DELETING"} -} - -// VpcPeeringConnectionWithRegionDeleteOut VpcPeeringConnectionWithRegionDeleteResponse -type VpcPeeringConnectionWithRegionDeleteOut struct { - CreateTime time.Time `json:"create_time"` // VPC peering connection creation timestamp - PeerAzureAppId string `json:"peer_azure_app_id"` // Azure app registration id in UUID4 form that is allowed to create a peering to the peer vnet - PeerAzureTenantId string `json:"peer_azure_tenant_id"` // Azure tenant id in UUID4 form - PeerCloudAccount string `json:"peer_cloud_account"` // AWS account ID, GCP project ID, Azure subscription ID of the peered VPC, or string "upcloud" for UpCloud peering connections - PeerRegion *string `json:"peer_region,omitempty"` // The peer VPC's region in AWS clouds. Always null in GCP, Azure, or UpCloud clouds - PeerResourceGroup string `json:"peer_resource_group"` // Azure resource group name of the peered VPC - PeerVpc string `json:"peer_vpc"` // AWS VPC ID, GCP VPC network name, Azure Virtual network name of the peered VPC, or UpCloud VPC ID - PeeringConnectionId *string `json:"peering_connection_id,omitempty"` // VPC peering connection ID - State VpcPeeringConnectionStateType `json:"state"` // Project VPC peering connection state - StateInfo StateInfoOut `json:"state_info"` // State-specific help or error information - UpdateTime time.Time `json:"update_time"` // Timestamp of last change to the VPC peering connection - UserPeerNetworkCidrs []string `json:"user_peer_network_cidrs"` // List of private IPv4 ranges to route through the peering connection - VpcPeeringConnectionType VpcPeeringConnectionType `json:"vpc_peering_connection_type"` // Type of network connection from the VPC +func VpcPeeringConnectionWithRegionStateTypeChoices() []string { + return []string{"ACTIVE", "APPROVED", "APPROVED_PEER_REQUESTED", "DELETED", "DELETED_BY_PEER", "DELETING", "ERROR", "INVALID_SPECIFICATION", "PENDING_PEER", "REJECTED_BY_PEER"} } // VpcPeeringConnectionWithResourceGroupDeleteOut VpcPeeringConnectionWithResourceGroupDeleteResponse type VpcPeeringConnectionWithResourceGroupDeleteOut struct { - CreateTime time.Time `json:"create_time"` // VPC peering connection creation timestamp - PeerAzureAppId string `json:"peer_azure_app_id"` // Azure app registration id in UUID4 form that is allowed to create a peering to the peer vnet - PeerAzureTenantId string `json:"peer_azure_tenant_id"` // Azure tenant id in UUID4 form - PeerCloudAccount string `json:"peer_cloud_account"` // AWS account ID, GCP project ID, Azure subscription ID of the peered VPC, or string "upcloud" for UpCloud peering connections - PeerRegion *string `json:"peer_region,omitempty"` // The peer VPC's region in AWS clouds. Always null in GCP, Azure, or UpCloud clouds - PeerResourceGroup string `json:"peer_resource_group"` // Azure resource group name of the peered VPC - PeerVpc string `json:"peer_vpc"` // AWS VPC ID, GCP VPC network name, Azure Virtual network name of the peered VPC, or UpCloud VPC ID - PeeringConnectionId *string `json:"peering_connection_id,omitempty"` // VPC peering connection ID - State VpcPeeringConnectionStateType `json:"state"` // Project VPC peering connection state - StateInfo StateInfoOut `json:"state_info"` // State-specific help or error information - UpdateTime time.Time `json:"update_time"` // Timestamp of last change to the VPC peering connection - UserPeerNetworkCidrs []string `json:"user_peer_network_cidrs"` // List of private IPv4 ranges to route through the peering connection - VpcPeeringConnectionType VpcPeeringConnectionType `json:"vpc_peering_connection_type"` // Type of network connection from the VPC + CreateTime time.Time `json:"create_time"` // VPC peering connection creation timestamp + PeerAzureAppId string `json:"peer_azure_app_id"` // Azure app registration id in UUID4 form that is allowed to create a peering to the peer vnet + PeerAzureTenantId string `json:"peer_azure_tenant_id"` // Azure tenant id in UUID4 form + PeerCloudAccount string `json:"peer_cloud_account"` // AWS account ID, GCP project ID, Azure subscription ID of the peered VPC, or string "upcloud" for UpCloud peering connections + PeerRegion *string `json:"peer_region,omitempty"` // The peer VPC's region in AWS clouds. Always null in GCP, Azure, or UpCloud clouds + PeerResourceGroup string `json:"peer_resource_group"` // Azure resource group name of the peered VPC + PeerVpc string `json:"peer_vpc"` // AWS VPC ID, GCP VPC network name, Azure Virtual network name of the peered VPC, or UpCloud VPC ID + PeeringConnectionId *string `json:"peering_connection_id,omitempty"` // VPC peering connection ID + State VpcPeeringConnectionWithResourceGroupStateType `json:"state"` // Project VPC peering connection state + StateInfo StateInfoOut `json:"state_info"` // State-specific help or error information + UpdateTime time.Time `json:"update_time"` // Timestamp of last change to the VPC peering connection + UserPeerNetworkCidrs []string `json:"user_peer_network_cidrs"` // List of private IPv4 ranges to route through the peering connection + VpcPeeringConnectionType VpcPeeringConnectionType `json:"vpc_peering_connection_type"` // Type of network connection from the VPC +} +type VpcPeeringConnectionWithResourceGroupStateType string + +const ( + VpcPeeringConnectionWithResourceGroupStateTypeActive VpcPeeringConnectionWithResourceGroupStateType = "ACTIVE" + VpcPeeringConnectionWithResourceGroupStateTypeApproved VpcPeeringConnectionWithResourceGroupStateType = "APPROVED" + VpcPeeringConnectionWithResourceGroupStateTypeApprovedPeerRequested VpcPeeringConnectionWithResourceGroupStateType = "APPROVED_PEER_REQUESTED" + VpcPeeringConnectionWithResourceGroupStateTypeDeleted VpcPeeringConnectionWithResourceGroupStateType = "DELETED" + VpcPeeringConnectionWithResourceGroupStateTypeDeletedByPeer VpcPeeringConnectionWithResourceGroupStateType = "DELETED_BY_PEER" + VpcPeeringConnectionWithResourceGroupStateTypeDeleting VpcPeeringConnectionWithResourceGroupStateType = "DELETING" + VpcPeeringConnectionWithResourceGroupStateTypeError VpcPeeringConnectionWithResourceGroupStateType = "ERROR" + VpcPeeringConnectionWithResourceGroupStateTypeInvalidSpecification VpcPeeringConnectionWithResourceGroupStateType = "INVALID_SPECIFICATION" + VpcPeeringConnectionWithResourceGroupStateTypePendingPeer VpcPeeringConnectionWithResourceGroupStateType = "PENDING_PEER" + VpcPeeringConnectionWithResourceGroupStateTypeRejectedByPeer VpcPeeringConnectionWithResourceGroupStateType = "REJECTED_BY_PEER" +) + +func VpcPeeringConnectionWithResourceGroupStateTypeChoices() []string { + return []string{"ACTIVE", "APPROVED", "APPROVED_PEER_REQUESTED", "DELETED", "DELETED_BY_PEER", "DELETING", "ERROR", "INVALID_SPECIFICATION", "PENDING_PEER", "REJECTED_BY_PEER"} } + type VpcStateType string const (