Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

[INT-7879]: bump googleapis version #610

Merged
merged 34 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
862ce6a
[INT-7879]: bump googleapis version to 118
May 31, 2023
f86cfef
[INT-7879]: bump googleapis version to 118
May 31, 2023
a81c229
[INT-7879]: bump googleapis version to 118
May 31, 2023
b27ea00
[INT-7879]: downgrade googleapis to 95
Jun 2, 2023
1621701
[INT-7879]: revert changes
Jun 2, 2023
dd2221c
[INT-7879]: revert changes
Jun 2, 2023
407fc0e
[INT-7879]: bump google apis to 96
Jun 2, 2023
040a732
[INT-7879]: bump google apis to 97
Jun 2, 2023
c22e080
[INT-7879]: bump google apis to 98
Jun 2, 2023
aba860a
[INT-7879]: bump google apis to 99
Jun 2, 2023
fef535e
[INT-7879]: bump google apis to 100
Jun 2, 2023
8bf7ce6
[INT-7879]: bump google apis to 101
Jun 5, 2023
3b8627a
[INT-7879]: bump google apis to 101
Jun 5, 2023
27c1653
[INT-7879]: bump google apis to 102
Jun 5, 2023
f128b74
[INT-7879]: bump google apis to 103
Jun 5, 2023
fc5b110
[INT-7879]: bump google apis to 104
Jun 5, 2023
13f42cc
[INT-7879]: bump google apis to 118
Jun 5, 2023
5ac73ea
[INT-7879]: bump google apis to 105
Jun 5, 2023
9bbaba3
[INT-7879]: bump google apis to 106
Jun 5, 2023
744a2b5
[INT-7879]: bump google apis to 107
Jun 5, 2023
2a2d016
[INT-7879]: bump google apis to 108
Jun 5, 2023
04adddc
[INT-7879]: bump google apis to 109
Jun 5, 2023
f711cb5
[INT-7879]: bump google apis to 110
Jun 5, 2023
69c3972
[INT-7879]: bump google apis to 111
Jun 5, 2023
108a44a
[INT-7879]: bump google apis to 111
Jun 5, 2023
862af08
[INT-7879]: bump google apis to 111
Jun 5, 2023
104f407
[INT-7879]: bump google apis to 112
Jun 5, 2023
4e74c8d
[INT-7879]: bump google apis to 113
Jun 5, 2023
24b28ba
[INT-7879]: bump google apis to 118
Jun 5, 2023
9231923
[INT-7879]: remove any
Jun 5, 2023
c1d6961
INT-7879: remove unnecessary type assertion
Jun 5, 2023
7dcf1fa
[INT-7879]: update client's auth type
Jun 12, 2023
6a26f21
Merge branch 'main' into INT-7879/bump-googleapis-version
Jun 12, 2023
1ab4a65
[INT-7879]: fix conflicts
Jun 12, 2023
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
"dotenv": "^9.0.2",
"mutton": "^0.5.1",
"node-fetch": "^2.6.1",
"ts-node": "^9.1.1"
"ts-node": "^10.9.1"
},
"dependencies": {
"@lifeomic/attempt": "^3.0.0",
"commander": "^9.4.1",
"gaxios": "^4.2.1",
"google-auth-library": "^7.1.0",
"googleapis": "94.0.0",
"google-auth-library": "^8.8.0",
"googleapis": "^118.0.0",
"lodash.get": "^4.4.2",
"p-map": "^4.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"_order": 0,
"cache": {},
"request": {
"bodySize": 711,
"bodySize": 739,
"cookies": [],
"headers": [
{
Expand All @@ -22,18 +22,23 @@
},
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
"name": "user-agent",
"value": "google-api-nodejs-client/8.8.0"
},
{
"_fromType": "array",
"name": "content-length",
"value": "711"
"name": "x-goog-api-client",
"value": "gl-node/14.21.3 auth/8.8.0"
},
{
"_fromType": "array",
"name": "user-agent",
"value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-length",
"value": "739"
},
{
"_fromType": "array",
Expand All @@ -50,7 +55,7 @@
"value": "www.googleapis.com"
}
],
"headersSize": 300,
"headersSize": 323,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
Expand All @@ -62,11 +67,11 @@
"url": "https://www.googleapis.com/oauth2/v4/token"
},
"response": {
"bodySize": 137,
"bodySize": 130,
"content": {
"encoding": "utf-8",
"mimeType": "application/json; charset=UTF-8",
"size": 137,
"size": 130,
"text": "{\"error\":\"invalid_grant\",\"error_description\":\"Invalid grant: account not found\"}"
},
"cookies": [],
Expand All @@ -81,7 +86,7 @@
},
{
"name": "date",
"value": "Fri, 10 Feb 2023 12:44:59 GMT"
"value": "Wed, 31 May 2023 16:20:28 GMT"
},
{
"name": "server",
Expand Down Expand Up @@ -118,7 +123,7 @@
"status": 400,
"statusText": "Bad Request"
},
"startedDateTime": "2023-02-10T12:44:59.127Z",
"startedDateTime": "2023-05-31T16:20:27.902Z",
"time": 166,
"timings": {
"blocked": -1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"_order": 0,
"cache": {},
"request": {
"bodySize": 725,
"bodySize": 733,
"cookies": [],
"headers": [
{
Expand All @@ -22,18 +22,23 @@
},
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
"name": "user-agent",
"value": "google-api-nodejs-client/8.8.0"
},
{
"_fromType": "array",
"name": "content-length",
"value": "725"
"name": "x-goog-api-client",
"value": "gl-node/14.21.3 auth/8.8.0"
},
{
"_fromType": "array",
"name": "user-agent",
"value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-length",
"value": "733"
},
{
"_fromType": "array",
Expand All @@ -50,7 +55,7 @@
"value": "www.googleapis.com"
}
],
"headersSize": 300,
"headersSize": 323,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
Expand All @@ -62,11 +67,11 @@
"url": "https://www.googleapis.com/oauth2/v4/token"
},
"response": {
"bodySize": 163,
"bodySize": 228,
"content": {
"encoding": "utf-8",
"mimeType": "application/json; charset=UTF-8",
"size": 163,
"size": 228,
"text": "{\"error\":\"invalid_grant\",\"error_description\":\"Invalid JWT Signature.\"}"
},
"cookies": [],
Expand All @@ -81,7 +86,7 @@
},
{
"name": "date",
"value": "Fri, 10 Feb 2023 12:50:03 GMT"
"value": "Wed, 31 May 2023 16:24:12 GMT"
},
{
"name": "server",
Expand Down Expand Up @@ -118,16 +123,16 @@
"status": 400,
"statusText": "Bad Request"
},
"startedDateTime": "2023-02-10T12:50:02.932Z",
"time": 253,
"startedDateTime": "2023-05-31T16:24:12.035Z",
"time": 179,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 253
"wait": 179
}
}
],
Expand Down
14 changes: 10 additions & 4 deletions src/google-cloud/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
IntegrationProviderAuthorizationError,
} from '@jupiterone/integration-sdk-core';
import { createMockExecutionContext } from '@jupiterone/integration-sdk-testing';
import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library';
import { AuthClient, GoogleAuth, GoogleAuthOptions } from 'google-auth-library';
import { google } from 'googleapis';
import { IntegrationConfig, invocationConfig } from '..';
import { getMockIntegrationConfig, integrationConfig } from '../../test/config';
Expand All @@ -16,12 +16,18 @@ import { Client } from './client';

describe('#getAuthenticatedServiceClient', () => {
let googleAuthSpy: jest.SpyInstance<
GoogleAuth,
[(GoogleAuthOptions | undefined)?]
GoogleAuth<AuthClient>,
[opts?: GoogleAuthOptions<AuthClient>]
>;

beforeEach(() => {
googleAuthSpy = jest.spyOn(google.auth, 'GoogleAuth');
googleAuthSpy = jest.spyOn(
google.auth,
'GoogleAuth',
) as unknown as jest.SpyInstance<
GoogleAuth<AuthClient>,
[opts?: GoogleAuthOptions<AuthClient>]
>;
});

afterEach(() => {
Expand Down
6 changes: 5 additions & 1 deletion src/google-cloud/utils/createErrorProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ type J1ApiErrorProps = GetConstructorArgs<
typeof IntegrationProviderAPIError
>[0];

const isGaxiosError = (error: Error | GaxiosError): error is GaxiosError => {
return error.constructor.name === 'GaxiosError';
};

export function createErrorProps(error: Error | GaxiosError): J1ApiErrorProps {
if (error instanceof GaxiosError && error.response) {
if (isGaxiosError(error) && error.response) {
return {
cause: error,
endpoint: error.response?.config?.url || UNKNOWN_VALUE,
Expand Down
2 changes: 1 addition & 1 deletion src/steps/access-context-manager/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class AccessContextManagerClient extends Client {
const auth = await this.getAuthenticatedServiceClient();

await this.iterateApi(
async (nextPageToken) => {
async (nextPageToken: string | undefined) => {
return this.client.accessPolicies.list({
auth,
parent: `organizations/${this.organizationId}`,
Expand Down
7 changes: 5 additions & 2 deletions src/steps/big-query/converters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { bigquery_v2 } from 'googleapis';
import { createGoogleCloudIntegrationEntity } from '../../utils/entity';
import {
GoogleCloudResourceData,
createGoogleCloudIntegrationEntity,
} from '../../utils/entity';
import {
BIG_QUERY_DATASET_ENTITY_CLASS,
BIG_QUERY_DATASET_ENTITY_TYPE,
Expand Down Expand Up @@ -41,7 +44,7 @@ function isBigQueryDatasetPublicAccess(accessList: DatasetAccess[]): boolean {
export function createBigQueryDatasetEntity(data: bigquery_v2.Schema$Dataset) {
return createGoogleCloudIntegrationEntity(data, {
entityData: {
source: data,
source: data as GoogleCloudResourceData,
assign: {
_key: data.id as string,
_type: BIG_QUERY_DATASET_ENTITY_TYPE,
Expand Down
74 changes: 0 additions & 74 deletions test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
memcache_v1,
monitoring_v3,
osconfig_v1,
privateca_v1beta1,
pubsub_v1,
redis_v1,
run_v1,
Expand Down Expand Up @@ -1857,79 +1856,6 @@ export function getMockSpannerInstanceConfiguration(
};
}

export function getMockCertificateAuthority(
partial?: privateca_v1beta1.Schema$CertificateAuthority,
): privateca_v1beta1.Schema$CertificateAuthority {
return {
name: 'projects/j1-gc-integration-dev-v2/locations/us-central1/certificateAuthorities/acmeName',
type: 'SELF_SIGNED',
tier: 'ENTERPRISE',
config: {
subjectConfig: {
subject: {
organization: 'Acme',
},
commonName: 'acmeName',
},
reusableConfig: {},
},
lifetime: '314496000s',
keySpec: {
algorithm: 'RSA_PKCS1_2048_SHA256',
},
issuingOptions: {
includeCaCertUrl: true,
includeCrlAccessUrl: true,
},
state: 'ENABLED',
caCertificateDescriptions: [
{
subjectDescription: {
subject: {
organization: 'Acme',
},
commonName: 'acmeName',
subjectAltName: {},
hexSerialNumber: '008a51de1d92de213728c7733b74700f4a684513',
lifetime: '314496000s',
notBeforeTime: '2021-04-08T14:44:07.900172684Z',
notAfterTime: '2031-03-27T14:44:07.900172684Z',
},
configValues: {
keyUsage: {
baseKeyUsage: {
certSign: true,
crlSign: true,
},
},
caOptions: {
isCa: true,
},
},
subjectKeyId: {
keyId: 'ec21738d89c6020cfab46e73b1a001d7fb24d34c',
},
authorityKeyId: {
keyId: 'ec21738d89c6020cfab46e73b1a001d7fb24d34c',
},
certFingerprint: {
sha256Hash:
'd7de957b8c0903c662332fc8ec4966c5dc01b7426ed778dc389aaa545a37064a',
},
},
],
accessUrls: {
caCertificateAccessUrl:
'http://test-bucket-with-labels.storage.googleapis.com/f1cc34b5b7e8fa026582/ca.crt',
crlAccessUrl:
'http://test-bucket-with-labels.storage.googleapis.com/f1cc34b5b7e8fa026582/crl.crl',
},
createTime: '2021-04-08T14:44:07.215539285Z',
updateTime: '2021-04-08T14:44:09.263990183Z',
...partial,
};
}

export function getMockApiGatewayApi(
partial?: apigateway_v1.Schema$ApigatewayApi,
): apigateway_v1.Schema$ApigatewayApi {
Expand Down
Loading