# Cloud Logging API . billingAccounts . locations . savedQueries

## Instance Methods

Close httplib2 connections.

Creates a new SavedQuery for the user making the request.

Deletes an existing SavedQuery that was created by the user making the request.

Returns all data associated with the requested query.

Lists the SavedQueries that were created by the user making the request.

Retrieves the next page of results.

Updates an existing SavedQuery.

### Method Details

`close()`

    Close httplib2 connections.

`create(parent, body=None, savedQueryId=None, x__xgafv=None)`

    Creates a new SavedQuery for the user making the request.

    Args:
      parent: string, Required. The parent resource in which to create the saved query: "projects/[PROJECT_ID]/locations/[LOCATION_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]" For example: "projects/my-project/locations/global" "organizations/123456789/locations/us-central1"  (required)
      body: object, The request body.
        The object takes the form of:

    { # Describes a query that has been saved by a user.
      "createTime": "A String", # Output only. The timestamp when the saved query was created.
      "description": "A String", # Optional. A human readable description of the saved query.
      "displayName": "A String", # Required. The user specified title for the SavedQuery.
      "loggingQuery": { # Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. # Logging query that can be executed in Logs Explorer or via Logging API.
        "filter": "A String", # Required. An advanced query using the Logging Query Language (https://cloud.google.com/logging/docs/view/logging-query-language). The maximum length of the filter is 20000 characters.
        "summaryFieldEnd": 42, # Characters will be counted from the end of the string.
        "summaryFieldStart": 42, # Characters will be counted from the start of the string.
        "summaryFields": [ # Optional. The set of summary fields to display for this saved query.
          { # A field from the LogEntry that is added to the summary line (https://cloud.google.com/logging/docs/view/logs-explorer-interface#add-summary-fields) for a query in the Logs Explorer.
            "field": "A String", # Optional. The field from the LogEntry to include in the summary line, for example resource.type or jsonPayload.name.
          },
        ],
      },
      "name": "A String", # Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID.
      "opsAnalyticsQuery": { # Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. # Analytics query that can be executed in Log Analytics.
        "sqlQueryText": "A String", # Required. A logs analytics SQL query, which generally follows BigQuery format.This is the SQL query that appears in the Log Analytics UI's query editor.
      },
      "updateTime": "A String", # Output only. The timestamp when the saved query was last updated.
      "visibility": "A String", # Required. The visibility status of this query, which determines its ownership.
    }

      savedQueryId: string, Optional. The ID to use for the saved query, which will become the final component of the saved query's resource name.If the saved_query_id is not provided, the system will generate an alphanumeric ID.The saved_query_id is limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, periods.First character has to be alphanumeric.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Describes a query that has been saved by a user.
      "createTime": "A String", # Output only. The timestamp when the saved query was created.
      "description": "A String", # Optional. A human readable description of the saved query.
      "displayName": "A String", # Required. The user specified title for the SavedQuery.
      "loggingQuery": { # Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. # Logging query that can be executed in Logs Explorer or via Logging API.
        "filter": "A String", # Required. An advanced query using the Logging Query Language (https://cloud.google.com/logging/docs/view/logging-query-language). The maximum length of the filter is 20000 characters.
        "summaryFieldEnd": 42, # Characters will be counted from the end of the string.
        "summaryFieldStart": 42, # Characters will be counted from the start of the string.
        "summaryFields": [ # Optional. The set of summary fields to display for this saved query.
          { # A field from the LogEntry that is added to the summary line (https://cloud.google.com/logging/docs/view/logs-explorer-interface#add-summary-fields) for a query in the Logs Explorer.
            "field": "A String", # Optional. The field from the LogEntry to include in the summary line, for example resource.type or jsonPayload.name.
          },
        ],
      },
      "name": "A String", # Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID.
      "opsAnalyticsQuery": { # Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. # Analytics query that can be executed in Log Analytics.
        "sqlQueryText": "A String", # Required. A logs analytics SQL query, which generally follows BigQuery format.This is the SQL query that appears in the Log Analytics UI's query editor.
      },
      "updateTime": "A String", # Output only. The timestamp when the saved query was last updated.
      "visibility": "A String", # Required. The visibility status of this query, which determines its ownership.
    }

`delete(name, x__xgafv=None)`

    Deletes an existing SavedQuery that was created by the user making the request.

    Args:
      name: string, Required. The full resource name of the saved query to delete. "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For example: "projects/my-project/locations/global/savedQueries/my-saved-query"  (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
    }

`get(name, x__xgafv=None)`

    Returns all data associated with the requested query.

    Args:
      name: string, Required. The resource name of the saved query. "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For example: "projects/my-project/locations/global/savedQueries/my-saved-query"  (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Describes a query that has been saved by a user.
      "createTime": "A String", # Output only. The timestamp when the saved query was created.
      "description": "A String", # Optional. A human readable description of the saved query.
      "displayName": "A String", # Required. The user specified title for the SavedQuery.
      "loggingQuery": { # Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. # Logging query that can be executed in Logs Explorer or via Logging API.
        "filter": "A String", # Required. An advanced query using the Logging Query Language (https://cloud.google.com/logging/docs/view/logging-query-language). The maximum length of the filter is 20000 characters.
        "summaryFieldEnd": 42, # Characters will be counted from the end of the string.
        "summaryFieldStart": 42, # Characters will be counted from the start of the string.
        "summaryFields": [ # Optional. The set of summary fields to display for this saved query.
          { # A field from the LogEntry that is added to the summary line (https://cloud.google.com/logging/docs/view/logs-explorer-interface#add-summary-fields) for a query in the Logs Explorer.
            "field": "A String", # Optional. The field from the LogEntry to include in the summary line, for example resource.type or jsonPayload.name.
          },
        ],
      },
      "name": "A String", # Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID.
      "opsAnalyticsQuery": { # Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. # Analytics query that can be executed in Log Analytics.
        "sqlQueryText": "A String", # Required. A logs analytics SQL query, which generally follows BigQuery format.This is the SQL query that appears in the Log Analytics UI's query editor.
      },
      "updateTime": "A String", # Output only. The timestamp when the saved query was last updated.
      "visibility": "A String", # Required. The visibility status of this query, which determines its ownership.
    }

`list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)`

    Lists the SavedQueries that were created by the user making the request.

    Args:
      parent: string, Required. The resource to which the listed queries belong. "projects/[PROJECT_ID]/locations/[LOCATION_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]" For example: "projects/my-project/locations/us-central1" Note: The locations portion of the resource must be specified. To get a list of all saved queries, a wildcard character - can be used for LOCATION_ID, for example: "projects/my-project/locations/-"  (required)
      filter: string, Optional. Specifies the type ("Logging" or "OpsAnalytics") and the visibility (PRIVATE or SHARED) of the saved queries to list. If provided, the filter must contain either the type function or a visibility token, or both. If both are chosen, they can be placed in any order, but they must be joined by the AND operator or the empty character.The two supported type function calls are: type("Logging") type("OpsAnalytics")The two supported visibility tokens are: visibility = PRIVATE visibility = SHAREDFor example:type("Logging") AND visibility = PRIVATE visibility=SHARED type("OpsAnalytics") type("OpsAnalytics)" visibility = PRIVATE visibility = SHARED
      pageSize: integer, Optional. The maximum number of results to return from this request.Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.
      pageToken: string, Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The response from ListSavedQueries.
      "nextPageToken": "A String", # If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call the same method again using the value of nextPageToken as pageToken.
      "savedQueries": [ # A list of saved queries.
        { # Describes a query that has been saved by a user.
          "createTime": "A String", # Output only. The timestamp when the saved query was created.
          "description": "A String", # Optional. A human readable description of the saved query.
          "displayName": "A String", # Required. The user specified title for the SavedQuery.
          "loggingQuery": { # Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. # Logging query that can be executed in Logs Explorer or via Logging API.
            "filter": "A String", # Required. An advanced query using the Logging Query Language (https://cloud.google.com/logging/docs/view/logging-query-language). The maximum length of the filter is 20000 characters.
            "summaryFieldEnd": 42, # Characters will be counted from the end of the string.
            "summaryFieldStart": 42, # Characters will be counted from the start of the string.
            "summaryFields": [ # Optional. The set of summary fields to display for this saved query.
              { # A field from the LogEntry that is added to the summary line (https://cloud.google.com/logging/docs/view/logs-explorer-interface#add-summary-fields) for a query in the Logs Explorer.
                "field": "A String", # Optional. The field from the LogEntry to include in the summary line, for example resource.type or jsonPayload.name.
              },
            ],
          },
          "name": "A String", # Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID.
          "opsAnalyticsQuery": { # Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. # Analytics query that can be executed in Log Analytics.
            "sqlQueryText": "A String", # Required. A logs analytics SQL query, which generally follows BigQuery format.This is the SQL query that appears in the Log Analytics UI's query editor.
          },
          "updateTime": "A String", # Output only. The timestamp when the saved query was last updated.
          "visibility": "A String", # Required. The visibility status of this query, which determines its ownership.
        },
      ],
      "unreachable": [ # The unreachable resources. It can be either 1) a saved query if a specific query is unreachable or 2) a location if a specific location is unreachabe. "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" "projects/[PROJECT_ID]/locations/[LOCATION_ID]" For example: "projects/my-project/locations/global/savedQueries/12345678" "projects/my-project/locations/global" If there are unreachable resources, the response will first return pages that contain saved queries, and then return pages that contain the unreachable resources.
        "A String",
      ],
    }

`list_next()`

    Retrieves the next page of results.

            Args:
              previous_request: The request for the previous page. (required)
              previous_response: The response from the request for the previous page. (required)

            Returns:
              A request object that you can call 'execute()' on to request the next
              page. Returns None if there are no more items in the collection.

`patch(name, body=None, updateMask=None, x__xgafv=None)`

    Updates an existing SavedQuery.

    Args:
      name: string, Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID. (required)
      body: object, The request body.
        The object takes the form of:

    { # Describes a query that has been saved by a user.
      "createTime": "A String", # Output only. The timestamp when the saved query was created.
      "description": "A String", # Optional. A human readable description of the saved query.
      "displayName": "A String", # Required. The user specified title for the SavedQuery.
      "loggingQuery": { # Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. # Logging query that can be executed in Logs Explorer or via Logging API.
        "filter": "A String", # Required. An advanced query using the Logging Query Language (https://cloud.google.com/logging/docs/view/logging-query-language). The maximum length of the filter is 20000 characters.
        "summaryFieldEnd": 42, # Characters will be counted from the end of the string.
        "summaryFieldStart": 42, # Characters will be counted from the start of the string.
        "summaryFields": [ # Optional. The set of summary fields to display for this saved query.
          { # A field from the LogEntry that is added to the summary line (https://cloud.google.com/logging/docs/view/logs-explorer-interface#add-summary-fields) for a query in the Logs Explorer.
            "field": "A String", # Optional. The field from the LogEntry to include in the summary line, for example resource.type or jsonPayload.name.
          },
        ],
      },
      "name": "A String", # Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID.
      "opsAnalyticsQuery": { # Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. # Analytics query that can be executed in Log Analytics.
        "sqlQueryText": "A String", # Required. A logs analytics SQL query, which generally follows BigQuery format.This is the SQL query that appears in the Log Analytics UI's query editor.
      },
      "updateTime": "A String", # Output only. The timestamp when the saved query was last updated.
      "visibility": "A String", # Required. The visibility status of this query, which determines its ownership.
    }

      updateMask: string, Required. A non-empty list of fields to change in the existing saved query. Fields are relative to the saved_query and new values for the fields are taken from the corresponding fields in the SavedQuery included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.To update all mutable fields, specify an update_mask of *.For example, to change the description and query filter text of a saved query, specify an update_mask of "description, query.filter".
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Describes a query that has been saved by a user.
      "createTime": "A String", # Output only. The timestamp when the saved query was created.
      "description": "A String", # Optional. A human readable description of the saved query.
      "displayName": "A String", # Required. The user specified title for the SavedQuery.
      "loggingQuery": { # Describes a Cloud Logging query that can be run in Logs Explorer UI or via the logging API.In addition to the query itself, additional information may be stored to capture the display configuration and other UI state used in association with analysis of query results. # Logging query that can be executed in Logs Explorer or via Logging API.
        "filter": "A String", # Required. An advanced query using the Logging Query Language (https://cloud.google.com/logging/docs/view/logging-query-language). The maximum length of the filter is 20000 characters.
        "summaryFieldEnd": 42, # Characters will be counted from the end of the string.
        "summaryFieldStart": 42, # Characters will be counted from the start of the string.
        "summaryFields": [ # Optional. The set of summary fields to display for this saved query.
          { # A field from the LogEntry that is added to the summary line (https://cloud.google.com/logging/docs/view/logs-explorer-interface#add-summary-fields) for a query in the Logs Explorer.
            "field": "A String", # Optional. The field from the LogEntry to include in the summary line, for example resource.type or jsonPayload.name.
          },
        ],
      },
      "name": "A String", # Output only. Resource name of the saved query.In the format: "projects/[PROJECT_ID]/locations/[LOCATION_ID]/savedQueries/[QUERY_ID]" For a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support#bucket-regions)After the saved query is created, the location cannot be changed.If the user doesn't provide a QUERY_ID, the system will generate an alphanumeric ID.
      "opsAnalyticsQuery": { # Describes an analytics query that can be run in the Log Analytics page of Google Cloud console.Preview: This is a preview feature and may be subject to change before final release. # Analytics query that can be executed in Log Analytics.
        "sqlQueryText": "A String", # Required. A logs analytics SQL query, which generally follows BigQuery format.This is the SQL query that appears in the Log Analytics UI's query editor.
      },
      "updateTime": "A String", # Output only. The timestamp when the saved query was last updated.
      "visibility": "A String", # Required. The visibility status of this query, which determines its ownership.
    }