Method: instances.suggestSql

Full name: projects.locations.instances.suggestSql

instances.suggestSql suggests auto completion text for a GoogleSQL query.

HTTP request

GET https://{endpoint}/v1alpha/{instance}:suggestSql

Where {endpoint} is one of the supported service endpoints.

Path parameters

Parameters
instance

string

Required. The instance that the query is running in. Format: projects/{project}/locations/{location}/instances/{instance}

Query parameters

Parameters
text

string

Required. The text to suggest auto completion for. Limited to text size of 10k characters.

position

object (Position)

Required. The position of the cursor in the text.

Request body

The request body must be empty.

Response body

The response for the instances.suggestSql RPC. provides auto completion text for GoogleSQL query.

If successful, the response body contains data with the following structure:

JSON representation
{
  "completionItems": [
    {
      object (CompletionItem)
    }
  ]
}
Fields
completionItems[]

object (CompletionItem)

The suggested auto completion text.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/chronicle
  • https://www.googleapis.com/auth/chronicle.readonly

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the instance resource:

  • chronicle.queries.suggestSql

For more information, see the IAM documentation.

Position

Represents a position in a document.

JSON representation
{
  "line": integer,
  "column": integer
}
Fields
line

integer

Required. The line number, 0-based.

column

integer

Required. The column number, 0-based.

CompletionItem

Completion Item

JSON representation
{
  "kind": enum (CompletionItemKind),
  "label": string,
  "insertText": string,
  "textEditRange": {
    object (EditRange)
  }
}
Fields
kind

enum (CompletionItemKind)

The kind of this completion item.

label

string

The label of this completion item. By default also the text that is inserted when selecting this completion.

insertText

string

The text to be inserted when selecting this completion.

textEditRange

object (EditRange)

The range that should be replaced when inserting this completion.

CompletionItemKind

Completion Item Kind

Enums
COMPLETION_ITEM_KIND_UNSPECIFIED default
COMPLETION_ITEM_TEXT Text
COMPLETION_ITEM_METHOD Method
COMPLETION_ITEM_FUNCTION Function
COMPLETION_ITEM_CONSTRUCTOR Constructor
COMPLETION_ITEM_FIELD Field
COMPLETION_ITEM_VARIABLE Variable
COMPLETION_ITEM_CLASS Class
COMPLETION_ITEM_INTERFACE Interface
COMPLETION_ITEM_MODULE Module
COMPLETION_ITEM_PROPERTY Property
COMPLETION_ITEM_UNIT Unit
COMPLETION_ITEM_VALUE Value
COMPLETION_ITEM_ENUM Enum
COMPLETION_ITEM_KEYWORD Keyword
COMPLETION_ITEM_SNIPPET Snippet
COMPLETION_ITEM_COLOR Color
COMPLETION_ITEM_FILE File
COMPLETION_ITEM_REFERENCE Reference
COMPLETION_ITEM_TYPE Type

EditRange

Edit Range to apply a completion to.

JSON representation
{
  "startLineNumber": integer,
  "startColumn": integer,
  "endLineNumber": integer,
  "endColumn": integer
}
Fields
startLineNumber

integer

Line number on which the range starts (starts at 0).

startColumn

integer

Column on which the range starts in line startLineNumber (starts at 0).

endLineNumber

integer

Line number on which the range ends.

endColumn

integer

Column on which the range ends in line endLineNumber.