Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(services): rename tables and properties to fix postgres long nam… #11

Open
wants to merge 3 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"terraform:cleanup": "rimraf ./tests/terraform/{.terraform,.terraform.lock.hcl,tfplan} ./tests/terraform/*.{tfstate,tfplan,backup}"
},
"dependencies": {
"@cloudgraph/sdk": "^0.11.0",
"@cloudgraph/sdk": "^0.22.0",
"@google-cloud/api-gateway": "^1.2.1",
"@google-cloud/asset": "^3.22.0",
"@google-cloud/bigquery": "^5.10.0",
Expand Down
2 changes: 1 addition & 1 deletion src/enums/schemasMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
[services.bigQueryDataset]: 'gcpBigQueryDataset',
[services.bigQueryConnection]: 'gcpBigQueryConnection',
[services.bigQueryReservation]: 'gcpBigQueryReservation',
[services.bigQueryReservationCapacityCommitment]: 'gcpBigQueryReservationCapacityCommitment',
[services.bigQueryReservationCapacityCommitment]: 'gcpBigQueryReservationCapacity',
[services.bigQueryDataTransfer]: 'gcpBigQueryDataTransfer',
[services.bigQueryDataTransferRun]: 'gcpBigQueryDataTransferRun',
[services.kmsKeyRing]: 'gcpKmsKeyRing',
Expand Down
6 changes: 3 additions & 3 deletions src/services/bigQuery/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import cuid from 'cuid'
import {
GcpBigQueryDataset,
GcpBigQueryTable,
GcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamily,
GcpBigQueryTableConfigColumnFamily,
GcpBigQueryTableSchemaField,
GcpBigQueryTableViewUserDefinedFunctionResource,
} from '../../types/generated'
Expand Down Expand Up @@ -47,7 +47,7 @@ const formatTableViewUserDefinedFunctionResource = ({
inlineCode,
})

const formatColumnFamily = (columnFamily): GcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamily => {
const formatColumnFamily = (columnFamily): GcpBigQueryTableConfigColumnFamily => {
const {
familyId,
type,
Expand Down Expand Up @@ -161,7 +161,7 @@ const formatTable = (table: RawGcpBigQueryTable): GcpBigQueryTable => {
externalDataConfigurationCsvOptionsAllowQuotedNewlines: externalDataConfiguration?.csvOptions?.allowQuotedNewlines || false,
externalDataConfigurationCsvOptionsAllowJaggedRows: externalDataConfiguration?.csvOptions?.allowJaggedRows || false,
externalDataConfigurationCsvOptionsEncoding: externalDataConfiguration?.csvOptions?.encoding || '',
externalDataConfigurationBigtableOptionsColumnFamilies: externalDataConfiguration?.bigtableOptions?.columnFamilies?.map(
externalDataConfigOptionsColumnFamilies: externalDataConfiguration?.bigtableOptions?.columnFamilies?.map(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should talk with infra to come up with the best replacement names to not confuse users

columnFamily => formatColumnFamily(columnFamily)
) || [],
externalDataConfigurationBigtableOptionsIgnoreUnspecifiedColumnFamilies:
Expand Down
8 changes: 4 additions & 4 deletions src/services/bigQuery/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type gcpBigQueryTableViewUserDefinedFunctionResource
inlineCode: String @search(by: [hash, regexp])
}

type gcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamilyColumn
type gcpBigQueryTableConfigColumnFamilyColumn
@generate(
query: { get: true, query: true, aggregate: true }
mutation: { add: true, delete: false }
Expand All @@ -38,7 +38,7 @@ type gcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamilyColumn
onlyReadLatest: Boolean @search
}

type gcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamily
type gcpBigQueryTableConfigColumnFamily
@generate(
query: { get: true, query: true, aggregate: true }
mutation: { add: true, delete: false }
Expand All @@ -47,7 +47,7 @@ type gcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamily
familyId: String @search(by: [hash, regexp])
type: String @search(by: [hash, regexp])
encoding: String @search(by: [hash, regexp])
columns: [gcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamilyColumn]
columns: [gcpBigQueryTableConfigColumnFamilyColumn]
onlyReadLatest: Boolean @search
}

Expand Down Expand Up @@ -98,7 +98,7 @@ type gcpBigQueryTable implements gcpBaseResource
externalDataConfigurationCsvOptionsAllowQuotedNewlines: Boolean @search
externalDataConfigurationCsvOptionsAllowJaggedRows: Boolean @search
externalDataConfigurationCsvOptionsEncoding: String @search(by: [hash, regexp])
externalDataConfigurationBigtableOptionsColumnFamilies: [gcpBigQueryTableExternalDataConfigurationBigtableOptionColumnFamily]
externalDataConfigOptionsColumnFamilies: [gcpBigQueryTableConfigColumnFamily]
externalDataConfigurationBigtableOptionsIgnoreUnspecifiedColumnFamilies: Boolean @search
externalDataConfigurationBigtableOptionsReadRowkeyAsString: Boolean @search
externalDataConfigurationGoogleSheetsOptionsSkipLeadingRows: String @search(by: [hash, regexp])
Expand Down
4 changes: 2 additions & 2 deletions src/services/bigQueryReservationCapacityCommitment/format.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { google } from '@google-cloud/bigquery-reservation/build/protos/protos'
import cuid from 'cuid'
import { GcpBigQueryReservationCapacityCommitment } from '../../types/generated'
import { GcpBigQueryReservationCapacity } from '../../types/generated'
import { toISOString } from '../../utils/dateutils'

import { enumKeyToString } from '../../utils/format'
Expand All @@ -13,7 +13,7 @@ export default ({
}: {
service: RawGcpBigQueryReservationCapacityCommitment
region: string
}): GcpBigQueryReservationCapacityCommitment => {
}): GcpBigQueryReservationCapacity => {
const {
name,
slotCount,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default `mutation($input: [AddgcpBigQueryReservationCapacityCommitmentInput!]!) {
addgcpBigQueryReservationCapacityCommitment(input: $input, upsert: true) {
export default `mutation($input: [AddgcpBigQueryReservationCapacityInput!]!) {
addgcpBigQueryReservationCapacity(input: $input, upsert: true) {
numUids
}
}`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type gcpBigQueryReservationCapacityCommitmentFailureStatusDetail
type gcpBigQueryReservationFailureStatusDetail
@generate(
query: { get: true, query: true, aggregate: true }
mutation: { add: true, delete: false }
Expand All @@ -9,7 +9,7 @@ type gcpBigQueryReservationCapacityCommitmentFailureStatusDetail
value: String @search(by: [hash, regexp])
}

type gcpBigQueryReservationCapacityCommitment implements gcpBaseResource
type gcpBigQueryReservationCapacity implements gcpBaseResource
@generate(
query: { get: true, query: true, aggregate: true }
mutation: { add: true, delete: false }
Expand All @@ -22,7 +22,7 @@ type gcpBigQueryReservationCapacityCommitment implements gcpBaseResource
commitmentEndTime: String @search(by: [hash, regexp])
failureStatusCode: Int @search
failureStatusMessage: String @search(by: [hash, regexp])
failureStatusDetails: [gcpBigQueryReservationCapacityCommitmentFailureStatusDetail],
failureStatusDetails: [gcpBigQueryReservationFailureStatusDetail],
renewalPlan: String @search(by: [hash, regexp])
project: [gcpProject] @hasInverse(field: bigQueryReservationCapacityCommitment)
project: [gcpProject] @hasInverse(field: bigQueryReservationCapacity)
}
52 changes: 26 additions & 26 deletions src/services/cdnUrlMap/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ import {
GcpCdnUrlMapPathMatcher,
GcpCdnUrlMapPathMatcherPathRule,
GcpCdnUrlMapPathMatcherRouteRule,
GcpCdnUrlMapPathMatcherRouteRuleMatchRule,
GcpCdnUrlMapPathMatcherRouteRuleMatchRuleHttpHeaderMatch,
GcpCdnUrlMapPathMatcherRouteRuleMatchRuleHttpQueryParameterMatch,
GcpCdnUrlMapPathMatcherRouteRuleMatchRuleMetadataFilter,
GcpCdnUrlMapPathMatcherMatchRule,
GcpCdnUrlMapPathRuleHttpHeaderMatch,
GcpCdnUrlMapPathRuleHttpQueryParameter,
GcpCdnUrlMapPathRuleMetadataFilter,
GcpCdnUrlMapRouteAction,
GcpCdnUrlMapRouteActionWeightedBackendService,
GcpCdnUrlMapRouteActionWeightedService,
GcpCdnUrlMapTest,
} from '../../types/generated'

const formatWeightedBackendService = ({
backendService,
headerAction,
weight,
}: google.cloud.compute.v1.IWeightedBackendService): GcpCdnUrlMapRouteActionWeightedBackendService => {
}: google.cloud.compute.v1.IWeightedBackendService): GcpCdnUrlMapRouteActionWeightedService => {
return {
id: cuid(),
backendService,
headerActionRequestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
requestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -37,8 +37,8 @@ const formatWeightedBackendService = ({
replace,
}
}) || [],
headerActionRequestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
headerActionResponseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
requestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
responseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -50,7 +50,7 @@ const formatWeightedBackendService = ({
replace,
}
}) || [],
headerActionResponseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
responseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
weight,
}
}
Expand Down Expand Up @@ -120,7 +120,7 @@ const formatPathMatcherRouteRuleMatchRuleHttpHeaderMatch = ({
rangeMatch,
regexMatch,
suffixMatch,
}: google.cloud.compute.v1.IHttpHeaderMatch): GcpCdnUrlMapPathMatcherRouteRuleMatchRuleHttpHeaderMatch => {
}: google.cloud.compute.v1.IHttpHeaderMatch): GcpCdnUrlMapPathRuleHttpHeaderMatch => {
return {
id: cuid(),
exactMatch,
Expand All @@ -138,7 +138,7 @@ const formatPathMatcherRouteRuleMatchRuleHttpHeaderMatch = ({
const formatPathMatcherRouteRuleMatchRuleMetadataFilter = ({
filterLabels = [],
filterMatchCriteria,
}: google.cloud.compute.v1.IMetadataFilter): GcpCdnUrlMapPathMatcherRouteRuleMatchRuleMetadataFilter => {
}: google.cloud.compute.v1.IMetadataFilter): GcpCdnUrlMapPathRuleMetadataFilter => {
return {
id: cuid(),
filterLabels: filterLabels?.map(
Expand All @@ -161,7 +161,7 @@ const formatPathMatcherRouteRuleMatchRuleHttpQueryParameterMatch = ({
name,
presentMatch,
regexMatch,
}: google.cloud.compute.v1.IHttpQueryParameterMatch): GcpCdnUrlMapPathMatcherRouteRuleMatchRuleHttpQueryParameterMatch => {
}: google.cloud.compute.v1.IHttpQueryParameterMatch): GcpCdnUrlMapPathRuleHttpQueryParameter => {
return {
id: cuid(),
exactMatch,
Expand All @@ -179,7 +179,7 @@ const formatPathMatcherRouteRuleMatchRules = ({
prefixMatch,
queryParameterMatches = [],
regexMatch,
}: google.cloud.compute.v1.IHttpRouteRuleMatch): GcpCdnUrlMapPathMatcherRouteRuleMatchRule => {
}: google.cloud.compute.v1.IHttpRouteRuleMatch): GcpCdnUrlMapPathMatcherMatchRule => {
return {
id: cuid(),
fullPathMatch,
Expand All @@ -206,7 +206,7 @@ const formatPathMatcherRouteRule = ({
return {
id: cuid(),
description,
headerActionRequestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
requestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -218,8 +218,8 @@ const formatPathMatcherRouteRule = ({
replace,
}
}) || [],
headerActionRequestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
headerActionResponseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
requestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
responseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -231,7 +231,7 @@ const formatPathMatcherRouteRule = ({
replace,
}
}) || [],
headerActionResponseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
responseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
matchRules: matchRules?.map(matchRule => formatPathMatcherRouteRuleMatchRules(matchRule)),
priority,
routeAction: formatRouteAction(routeAction),
Expand Down Expand Up @@ -270,7 +270,7 @@ const formatPathMatcher = ({
enumKeyToString(google.cloud.compute.v1.HttpRedirectAction.RedirectResponseCode, defaultUrlRedirect?.redirectResponseCode) || '',
defaultUrlRedirectStripQuery: defaultUrlRedirect?.stripQuery || false,
description,
headerActionRequestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
requestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -282,8 +282,8 @@ const formatPathMatcher = ({
replace,
}
}) || [],
headerActionRequestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
headerActionResponseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
requestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
responseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -295,7 +295,7 @@ const formatPathMatcher = ({
replace,
}
}) || [],
headerActionResponseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
responseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
pathRules: pathRules?.map(pathRule => formatPathMatcherPathRule(pathRule)),
routeRules: routeRules?.map(routeRule => formatPathMatcherRouteRule(routeRule)),
}
Expand Down Expand Up @@ -376,7 +376,7 @@ export default ({
defaultUrlRedirectStripQuery: defaultUrlRedirect?.stripQuery || false,
description,
fingerprint,
headerActionRequestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
requestHeadersToAdd: headerAction?.requestHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -388,8 +388,8 @@ export default ({
replace,
}
}) || [],
headerActionRequestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
headerActionResponseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
requestHeadersToRemove: headerAction?.requestHeadersToRemove || [],
responseHeadersToAdd: headerAction?.responseHeadersToAdd?.map(({
headerName,
headerValue,
replace,
Expand All @@ -401,7 +401,7 @@ export default ({
replace,
}
}) || [],
headerActionResponseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
responseHeadersToRemove: headerAction?.responseHeadersToRemove || [],
hostRules: hostRules?.map(({
description: hostRuleDescription,
hosts,
Expand Down
Loading