diff --git a/packages/google-cloud-securitycenter/protos/protos.json b/packages/google-cloud-securitycenter/protos/protos.json index a7387c92a45..26544b8c767 100644 --- a/packages/google-cloud-securitycenter/protos/protos.json +++ b/packages/google-cloud-securitycenter/protos/protos.json @@ -16,70 +16,603 @@ "ruby_package": "Google::Cloud::SecurityCenter::V1" }, "nested": { - "Finding": { + "SecurityCenter": { + "methods": { + "CreateSource": { + "requestType": "CreateSourceRequest", + "responseType": "Source", + "options": { + "(google.api.http).post": "/v1/{parent=organizations/*}/sources", + "(google.api.http).body": "source" + } + }, + "CreateFinding": { + "requestType": "CreateFindingRequest", + "responseType": "Finding", + "options": { + "(google.api.http).post": "/v1/{parent=organizations/*/sources/*}/findings", + "(google.api.http).body": "finding" + } + }, + "GetIamPolicy": { + "requestType": "google.iam.v1.GetIamPolicyRequest", + "responseType": "google.iam.v1.Policy", + "options": { + "(google.api.http).post": "/v1/{resource=organizations/*/sources/*}:getIamPolicy", + "(google.api.http).body": "*" + } + }, + "GetOrganizationSettings": { + "requestType": "GetOrganizationSettingsRequest", + "responseType": "OrganizationSettings", + "options": { + "(google.api.http).get": "/v1/{name=organizations/*/organizationSettings}" + } + }, + "GetSource": { + "requestType": "GetSourceRequest", + "responseType": "Source", + "options": { + "(google.api.http).get": "/v1/{name=organizations/*/sources/*}" + } + }, + "GroupAssets": { + "requestType": "GroupAssetsRequest", + "responseType": "GroupAssetsResponse", + "options": { + "(google.api.http).post": "/v1/{parent=organizations/*}/assets:group", + "(google.api.http).body": "*" + } + }, + "GroupFindings": { + "requestType": "GroupFindingsRequest", + "responseType": "GroupFindingsResponse", + "options": { + "(google.api.http).post": "/v1/{parent=organizations/*/sources/*}/findings:group", + "(google.api.http).body": "*" + } + }, + "ListAssets": { + "requestType": "ListAssetsRequest", + "responseType": "ListAssetsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=organizations/*}/assets" + } + }, + "ListFindings": { + "requestType": "ListFindingsRequest", + "responseType": "ListFindingsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=organizations/*/sources/*}/findings" + } + }, + "ListSources": { + "requestType": "ListSourcesRequest", + "responseType": "ListSourcesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=organizations/*}/sources" + } + }, + "RunAssetDiscovery": { + "requestType": "RunAssetDiscoveryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=organizations/*}/assets:runDiscovery", + "(google.api.http).body": "*" + } + }, + "SetFindingState": { + "requestType": "SetFindingStateRequest", + "responseType": "Finding", + "options": { + "(google.api.http).post": "/v1/{name=organizations/*/sources/*/findings/*}:setState", + "(google.api.http).body": "*" + } + }, + "SetIamPolicy": { + "requestType": "google.iam.v1.SetIamPolicyRequest", + "responseType": "google.iam.v1.Policy", + "options": { + "(google.api.http).post": "/v1/{resource=organizations/*/sources/*}:setIamPolicy", + "(google.api.http).body": "*" + } + }, + "TestIamPermissions": { + "requestType": "google.iam.v1.TestIamPermissionsRequest", + "responseType": "google.iam.v1.TestIamPermissionsResponse", + "options": { + "(google.api.http).post": "/v1/{resource=organizations/*/sources/*}:testIamPermissions", + "(google.api.http).body": "*" + } + }, + "UpdateFinding": { + "requestType": "UpdateFindingRequest", + "responseType": "Finding", + "options": { + "(google.api.http).patch": "/v1/{finding.name=organizations/*/sources/*/findings/*}", + "(google.api.http).body": "finding" + } + }, + "UpdateOrganizationSettings": { + "requestType": "UpdateOrganizationSettingsRequest", + "responseType": "OrganizationSettings", + "options": { + "(google.api.http).patch": "/v1/{organization_settings.name=organizations/*/organizationSettings}", + "(google.api.http).body": "organization_settings" + } + }, + "UpdateSource": { + "requestType": "UpdateSourceRequest", + "responseType": "Source", + "options": { + "(google.api.http).patch": "/v1/{source.name=organizations/*/sources/*}", + "(google.api.http).body": "source" + } + }, + "UpdateSecurityMarks": { + "requestType": "UpdateSecurityMarksRequest", + "responseType": "SecurityMarks", + "options": { + "(google.api.http).patch": "/v1/{security_marks.name=organizations/*/assets/*/securityMarks}", + "(google.api.http).body": "security_marks", + "(google.api.http).additional_bindings.patch": "/v1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}", + "(google.api.http).additional_bindings.body": "security_marks" + } + } + } + }, + "CreateFindingRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "findingId": { + "type": "string", + "id": 2 + }, + "finding": { + "type": "Finding", + "id": 3 + } + } + }, + "CreateSourceRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "source": { + "type": "Source", + "id": 2 + } + } + }, + "GetOrganizationSettingsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "GetSourceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "GroupAssetsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "filter": { + "type": "string", + "id": 2 + }, + "groupBy": { + "type": "string", + "id": 3 + }, + "compareDuration": { + "type": "google.protobuf.Duration", + "id": 4 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "pageToken": { + "type": "string", + "id": 7 + }, + "pageSize": { + "type": "int32", + "id": 8 + } + }, + "reserved": [ + [ + 6, + 6 + ] + ] + }, + "GroupAssetsResponse": { + "fields": { + "groupByResults": { + "rule": "repeated", + "type": "GroupResult", + "id": 1 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + }, + "totalSize": { + "type": "int32", + "id": 4 + } + } + }, + "GroupFindingsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "filter": { + "type": "string", + "id": 2 + }, + "groupBy": { + "type": "string", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "compareDuration": { + "type": "google.protobuf.Duration", + "id": 5 + }, + "pageToken": { + "type": "string", + "id": 7 + }, + "pageSize": { + "type": "int32", + "id": 8 + } + }, + "reserved": [ + [ + 6, + 6 + ] + ] + }, + "GroupFindingsResponse": { + "fields": { + "groupByResults": { + "rule": "repeated", + "type": "GroupResult", + "id": 1 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + }, + "totalSize": { + "type": "int32", + "id": 4 + } + } + }, + "GroupResult": { "fields": { - "name": { + "properties": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 1 + }, + "count": { + "type": "int64", + "id": 2 + } + } + }, + "ListSourcesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "pageToken": { "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 7 + } + } + }, + "ListSourcesResponse": { + "fields": { + "sources": { + "rule": "repeated", + "type": "Source", "id": 1 }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ListAssetsRequest": { + "fields": { "parent": { + "type": "string", + "id": 1 + }, + "filter": { "type": "string", "id": 2 }, - "resourceName": { + "orderBy": { "type": "string", "id": 3 }, - "state": { - "type": "State", + "readTime": { + "type": "google.protobuf.Timestamp", "id": 4 }, - "category": { - "type": "string", + "compareDuration": { + "type": "google.protobuf.Duration", "id": 5 }, - "externalUri": { + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 7 + }, + "pageToken": { "type": "string", - "id": 6 + "id": 8 }, - "sourceProperties": { - "keyType": "string", - "type": "google.protobuf.Value", + "pageSize": { + "type": "int32", + "id": 9 + } + }, + "reserved": [ + [ + 6, + 6 + ] + ] + }, + "ListAssetsResponse": { + "fields": { + "listAssetsResults": { + "rule": "repeated", + "type": "ListAssetsResult", + "id": 1 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + }, + "totalSize": { + "type": "int32", + "id": 4 + } + }, + "nested": { + "ListAssetsResult": { + "fields": { + "asset": { + "type": "Asset", + "id": 1 + }, + "stateChange": { + "type": "StateChange", + "id": 2 + } + }, + "nested": { + "StateChange": { + "values": { + "UNUSED": 0, + "ADDED": 1, + "REMOVED": 2, + "ACTIVE": 3 + } + } + } + } + } + }, + "ListFindingsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "filter": { + "type": "string", + "id": 2 + }, + "orderBy": { + "type": "string", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "compareDuration": { + "type": "google.protobuf.Duration", + "id": 5 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", "id": 7 }, - "securityMarks": { - "type": "SecurityMarks", + "pageToken": { + "type": "string", "id": 8 }, - "eventTime": { - "type": "google.protobuf.Timestamp", + "pageSize": { + "type": "int32", "id": 9 + } + }, + "reserved": [ + [ + 6, + 6 + ] + ] + }, + "ListFindingsResponse": { + "fields": { + "listFindingsResults": { + "rule": "repeated", + "type": "ListFindingsResult", + "id": 1 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + }, + "totalSize": { + "type": "int32", + "id": 4 + } + }, + "nested": { + "ListFindingsResult": { + "fields": { + "finding": { + "type": "Finding", + "id": 1 + }, + "stateChange": { + "type": "StateChange", + "id": 2 + } + }, + "nested": { + "StateChange": { + "values": { + "UNUSED": 0, + "CHANGED": 1, + "UNCHANGED": 2, + "ADDED": 3, + "REMOVED": 4 + } + } + } + } + } + }, + "SetFindingStateRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "state": { + "type": "Finding.State", + "id": 2 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "RunAssetDiscoveryRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + } + } + }, + "UpdateFindingRequest": { + "fields": { + "finding": { + "type": "Finding", + "id": 1 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "UpdateOrganizationSettingsRequest": { + "fields": { + "organizationSettings": { + "type": "OrganizationSettings", + "id": 1 }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 10 + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "ACTIVE": 1, - "INACTIVE": 2 - } + } + }, + "UpdateSourceRequest": { + "fields": { + "source": { + "type": "Source", + "id": 1 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 } } }, - "SecurityMarks": { + "UpdateSecurityMarksRequest": { "fields": { - "name": { - "type": "string", + "securityMarks": { + "type": "SecurityMarks", "id": 1 }, - "marks": { - "keyType": "string", - "type": "string", + "updateMask": { + "type": "google.protobuf.FieldMask", "id": 2 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 3 } } }, @@ -151,6 +684,145 @@ } } }, + "SecurityMarks": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "marks": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + }, + "Finding": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "parent": { + "type": "string", + "id": 2 + }, + "resourceName": { + "type": "string", + "id": 3 + }, + "state": { + "type": "State", + "id": 4 + }, + "category": { + "type": "string", + "id": 5 + }, + "externalUri": { + "type": "string", + "id": 6 + }, + "sourceProperties": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "securityMarks": { + "type": "SecurityMarks", + "id": 8 + }, + "eventTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "INACTIVE": 2 + } + } + } + }, + "OrganizationSettings": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "enableAssetDiscovery": { + "type": "bool", + "id": 2 + }, + "assetDiscoveryConfig": { + "type": "AssetDiscoveryConfig", + "id": 3 + } + }, + "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ] + ], + "nested": { + "AssetDiscoveryConfig": { + "fields": { + "projectIds": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "inclusionMode": { + "type": "InclusionMode", + "id": 2 + } + }, + "nested": { + "InclusionMode": { + "values": { + "INCLUSION_MODE_UNSPECIFIED": 0, + "INCLUDE_ONLY": 1, + "EXCLUDE": 2 + } + } + } + } + } + }, + "RunAssetDiscoveryResponse": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "duration": { + "type": "google.protobuf.Duration", + "id": 2 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "COMPLETED": 1, + "SUPERSEDED": 2, + "TERMINATED": 3 + } + } + } + }, "Source": { "fields": { "name": { @@ -172,14 +844,23 @@ 4 ] ] - }, + } + } + }, + "v1beta1": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter", + "java_multiple_files": true, + "java_package": "com.google.cloud.securitycenter.v1beta1" + }, + "nested": { "SecurityCenter": { "methods": { "CreateSource": { "requestType": "CreateSourceRequest", "responseType": "Source", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*}/sources", + "(google.api.http).post": "/v1beta1/{parent=organizations/*}/sources", "(google.api.http).body": "source" } }, @@ -187,7 +868,7 @@ "requestType": "CreateFindingRequest", "responseType": "Finding", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*/sources/*}/findings", + "(google.api.http).post": "/v1beta1/{parent=organizations/*/sources/*}/findings", "(google.api.http).body": "finding" } }, @@ -195,7 +876,7 @@ "requestType": "google.iam.v1.GetIamPolicyRequest", "responseType": "google.iam.v1.Policy", "options": { - "(google.api.http).post": "/v1/{resource=organizations/*/sources/*}:getIamPolicy", + "(google.api.http).post": "/v1beta1/{resource=organizations/*/sources/*}:getIamPolicy", "(google.api.http).body": "*" } }, @@ -203,21 +884,21 @@ "requestType": "GetOrganizationSettingsRequest", "responseType": "OrganizationSettings", "options": { - "(google.api.http).get": "/v1/{name=organizations/*/organizationSettings}" + "(google.api.http).get": "/v1beta1/{name=organizations/*/organizationSettings}" } }, "GetSource": { "requestType": "GetSourceRequest", "responseType": "Source", "options": { - "(google.api.http).get": "/v1/{name=organizations/*/sources/*}" + "(google.api.http).get": "/v1beta1/{name=organizations/*/sources/*}" } }, "GroupAssets": { "requestType": "GroupAssetsRequest", "responseType": "GroupAssetsResponse", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*}/assets:group", + "(google.api.http).post": "/v1beta1/{parent=organizations/*}/assets:group", "(google.api.http).body": "*" } }, @@ -225,7 +906,7 @@ "requestType": "GroupFindingsRequest", "responseType": "GroupFindingsResponse", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*/sources/*}/findings:group", + "(google.api.http).post": "/v1beta1/{parent=organizations/*/sources/*}/findings:group", "(google.api.http).body": "*" } }, @@ -233,28 +914,28 @@ "requestType": "ListAssetsRequest", "responseType": "ListAssetsResponse", "options": { - "(google.api.http).get": "/v1/{parent=organizations/*}/assets" + "(google.api.http).get": "/v1beta1/{parent=organizations/*}/assets" } }, "ListFindings": { "requestType": "ListFindingsRequest", "responseType": "ListFindingsResponse", "options": { - "(google.api.http).get": "/v1/{parent=organizations/*/sources/*}/findings" + "(google.api.http).get": "/v1beta1/{parent=organizations/*/sources/*}/findings" } }, "ListSources": { "requestType": "ListSourcesRequest", "responseType": "ListSourcesResponse", "options": { - "(google.api.http).get": "/v1/{parent=organizations/*}/sources" + "(google.api.http).get": "/v1beta1/{parent=organizations/*}/sources" } }, "RunAssetDiscovery": { "requestType": "RunAssetDiscoveryRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*}/assets:runDiscovery", + "(google.api.http).post": "/v1beta1/{parent=organizations/*}/assets:runDiscovery", "(google.api.http).body": "*" } }, @@ -262,7 +943,7 @@ "requestType": "SetFindingStateRequest", "responseType": "Finding", "options": { - "(google.api.http).post": "/v1/{name=organizations/*/sources/*/findings/*}:setState", + "(google.api.http).post": "/v1beta1/{name=organizations/*/sources/*/findings/*}:setState", "(google.api.http).body": "*" } }, @@ -270,7 +951,7 @@ "requestType": "google.iam.v1.SetIamPolicyRequest", "responseType": "google.iam.v1.Policy", "options": { - "(google.api.http).post": "/v1/{resource=organizations/*/sources/*}:setIamPolicy", + "(google.api.http).post": "/v1beta1/{resource=organizations/*/sources/*}:setIamPolicy", "(google.api.http).body": "*" } }, @@ -278,7 +959,7 @@ "requestType": "google.iam.v1.TestIamPermissionsRequest", "responseType": "google.iam.v1.TestIamPermissionsResponse", "options": { - "(google.api.http).post": "/v1/{resource=organizations/*/sources/*}:testIamPermissions", + "(google.api.http).post": "/v1beta1/{resource=organizations/*/sources/*}:testIamPermissions", "(google.api.http).body": "*" } }, @@ -286,7 +967,7 @@ "requestType": "UpdateFindingRequest", "responseType": "Finding", "options": { - "(google.api.http).patch": "/v1/{finding.name=organizations/*/sources/*/findings/*}", + "(google.api.http).patch": "/v1beta1/{finding.name=organizations/*/sources/*/findings/*}", "(google.api.http).body": "finding" } }, @@ -294,7 +975,7 @@ "requestType": "UpdateOrganizationSettingsRequest", "responseType": "OrganizationSettings", "options": { - "(google.api.http).patch": "/v1/{organization_settings.name=organizations/*/organizationSettings}", + "(google.api.http).patch": "/v1beta1/{organization_settings.name=organizations/*/organizationSettings}", "(google.api.http).body": "organization_settings" } }, @@ -302,7 +983,7 @@ "requestType": "UpdateSourceRequest", "responseType": "Source", "options": { - "(google.api.http).patch": "/v1/{source.name=organizations/*/sources/*}", + "(google.api.http).patch": "/v1beta1/{source.name=organizations/*/sources/*}", "(google.api.http).body": "source" } }, @@ -310,9 +991,9 @@ "requestType": "UpdateSecurityMarksRequest", "responseType": "SecurityMarks", "options": { - "(google.api.http).patch": "/v1/{security_marks.name=organizations/*/assets/*/securityMarks}", + "(google.api.http).patch": "/v1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}", "(google.api.http).body": "security_marks", - "(google.api.http).additional_bindings.patch": "/v1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}", + "(google.api.http).additional_bindings.patch": "/v1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}", "(google.api.http).additional_bindings.body": "security_marks" } } @@ -392,13 +1073,7 @@ "type": "int32", "id": 8 } - }, - "reserved": [ - [ - 6, - 6 - ] - ] + } }, "GroupAssetsResponse": { "fields": { @@ -414,10 +1089,6 @@ "nextPageToken": { "type": "string", "id": 3 - }, - "totalSize": { - "type": "int32", - "id": 4 } } }, @@ -439,25 +1110,15 @@ "type": "google.protobuf.Timestamp", "id": 4 }, - "compareDuration": { - "type": "google.protobuf.Duration", - "id": 5 - }, "pageToken": { "type": "string", - "id": 7 + "id": 5 }, "pageSize": { "type": "int32", - "id": 8 + "id": 6 } - }, - "reserved": [ - [ - 6, - 6 - ] - ] + } }, "GroupFindingsResponse": { "fields": { @@ -473,10 +1134,6 @@ "nextPageToken": { "type": "string", "id": 3 - }, - "totalSize": { - "type": "int32", - "id": 4 } } }, @@ -555,14 +1212,8 @@ "pageSize": { "type": "int32", "id": 9 - } - }, - "reserved": [ - [ - 6, - 6 - ] - ] + } + } }, "ListAssetsResponse": { "fields": { @@ -591,18 +1242,19 @@ "type": "Asset", "id": 1 }, - "stateChange": { - "type": "StateChange", + "state": { + "type": "State", "id": 2 } }, "nested": { - "StateChange": { + "State": { "values": { - "UNUSED": 0, - "ADDED": 1, - "REMOVED": 2, - "ACTIVE": 3 + "STATE_UNSPECIFIED": 0, + "UNUSED": 1, + "ADDED": 2, + "REMOVED": 3, + "ACTIVE": 4 } } } @@ -627,35 +1279,25 @@ "type": "google.protobuf.Timestamp", "id": 4 }, - "compareDuration": { - "type": "google.protobuf.Duration", - "id": 5 - }, "fieldMask": { "type": "google.protobuf.FieldMask", - "id": 7 + "id": 5 }, "pageToken": { "type": "string", - "id": 8 + "id": 6 }, "pageSize": { "type": "int32", - "id": 9 + "id": 7 } - }, - "reserved": [ - [ - 6, - 6 - ] - ] + } }, "ListFindingsResponse": { "fields": { - "listFindingsResults": { + "findings": { "rule": "repeated", - "type": "ListFindingsResult", + "type": "Finding", "id": 1 }, "readTime": { @@ -670,31 +1312,6 @@ "type": "int32", "id": 4 } - }, - "nested": { - "ListFindingsResult": { - "fields": { - "finding": { - "type": "Finding", - "id": 1 - }, - "stateChange": { - "type": "StateChange", - "id": 2 - } - }, - "nested": { - "StateChange": { - "values": { - "UNUSED": 0, - "CHANGED": 1, - "UNCHANGED": 2, - "ADDED": 3, - "REMOVED": 4 - } - } - } - } } }, "SetFindingStateRequest": { @@ -773,6 +1390,129 @@ } } }, + "Asset": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "securityCenterProperties": { + "type": "SecurityCenterProperties", + "id": 2 + }, + "resourceProperties": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "securityMarks": { + "type": "SecurityMarks", + "id": 8 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + }, + "nested": { + "SecurityCenterProperties": { + "fields": { + "resourceName": { + "type": "string", + "id": 1 + }, + "resourceType": { + "type": "string", + "id": 2 + }, + "resourceParent": { + "type": "string", + "id": 3 + }, + "resourceProject": { + "type": "string", + "id": 4 + }, + "resourceOwners": { + "rule": "repeated", + "type": "string", + "id": 5 + } + } + } + } + }, + "SecurityMarks": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "marks": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + }, + "Finding": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "parent": { + "type": "string", + "id": 2 + }, + "resourceName": { + "type": "string", + "id": 3 + }, + "state": { + "type": "State", + "id": 4 + }, + "category": { + "type": "string", + "id": 5 + }, + "externalUri": { + "type": "string", + "id": 6 + }, + "sourceProperties": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "securityMarks": { + "type": "SecurityMarks", + "id": 8 + }, + "eventTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "INACTIVE": 2 + } + } + } + }, "OrganizationSettings": { "fields": { "name": { @@ -788,16 +1528,6 @@ "id": 3 } }, - "reserved": [ - [ - 4, - 4 - ], - [ - 5, - 5 - ] - ], "nested": { "AssetDiscoveryConfig": { "fields": { @@ -823,25 +1553,19 @@ } } }, - "RunAssetDiscoveryResponse": { + "Source": { "fields": { - "state": { - "type": "State", + "name": { + "type": "string", "id": 1 }, - "duration": { - "type": "google.protobuf.Duration", + "displayName": { + "type": "string", "id": 2 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "COMPLETED": 1, - "SUPERSEDED": 2, - "TERMINATED": 3 - } + }, + "description": { + "type": "string", + "id": 3 } } } @@ -855,7 +1579,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ResourceProto", + "java_outer_classname": "ClientProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -948,57 +1672,21 @@ } } }, - "resourceReference": { - "type": "google.api.ResourceReference", - "id": 1055, - "extend": "google.protobuf.FieldOptions" - }, - "resource": { - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.MessageOptions" + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" }, - "ResourceDescriptor": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "pattern": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "nameField": { - "type": "string", - "id": 3 - }, - "history": { - "type": "History", - "id": 4 - } - }, - "nested": { - "History": { - "values": { - "HISTORY_UNSPECIFIED": 0, - "ORIGINALLY_SINGLE_PATTERN": 1, - "FUTURE_MULTI_PATTERN": 2 - } - } - } + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" }, - "ResourceReference": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "childType": { - "type": "string", - "id": 2 - } - } + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" } } }, @@ -2020,6 +2708,9 @@ }, "nested": { "IAMPolicy": { + "options": { + "(google.api.default_host)": "iam-meta-api.googleapis.com" + }, "methods": { "SetIamPolicy": { "requestType": "SetIamPolicyRequest", @@ -2064,6 +2755,10 @@ "resource": { "type": "string", "id": 1 + }, + "options": { + "type": "google.iam.v1.GetPolicyOptions", + "id": 2 } } }, @@ -2089,6 +2784,14 @@ } } }, + "GetPolicyOptions": { + "fields": { + "requestedPolicyVersion": { + "type": "int32", + "id": 1 + } + } + }, "Policy": { "fields": { "version": { diff --git a/packages/google-cloud-securitycenter/src/browser.js b/packages/google-cloud-securitycenter/src/browser.js new file mode 100644 index 00000000000..ddbcd7ecb9a --- /dev/null +++ b/packages/google-cloud-securitycenter/src/browser.js @@ -0,0 +1,21 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +// Set a flag that we are running in a browser bundle. +global.isBrowser = true; + +// Re-export all exports from ./index.js. +module.exports = require('./index'); diff --git a/packages/google-cloud-securitycenter/src/service_proto_list.json b/packages/google-cloud-securitycenter/src/service_proto_list.json deleted file mode 100644 index 08bb6c13c79..00000000000 --- a/packages/google-cloud-securitycenter/src/service_proto_list.json +++ /dev/null @@ -1 +0,0 @@ -["../protos/google/cloud/securitycenter/v1/finding.proto", "../protos/google/cloud/securitycenter/v1/asset.proto", "../protos/google/cloud/securitycenter/v1/source.proto", "../protos/google/cloud/securitycenter/v1/securitycenter_service.proto", "../protos/google/cloud/securitycenter/v1/organization_settings.proto", "../protos/google/cloud/securitycenter/v1/security_marks.proto", "../protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto"] \ No newline at end of file diff --git a/packages/google-cloud-securitycenter/src/v1/security_center_client.js b/packages/google-cloud-securitycenter/src/v1/security_center_client.js index 5f19176dd2b..a407069fc4c 100644 --- a/packages/google-cloud-securitycenter/src/v1/security_center_client.js +++ b/packages/google-cloud-securitycenter/src/v1/security_center_client.js @@ -17,7 +17,6 @@ const gapicConfig = require('./security_center_client_config.json'); const gax = require('google-gax'); const path = require('path'); -const protobuf = require('protobufjs'); const VERSION = require('../../package.json').version; @@ -59,6 +58,16 @@ class SecurityCenterClient { opts = opts || {}; this._descriptors = {}; + if (global.isBrowser) { + // If we're in browser, we use gRPC fallback. + opts.fallback = true; + } + + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; + const servicePath = opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; @@ -75,54 +84,69 @@ class SecurityCenterClient { // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = this.constructor.scopes; - const gaxGrpc = new gax.GrpcClient(opts); + const gaxGrpc = new gaxModule.GrpcClient(opts); // Save the auth object to the client, for use by other methods. this.auth = gaxGrpc.auth; // Determine the client header string. - const clientHeader = [ - `gl-node/${process.versions.node}`, - `grpc/${gaxGrpc.grpcVersion}`, - `gax/${gax.version}`, - `gapic/${VERSION}`, - ]; + const clientHeader = []; + + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + clientHeader.push(`gax/${gaxModule.version}`); + if (opts.fallback) { + clientHeader.push(`gl-web/${gaxModule.version}`); + } else { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + clientHeader.push(`gapic/${VERSION}`); if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); const protos = gaxGrpc.loadProto( - path.join(__dirname, '..', '..', 'protos'), - ['google/cloud/securitycenter/v1/securitycenter_service.proto'] + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - assetPathTemplate: new gax.PathTemplate( + assetPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/assets/{asset}' ), - assetSecurityMarksPathTemplate: new gax.PathTemplate( + assetSecurityMarksPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/assets/{asset}/securityMarks' ), - findingPathTemplate: new gax.PathTemplate( + findingPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/{source}/findings/{finding}' ), - findingSecurityMarksPathTemplate: new gax.PathTemplate( + findingSecurityMarksPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' ), - organizationPathTemplate: new gax.PathTemplate( + organizationPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}' ), - organizationSettingsPathTemplate: new gax.PathTemplate( + organizationSettingsPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/organizationSettings' ), - organizationSourcesPathTemplate: new gax.PathTemplate( + organizationSourcesPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/-' ), - sourcePathTemplate: new gax.PathTemplate( + sourcePathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/{source}' ), }; @@ -131,48 +155,41 @@ class SecurityCenterClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - groupAssets: new gax.PageDescriptor( + groupAssets: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'groupByResults' ), - groupFindings: new gax.PageDescriptor( + groupFindings: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'groupByResults' ), - listAssets: new gax.PageDescriptor( + listAssets: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'listAssetsResults' ), - listFindings: new gax.PageDescriptor( + listFindings: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'listFindingsResults' ), - listSources: new gax.PageDescriptor( + listSources: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'sources' ), }; - let protoFilesRoot = new gax.GoogleProtoFilesRoot(); - protoFilesRoot = protobuf.loadSync( - path.join( - __dirname, - '..', - '..', - 'protos', - 'google/cloud/securitycenter/v1/securitycenter_service.proto' - ), - protoFilesRoot - ); + + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - this.operationsClient = new gax.lro({ + this.operationsClient = new gaxModule.lro({ auth: gaxGrpc.auth, grpc: gaxGrpc.grpc, }).operationsClient(opts); @@ -185,7 +202,7 @@ class SecurityCenterClient { ); this._descriptors.longrunning = { - runAssetDiscovery: new gax.LongrunningDescriptor( + runAssetDiscovery: new gaxModule.LongrunningDescriptor( this.operationsClient, runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata) @@ -208,7 +225,9 @@ class SecurityCenterClient { // Put together the "service stub" for // google.cloud.securitycenter.v1.SecurityCenter. const securityCenterStub = gaxGrpc.createStub( - protos.google.cloud.securitycenter.v1.SecurityCenter, + opts.fallback + ? protos.lookupService('google.cloud.securitycenter.v1.SecurityCenter') + : protos.google.cloud.securitycenter.v1.SecurityCenter, opts ); @@ -235,18 +254,16 @@ class SecurityCenterClient { 'updateSecurityMarks', ]; for (const methodName of securityCenterStubMethods) { - this._innerApiCalls[methodName] = gax.createApiCall( - securityCenterStub.then( - stub => - function() { - const args = Array.prototype.slice.call(arguments, 0); - return stub[methodName].apply(stub, args); - }, - err => - function() { - throw err; - } - ), + const innerCallPromise = securityCenterStub.then( + stub => (...args) => { + return stub[methodName].apply(stub, args); + }, + err => () => { + throw err; + } + ); + this._innerApiCalls[methodName] = gaxModule.createApiCall( + innerCallPromise, defaults[methodName], this._descriptors.page[methodName] || this._descriptors.longrunning[methodName] diff --git a/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json b/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json new file mode 100644 index 00000000000..684ca569657 --- /dev/null +++ b/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/securitycenter/v1/securitycenter_service.proto" +] diff --git a/packages/google-cloud-securitycenter/src/v1beta1/security_center_client.js b/packages/google-cloud-securitycenter/src/v1beta1/security_center_client.js index 8afd3b0a1b7..596fa7a2d85 100644 --- a/packages/google-cloud-securitycenter/src/v1beta1/security_center_client.js +++ b/packages/google-cloud-securitycenter/src/v1beta1/security_center_client.js @@ -17,7 +17,6 @@ const gapicConfig = require('./security_center_client_config.json'); const gax = require('google-gax'); const path = require('path'); -const protobuf = require('protobufjs'); const VERSION = require('../../package.json').version; @@ -59,6 +58,16 @@ class SecurityCenterClient { opts = opts || {}; this._descriptors = {}; + if (global.isBrowser) { + // If we're in browser, we use gRPC fallback. + opts.fallback = true; + } + + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; + const servicePath = opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; @@ -75,48 +84,63 @@ class SecurityCenterClient { // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = this.constructor.scopes; - const gaxGrpc = new gax.GrpcClient(opts); + const gaxGrpc = new gaxModule.GrpcClient(opts); // Save the auth object to the client, for use by other methods. this.auth = gaxGrpc.auth; // Determine the client header string. - const clientHeader = [ - `gl-node/${process.versions.node}`, - `grpc/${gaxGrpc.grpcVersion}`, - `gax/${gax.version}`, - `gapic/${VERSION}`, - ]; + const clientHeader = []; + + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + clientHeader.push(`gax/${gaxModule.version}`); + if (opts.fallback) { + clientHeader.push(`gl-web/${gaxModule.version}`); + } else { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + clientHeader.push(`gapic/${VERSION}`); if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); const protos = gaxGrpc.loadProto( - path.join(__dirname, '..', '..', 'protos'), - ['google/cloud/securitycenter/v1beta1/securitycenter_service.proto'] + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - assetSecurityMarksPathTemplate: new gax.PathTemplate( + assetSecurityMarksPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/assets/{asset}/securityMarks' ), - findingPathTemplate: new gax.PathTemplate( + findingPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/{source}/findings/{finding}' ), - findingSecurityMarksPathTemplate: new gax.PathTemplate( + findingSecurityMarksPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' ), - organizationPathTemplate: new gax.PathTemplate( + organizationPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}' ), - organizationSettingsPathTemplate: new gax.PathTemplate( + organizationSettingsPathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/organizationSettings' ), - sourcePathTemplate: new gax.PathTemplate( + sourcePathTemplate: new gaxModule.PathTemplate( 'organizations/{organization}/sources/{source}' ), }; @@ -125,48 +149,41 @@ class SecurityCenterClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - groupAssets: new gax.PageDescriptor( + groupAssets: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'groupByResults' ), - groupFindings: new gax.PageDescriptor( + groupFindings: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'groupByResults' ), - listAssets: new gax.PageDescriptor( + listAssets: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'listAssetsResults' ), - listFindings: new gax.PageDescriptor( + listFindings: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'findings' ), - listSources: new gax.PageDescriptor( + listSources: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'sources' ), }; - let protoFilesRoot = new gax.GoogleProtoFilesRoot(); - protoFilesRoot = protobuf.loadSync( - path.join( - __dirname, - '..', - '..', - 'protos', - 'google/cloud/securitycenter/v1beta1/securitycenter_service.proto' - ), - protoFilesRoot - ); + + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - this.operationsClient = new gax.lro({ + this.operationsClient = new gaxModule.lro({ auth: gaxGrpc.auth, grpc: gaxGrpc.grpc, }).operationsClient(opts); @@ -179,7 +196,7 @@ class SecurityCenterClient { ); this._descriptors.longrunning = { - runAssetDiscovery: new gax.LongrunningDescriptor( + runAssetDiscovery: new gaxModule.LongrunningDescriptor( this.operationsClient, runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata) @@ -202,7 +219,11 @@ class SecurityCenterClient { // Put together the "service stub" for // google.cloud.securitycenter.v1beta1.SecurityCenter. const securityCenterStub = gaxGrpc.createStub( - protos.google.cloud.securitycenter.v1beta1.SecurityCenter, + opts.fallback + ? protos.lookupService( + 'google.cloud.securitycenter.v1beta1.SecurityCenter' + ) + : protos.google.cloud.securitycenter.v1beta1.SecurityCenter, opts ); @@ -229,18 +250,16 @@ class SecurityCenterClient { 'updateSecurityMarks', ]; for (const methodName of securityCenterStubMethods) { - this._innerApiCalls[methodName] = gax.createApiCall( - securityCenterStub.then( - stub => - function() { - const args = Array.prototype.slice.call(arguments, 0); - return stub[methodName].apply(stub, args); - }, - err => - function() { - throw err; - } - ), + const innerCallPromise = securityCenterStub.then( + stub => (...args) => { + return stub[methodName].apply(stub, args); + }, + err => () => { + throw err; + } + ); + this._innerApiCalls[methodName] = gaxModule.createApiCall( + innerCallPromise, defaults[methodName], this._descriptors.page[methodName] || this._descriptors.longrunning[methodName] diff --git a/packages/google-cloud-securitycenter/src/v1beta1/security_center_proto_list.json b/packages/google-cloud-securitycenter/src/v1beta1/security_center_proto_list.json new file mode 100644 index 00000000000..24e63a24411 --- /dev/null +++ b/packages/google-cloud-securitycenter/src/v1beta1/security_center_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto" +] diff --git a/packages/google-cloud-securitycenter/synth.metadata b/packages/google-cloud-securitycenter/synth.metadata index a3be3edca7d..7189b6bf0ff 100644 --- a/packages/google-cloud-securitycenter/synth.metadata +++ b/packages/google-cloud-securitycenter/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-08-28T11:20:59.012640Z", + "updateTime": "2019-08-31T11:17:38.289655Z", "sources": [ { "generator": { "name": "artman", - "version": "0.35.1", - "dockerImage": "googleapis/artman@sha256:b11c7ea0d0831c54016fb50f4b796d24d1971439b30fbc32a369ba1ac887c384" + "version": "0.36.1", + "dockerImage": "googleapis/artman@sha256:7c20f006c7a62d9d782e2665647d52290c37a952ef3cd134624d5dd62b3f71bd" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dbd38035c35083507e2f0b839985cf17e212cb1c", - "internalRef": "265796259" + "sha": "82809578652607c8ee29d9e199c21f28f81a03e0", + "internalRef": "266247326" } }, { diff --git a/packages/google-cloud-securitycenter/synth.py b/packages/google-cloud-securitycenter/synth.py index 2faecd05b3d..ffcd43df6b0 100644 --- a/packages/google-cloud-securitycenter/synth.py +++ b/packages/google-cloud-securitycenter/synth.py @@ -83,3 +83,4 @@ # Node.js specific cleanup subprocess.run(['npm', 'install']) subprocess.run(['npm', 'run', 'fix']) +subprocess.run(['npx', 'compileProtos', 'src']) diff --git a/packages/google-cloud-securitycenter/test/gapic-v1.js b/packages/google-cloud-securitycenter/test/gapic-v1.js index 10c065cdb8e..dba9a6501fc 100644 --- a/packages/google-cloud-securitycenter/test/gapic-v1.js +++ b/packages/google-cloud-securitycenter/test/gapic-v1.js @@ -46,6 +46,13 @@ describe('SecurityCenterClient', () => { assert(client); }); + it('should create a client with gRPC fallback', () => { + const client = new securityCenterModule.v1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + describe('createSource', () => { it('invokes createSource without error', done => { const client = new securityCenterModule.v1.SecurityCenterClient({ diff --git a/packages/google-cloud-securitycenter/webpack.config.js b/packages/google-cloud-securitycenter/webpack.config.js new file mode 100644 index 00000000000..ca4a2ec15e6 --- /dev/null +++ b/packages/google-cloud-securitycenter/webpack.config.js @@ -0,0 +1,46 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +module.exports = { + entry: './src/browser.js', + output: { + library: 'security-center', + filename: './security-center.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + extensions: ['.js', '.json'], + }, + module: { + rules: [ + { + test: /node_modules[\\/]retry-request[\\/]/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]https-proxy-agent[\\/]/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gtoken[\\/]/, + use: 'null-loader', + }, + ], + }, + mode: 'production', +};