> ## Documentation Index
> Fetch the complete documentation index at: https://densify-sync-changelog-7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Run GCP data collection+analysis, or re-run analysis

> - **Initial run**: provide a GCP service account credential and `projectId`. Schedules
  nightly collection and analysis; can set `connectionName` and a `webHook`.
- **Re-run**: call again with the same `projectId` (+ optional new `webHook`); does **not**
  collect data.
- Request is rejected if collection/analysis is in progress or within ~30 minutes of the
  scheduled tasks.




## OpenAPI

````yaml openapi/public_cloud/Analysis_GCP_Analyze.yaml POST /analysis/gcp/analyze
openapi: 3.1.0
info:
  title: Kubex – GCP Analysis API
  version: 1.0.0
  description: |
    POST `/analysis/gcp/analyze`:
      - First run: creates the connection (for the given GCP service account + project),
        collects data, runs analysis, and (optionally) sends results to a webhook.
      - Re-run: runs analysis only (no data collection); can update webhook.
      - Historical audit: once-off collection of up to 30 days of past data via
        `/analysis/cloud/gcp/analyze` with offsets.
    GET `/analysis/cloud/gcp`: lists generated analyses to obtain `analysisId`.
servers:
  - url: https://{host}
    variables:
      host:
        default: api.example.com
security: []
tags:
  - name: GCP Analysis
paths:
  /analysis/gcp/analyze:
    post:
      tags:
        - GCP Analysis
      summary: Run GCP data collection+analysis, or re-run analysis
      description: >
        - **Initial run**: provide a GCP service account credential and
        `projectId`. Schedules
          nightly collection and analysis; can set `connectionName` and a `webHook`.
        - **Re-run**: call again with the same `projectId` (+ optional new
        `webHook`); does **not**
          collect data.
        - Request is rejected if collection/analysis is in progress or within
        ~30 minutes of the
          scheduled tasks.
      operationId: analyzeGcp
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GcpAnalyzeRequest'
            examples:
              initialRun:
                summary: Create connection, collect, analyze, set webhook
                value:
                  connectionName: gcp-testing
                  policyInstanceId: 583e0068-45a3-4c4e-baec-473d4daa4095
                  projectId: pm-testing-608378
                  credential:
                    type: service_account
                    project_id: engineering-183318
                    private_key_id: REDACTED
                    private_key: |-
                      -----BEGIN PRIVATE KEY-----
                      …
                      -----END PRIVATE KEY-----
                    client_email: '[email protected]'
                    client_id: '28884131006232124'
                    auth_uri: https://accounts.google.com/o/oauth2/auth
                    token_uri: https://oauth2.googleapis.com/token
                    auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
                    client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/…
                  webHook:
                    uri: http://mywebhookserver/webhook/results
                    authType: basic
                    authValue: tester:testerpassword
              rerun:
                summary: Re-run analysis only (no collection)
                value:
                  projectId: pm-testing-608378
                  credential: …same service-account JSON as string or object…
                  webHook:
                    uri: https://example.test/webhook/results
      responses:
        '200':
          description: Accepted / analysis initiated or in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyzeStatusMessage'
              examples:
                inProgress:
                  value:
                    href: Not available
                    message: Analysis in progress
                    status: 200
        '400':
          description: Invalid parameters.
        '401':
          description: Authentication failed.
        '404':
          description: Resource not found.
        '500':
          description: Internal server error.
components:
  schemas:
    GcpAnalyzeRequest:
      type: object
      properties:
        connectionName:
          type: string
          maxLength: 32
          description: Unique within GCP connections; defaults to the project ID.
        policyInstanceId:
          type: string
          description: Policy instance to use for analysis (optional, shown in example).
        projectId:
          type: string
          description: >-
            GCP project ID to analyze (required even if the credential maps to
            multiple projects).
        credential:
          $ref: '#/components/schemas/CredentialStringOrObject'
        webHook:
          $ref: '#/components/schemas/WebHook'
      required:
        - projectId
        - credential
    AnalyzeStatusMessage:
      type: object
      properties:
        href:
          type: string
          description: Link to recommendations (if available).
        message:
          type: string
        status:
          type: integer
          format: int32
          description: One of 200, 400, 401, 404, 500.
      required:
        - message
        - status
    CredentialStringOrObject:
      description: >-
        GCP service account credential (inline JSON). Docs show both string and
        object usage.
      oneOf:
        - type: string
          description: Raw JSON string of the `.json` keyfile
        - type: object
          additionalProperties: true
          description: Parsed JSON object of the keyfile
    WebHook:
      type: object
      additionalProperties: false
      properties:
        uri:
          type: string
          format: uri
        authType:
          type: string
          description: >-
            Authentication scheme used by the webhook endpoint (e.g., basic,
            bearer).
        authValue:
          type: string
          description: Credential value (e.g., user:pass for basic, or token).
      required:
        - uri

````