{
  "swagger": "2.0",
  "info": {
    "title": "Connection service",
    "version": "0.1507.0",
    "description": "Send your API key as a bearer token: `Authorization: Bearer <api key>`."
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Your API key as a bearer token: `Authorization: Bearer <api key>`."
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/data-source/connection/v1/connections": {
      "post": {
        "operationId": "ConnectionService_createConnection",
        "summary": "Create connection",
        "tags": [
          "Connection Service"
        ],
        "description": "Creates a new connection.",
        "deprecated": true,
        "x-deprecated": "Use CatalogService#createDataset to create a dataset, then ConnectionService#registerExternalConnectionConfig to register external connection config on it.",
        "parameters": [
          {
            "name": "createConnection",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/CreateConnection"
            },
            "required": true,
            "x-example": {
              "name": "<name>",
              "connectionDetails": {
                "type": "timescale",
                "timescale": {
                  "database": "<database>",
                  "host": "<host>",
                  "port": 1,
                  "username": "<username>",
                  "passwordSecretRid": "<secret rid>"
                }
              },
              "shouldScrape": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Connection"
            },
            "x-example": {
              "rid": "<connection rid>",
              "displayName": "<display name>",
              "description": "<description>",
              "connectionDetails": {
                "type": "timescale",
                "timescale": {
                  "database": "<database>",
                  "host": "<host>",
                  "port": 1,
                  "username": "<username>",
                  "passwordSecretRid": "<secret rid>"
                }
              },
              "requiredTagNames": [
                "<tag name>"
              ],
              "metadata": {
                "<key>": "<value>"
              },
              "scraping": {
                "type": "influx",
                "influx": {
                  "filter": [
                    {
                      "type": "matchBucket",
                      "matchBucket": [
                        "<bucket name>"
                      ]
                    }
                  ],
                  "seriesArchetypeConstruction": {
                    "channelNameComponents": [
                      {
                        "type": "bucket",
                        "bucket": {}
                      }
                    ],
                    "separator": "<separator>"
                  }
                }
              },
              "shouldScrape": true,
              "limits": {
                "maxQueryRange": {
                  "unit": "HOURS",
                  "count": 1
                }
              },
              "connectionStatus": {
                "isConnected": true
              },
              "isArchived": true
            }
          }
        }
      },
      "get": {
        "operationId": "ConnectionService_listConnections",
        "summary": "List connections",
        "tags": [
          "Connection Service"
        ],
        "description": "Lists all connections.",
        "deprecated": true,
        "x-deprecated": "Use listConnectionsV2 for paginated results.",
        "parameters": [
          {
            "name": "includeArchived",
            "in": "query",
            "type": "boolean",
            "required": false,
            "description": "Whether to include archived connections in the response. By default, this is false."
          },
          {
            "name": "workspaces",
            "in": "query",
            "type": "array",
            "items": {
              "type": "string",
              "format": "rid",
              "x-alias": "WorkspaceRid"
            },
            "collectionFormat": "multi",
            "required": false,
            "description": "If supplied, will return only the connections within the supplied workspaces. If empty will return all connections for workspaces that the user is permitted to see."
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Connection"
              },
              "uniqueItems": true
            },
            "x-example": [
              {
                "rid": "<connection rid>",
                "displayName": "<display name>",
                "description": "<description>",
                "connectionDetails": {
                  "type": "timescale",
                  "timescale": {
                    "database": "<database>",
                    "host": "<host>",
                    "port": 1,
                    "username": "<username>",
                    "passwordSecretRid": "<secret rid>"
                  }
                },
                "requiredTagNames": [
                  "<tag name>"
                ],
                "metadata": {
                  "<key>": "<value>"
                },
                "scraping": {
                  "type": "influx",
                  "influx": {
                    "filter": [
                      {
                        "type": "matchBucket",
                        "matchBucket": [
                          "<bucket name>"
                        ]
                      }
                    ],
                    "seriesArchetypeConstruction": {
                      "channelNameComponents": [
                        {
                          "type": "bucket",
                          "bucket": {}
                        }
                      ],
                      "separator": "<separator>"
                    }
                  }
                },
                "shouldScrape": true,
                "limits": {
                  "maxQueryRange": {
                    "unit": "HOURS",
                    "count": 1
                  }
                },
                "connectionStatus": {
                  "isConnected": true
                },
                "isArchived": true
              }
            ]
          }
        }
      }
    },
    "/data-source/connection/v1/connection/{rid}/details": {
      "put": {
        "operationId": "ConnectionService_updateConnection",
        "summary": "Update connection",
        "tags": [
          "Connection Service"
        ],
        "description": "Updates an existing connection.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "ConnectionRid",
            "required": true
          },
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/UpdateConnectionRequest"
            },
            "required": true,
            "x-example": {
              "name": "<name>",
              "description": "<description>",
              "metadata": {
                "<key>": "<value>"
              },
              "connectionDetails": {
                "type": "timescale",
                "timescale": {
                  "database": "<database>",
                  "host": "<host>",
                  "port": 1,
                  "username": "<username>",
                  "passwordSecretRid": "<secret rid>"
                }
              },
              "requiredTagNames": [
                "<tag name>"
              ],
              "availableTagValues": {
                "<key>": [
                  "<tag value>"
                ]
              },
              "scraping": {
                "type": "influx",
                "influx": {
                  "seriesArchetypeConstruction": {
                    "separator": "<separator>"
                  }
                }
              },
              "shouldScrape": true,
              "limits": {
                "maxQueryRange": {
                  "unit": "HOURS",
                  "count": 1
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Connection"
            },
            "x-example": {
              "rid": "<connection rid>",
              "displayName": "<display name>",
              "description": "<description>",
              "connectionDetails": {
                "type": "timescale",
                "timescale": {
                  "database": "<database>",
                  "host": "<host>",
                  "port": 1,
                  "username": "<username>",
                  "passwordSecretRid": "<secret rid>"
                }
              },
              "requiredTagNames": [
                "<tag name>"
              ],
              "metadata": {
                "<key>": "<value>"
              },
              "scraping": {
                "type": "influx",
                "influx": {
                  "filter": [
                    {
                      "type": "matchBucket",
                      "matchBucket": [
                        "<bucket name>"
                      ]
                    }
                  ],
                  "seriesArchetypeConstruction": {
                    "channelNameComponents": [
                      {
                        "type": "bucket",
                        "bucket": {}
                      }
                    ],
                    "separator": "<separator>"
                  }
                }
              },
              "shouldScrape": true,
              "limits": {
                "maxQueryRange": {
                  "unit": "HOURS",
                  "count": 1
                }
              },
              "connectionStatus": {
                "isConnected": true
              },
              "isArchived": true
            }
          }
        }
      }
    },
    "/data-source/connection/v1/connection/{rid}/status": {
      "put": {
        "operationId": "ConnectionService_updateConnectionStatus",
        "summary": "Update connection status",
        "tags": [
          "Connection Service"
        ],
        "description": "Updates an existing connection status.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "ConnectionRid",
            "required": true
          },
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/ConnectionStatus"
            },
            "required": true,
            "x-example": {
              "isConnected": true
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    },
    "/data-source/connection/v1/connection/{rid}": {
      "get": {
        "operationId": "ConnectionService_getConnection",
        "summary": "Get connection",
        "tags": [
          "Connection Service"
        ],
        "description": "Gets a connection by its RID.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "ConnectionRid",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Connection"
            },
            "x-example": {
              "rid": "<connection rid>",
              "displayName": "<display name>",
              "description": "<description>",
              "connectionDetails": {
                "type": "timescale",
                "timescale": {
                  "database": "<database>",
                  "host": "<host>",
                  "port": 1,
                  "username": "<username>",
                  "passwordSecretRid": "<secret rid>"
                }
              },
              "requiredTagNames": [
                "<tag name>"
              ],
              "metadata": {
                "<key>": "<value>"
              },
              "scraping": {
                "type": "influx",
                "influx": {
                  "filter": [
                    {
                      "type": "matchBucket",
                      "matchBucket": [
                        "<bucket name>"
                      ]
                    }
                  ],
                  "seriesArchetypeConstruction": {
                    "channelNameComponents": [
                      {
                        "type": "bucket",
                        "bucket": {}
                      }
                    ],
                    "separator": "<separator>"
                  }
                }
              },
              "shouldScrape": true,
              "limits": {
                "maxQueryRange": {
                  "unit": "HOURS",
                  "count": 1
                }
              },
              "connectionStatus": {
                "isConnected": true
              },
              "isArchived": true
            }
          }
        }
      }
    },
    "/data-source/connection/v1/connection/multiple": {
      "post": {
        "operationId": "ConnectionService_getConnections",
        "summary": "Get connections",
        "tags": [
          "Connection Service"
        ],
        "description": "Gets a set of connections by their RIDs.",
        "parameters": [
          {
            "name": "rids",
            "in": "body",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "rid",
                "x-alias": "ConnectionRid"
              },
              "uniqueItems": true,
              "example": [
                "<connection rid>"
              ]
            },
            "required": false,
            "x-example": [
              "<connection rid>"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Connection"
              },
              "uniqueItems": true
            },
            "x-example": [
              {
                "rid": "<connection rid>",
                "displayName": "<display name>",
                "description": "<description>",
                "connectionDetails": {
                  "type": "timescale",
                  "timescale": {
                    "database": "<database>",
                    "host": "<host>",
                    "port": 1,
                    "username": "<username>",
                    "passwordSecretRid": "<secret rid>"
                  }
                },
                "requiredTagNames": [
                  "<tag name>"
                ],
                "metadata": {
                  "<key>": "<value>"
                },
                "scraping": {
                  "type": "influx",
                  "influx": {
                    "filter": [
                      {
                        "type": "matchBucket",
                        "matchBucket": [
                          "<bucket name>"
                        ]
                      }
                    ],
                    "seriesArchetypeConstruction": {
                      "channelNameComponents": [
                        {
                          "type": "bucket",
                          "bucket": {}
                        }
                      ],
                      "separator": "<separator>"
                    }
                  }
                },
                "shouldScrape": true,
                "limits": {
                  "maxQueryRange": {
                    "unit": "HOURS",
                    "count": 1
                  }
                },
                "connectionStatus": {
                  "isConnected": true
                },
                "isArchived": true
              }
            ]
          }
        }
      }
    },
    "/data-source/connection/v2/connections": {
      "get": {
        "operationId": "ConnectionService_listConnectionsV2",
        "summary": "List connections v2",
        "tags": [
          "Connection Service"
        ],
        "description": "Lists connections with pagination. Returns connections ordered by creation time descending.",
        "parameters": [
          {
            "name": "includeArchived",
            "in": "query",
            "type": "boolean",
            "required": false,
            "description": "Whether to include archived connections in the response. By default, this is false."
          },
          {
            "name": "workspaces",
            "in": "query",
            "type": "array",
            "items": {
              "type": "string",
              "format": "rid",
              "x-alias": "WorkspaceRid"
            },
            "collectionFormat": "multi",
            "required": false,
            "description": "If supplied, will return only the connections within the supplied workspaces. If empty will return all connections for workspaces that the user is permitted to see."
          },
          {
            "name": "pageSize",
            "in": "query",
            "type": "integer",
            "format": "int32",
            "required": false,
            "description": "Number of connections to return per page. Defaults to 100. Will return at most 1000 records per page."
          },
          {
            "name": "nextPageToken",
            "in": "query",
            "type": "string",
            "x-alias": "Token",
            "required": false,
            "description": "Token to retrieve the next page of results."
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ListConnectionsResponse"
            },
            "x-example": {
              "connections": [
                {
                  "rid": "<connection rid>",
                  "displayName": "<display name>",
                  "description": "<description>",
                  "connectionDetails": {
                    "type": "timescale",
                    "timescale": {
                      "database": "<database>",
                      "host": "<host>",
                      "port": 1,
                      "username": "<username>",
                      "passwordSecretRid": "<secret rid>"
                    }
                  },
                  "requiredTagNames": [
                    "<tag name>"
                  ],
                  "metadata": {
                    "<key>": "<value>"
                  },
                  "scraping": {
                    "type": "influx",
                    "influx": {
                      "filter": [
                        {
                          "type": "matchBucket",
                          "matchBucket": [
                            "<bucket name>"
                          ]
                        }
                      ],
                      "seriesArchetypeConstruction": {
                        "channelNameComponents": [
                          {
                            "type": "bucket",
                            "bucket": {}
                          }
                        ],
                        "separator": "<separator>"
                      }
                    }
                  },
                  "shouldScrape": true,
                  "limits": {
                    "maxQueryRange": {
                      "unit": "HOURS",
                      "count": 1
                    }
                  },
                  "connectionStatus": {
                    "isConnected": true
                  },
                  "isArchived": true
                }
              ],
              "nextPageToken": "<token>"
            }
          }
        }
      }
    },
    "/data-source/connection/v2/connections/by-datasource": {
      "get": {
        "operationId": "ConnectionService_listConnectionsByNominalDataSource",
        "summary": "List connections by Nominal data source",
        "tags": [
          "Connection Service"
        ],
        "description": "Lists connections that reference the specified Nominal data sources, with pagination. Only returns connections within the caller's organization.",
        "parameters": [
          {
            "name": "nominalDataSourceRids",
            "in": "query",
            "type": "array",
            "items": {
              "type": "string",
              "format": "rid",
              "x-alias": "NominalDataSourceRid"
            },
            "collectionFormat": "multi",
            "required": false,
            "description": "The set of Nominal data source RIDs to filter connections by."
          },
          {
            "name": "workspaces",
            "in": "query",
            "type": "array",
            "items": {
              "type": "string",
              "format": "rid",
              "x-alias": "WorkspaceRid"
            },
            "collectionFormat": "multi",
            "required": false,
            "description": "If supplied, will return only the connections within the supplied workspaces. If empty will return all connections for workspaces that the user is permitted to see."
          },
          {
            "name": "pageSize",
            "in": "query",
            "type": "integer",
            "format": "int32",
            "required": false,
            "description": "Number of connections to return per page. Defaults to 100. Will return at most 1000 records per page."
          },
          {
            "name": "nextPageToken",
            "in": "query",
            "type": "string",
            "x-alias": "Token",
            "required": false,
            "description": "Token to retrieve the next page of results."
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ListConnectionsResponse"
            },
            "x-example": {
              "connections": [
                {
                  "rid": "<connection rid>",
                  "displayName": "<display name>",
                  "description": "<description>",
                  "connectionDetails": {
                    "type": "timescale",
                    "timescale": {
                      "database": "<database>",
                      "host": "<host>",
                      "port": 1,
                      "username": "<username>",
                      "passwordSecretRid": "<secret rid>"
                    }
                  },
                  "requiredTagNames": [
                    "<tag name>"
                  ],
                  "metadata": {
                    "<key>": "<value>"
                  },
                  "scraping": {
                    "type": "influx",
                    "influx": {
                      "filter": [
                        {
                          "type": "matchBucket",
                          "matchBucket": [
                            "<bucket name>"
                          ]
                        }
                      ],
                      "seriesArchetypeConstruction": {
                        "channelNameComponents": [
                          {
                            "type": "bucket",
                            "bucket": {}
                          }
                        ],
                        "separator": "<separator>"
                      }
                    }
                  },
                  "shouldScrape": true,
                  "limits": {
                    "maxQueryRange": {
                      "unit": "HOURS",
                      "count": 1
                    }
                  },
                  "connectionStatus": {
                    "isConnected": true
                  },
                  "isArchived": true
                }
              ],
              "nextPageToken": "<token>"
            }
          }
        }
      }
    },
    "/data-source/connection/v1/connections/{rid}/archive": {
      "post": {
        "operationId": "ConnectionService_archiveConnection",
        "summary": "Archive connection",
        "tags": [
          "Connection Service"
        ],
        "description": "Archives a connection, which simply tags the connection for a client to filter.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "ConnectionRid",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    },
    "/data-source/connection/v1/connections/{rid}/unarchive": {
      "post": {
        "operationId": "ConnectionService_unarchiveConnection",
        "summary": "Unarchive connection",
        "tags": [
          "Connection Service"
        ],
        "description": "Undoes the archiving of a connection.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "ConnectionRid",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    }
  },
  "definitions": {
    "Empty": {
      "type": "object",
      "properties": {}
    },
    "AllChannelsConnectionsScrapingConfig": {
      "type": "object",
      "properties": {}
    },
    "ApiScrapingConfig": {
      "description": "This config is used to scrape data from an external connections service.\n\nSet `type` to the name of one of the other fields, and set only that field.",
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "allChannels",
            "channelAllowList",
            "channelBlockList"
          ]
        },
        "allChannels": {
          "$ref": "#/definitions/AllChannelsConnectionsScrapingConfig"
        },
        "channelAllowList": {
          "$ref": "#/definitions/ChannelAllowListConnectionsScrapingConfig"
        },
        "channelBlockList": {
          "$ref": "#/definitions/ChannelBlockListConnectionsScrapingConfig"
        }
      },
      "required": [
        "type"
      ],
      "example": {
        "type": "allChannels",
        "allChannels": {}
      }
    },
    "BigQueryChannelNameComponent": {
      "type": "object",
      "properties": {
        "includeProject": {
          "type": "boolean",
          "description": "Whether to include the project name in the channel name."
        },
        "includeDataset": {
          "type": "boolean",
          "description": "Whether to include the dataset name in the channel name."
        },
        "includeTable": {
          "type": "boolean",
          "description": "Whether to include the table name in the channel name."
        }
      },
      "required": [
        "includeProject",
        "includeDataset",
        "includeTable"
      ]
    },
    "BigQueryConnectionDetails": {
      "type": "object",
      "properties": {
        "region": {
          "type": "string",
          "x-alias": "LocationName",
          "description": "The region of the BigQuery Project (e.g. \"us-east1\")"
        },
        "project": {
          "type": "string",
          "x-alias": "ProjectName",
          "description": "The name of the BigQuery Project"
        },
        "dataset": {
          "type": "string",
          "x-alias": "DatasetName",
          "description": "The name of the dataset within the project"
        },
        "table": {
          "type": "string",
          "x-alias": "TableName",
          "description": "The name of the table within the dataset"
        },
        "serviceAccountKeySecretRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid",
          "description": "Secret Rid of service account key stored in Secrets Service."
        }
      },
      "required": [
        "region",
        "project",
        "dataset",
        "table",
        "serviceAccountKeySecretRid"
      ]
    },
    "BigQueryScrapingConfig": {
      "type": "object",
      "properties": {
        "timeColumn": {
          "type": "string",
          "x-alias": "ColumnName",
          "description": "The name of the column that holds the timestamp."
        },
        "tagColumns": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "ColumnName"
          },
          "uniqueItems": true,
          "description": "The name of the columns that should be interpreted as tag columns"
        },
        "channelNameComponents": {
          "allOf": [
            {
              "$ref": "#/definitions/BigQueryChannelNameComponent"
            }
          ],
          "description": "channelNameComponents will be combined, together with separator, to form a fully qualified channel name. By default, we don't add anything to the column name."
        },
        "separator": {
          "type": "string",
          "description": "The separator that delimits the parts of the channel name. If ommitted, the default is a \".\"."
        }
      },
      "required": [
        "timeColumn"
      ]
    },
    "ChannelAllowListConnectionsScrapingConfig": {
      "type": "object",
      "properties": {
        "channelAllowList": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "Channel"
          },
          "uniqueItems": true,
          "description": "Only channels in this set will be scraped. Must not be empty."
        }
      }
    },
    "ChannelBlockListConnectionsScrapingConfig": {
      "type": "object",
      "properties": {
        "channelBlockList": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "Channel"
          },
          "uniqueItems": true,
          "description": "Only channels not in this set will be scraped. Must not be empty."
        }
      }
    },
    "Connection": {
      "type": "object",
      "properties": {
        "rid": {
          "type": "string",
          "format": "rid",
          "x-alias": "ConnectionRid"
        },
        "displayName": {
          "type": "string",
          "description": "The display name of the connection. For example: \"Nominal production TimescaleDB\""
        },
        "description": {
          "type": "string"
        },
        "connectionDetails": {
          "$ref": "#/definitions/ConnectionDetails"
        },
        "requiredTagNames": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "TagName"
          },
          "uniqueItems": true,
          "description": "Additional tag names that should be supplied to construct a fully qualified series. These are suggested, rather than strictly required."
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "scraping": {
          "$ref": "#/definitions/ScrapingConfig"
        },
        "shouldScrape": {
          "type": "boolean",
          "description": "The connection will be scraped iff this flag is set and scrapingConfig is present."
        },
        "limits": {
          "$ref": "#/definitions/LimitsConfig"
        },
        "connectionStatus": {
          "$ref": "#/definitions/ConnectionStatus"
        },
        "isArchived": {
          "type": "boolean"
        }
      },
      "required": [
        "rid",
        "displayName",
        "connectionDetails",
        "shouldScrape",
        "connectionStatus",
        "isArchived"
      ]
    },
    "ConnectionDetails": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "timescale",
            "influx",
            "influx1",
            "nominal",
            "timestream",
            "visualCrossing",
            "bigQuery"
          ]
        },
        "timescale": {
          "$ref": "#/definitions/TimescaleConnectionDetails"
        },
        "influx": {
          "$ref": "#/definitions/Influx2ConnectionDetails"
        },
        "influx1": {
          "$ref": "#/definitions/Influx1ConnectionDetails"
        },
        "nominal": {
          "$ref": "#/definitions/NominalConnectionDetails"
        },
        "timestream": {
          "$ref": "#/definitions/TimestreamConnectionDetails"
        },
        "visualCrossing": {
          "$ref": "#/definitions/VisualCrossingConnectionDetails"
        },
        "bigQuery": {
          "$ref": "#/definitions/BigQueryConnectionDetails"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "timescale",
        "timescale": {
          "database": "string",
          "host": "string",
          "port": 1,
          "username": "string",
          "passwordSecretRid": "string"
        }
      }
    },
    "ConnectionStatus": {
      "type": "object",
      "properties": {
        "isConnected": {
          "type": "boolean"
        }
      },
      "required": [
        "isConnected"
      ]
    },
    "CreateConnection": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "connectionDetails": {
          "$ref": "#/definitions/ConnectionDetails"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Metadata information about the connection which is not relevant to the DB connection itself."
        },
        "requiredTagNames": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "TagName"
          },
          "uniqueItems": true,
          "description": "Additional tag name that are required to construct a fully qualified series."
        },
        "availableTagValues": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string",
              "x-alias": "TagValue"
            },
            "uniqueItems": true
          },
          "x-map-key": "TagName",
          "description": "In most cases, this does not to be set by the user. Throws if populated for Nominal connections, which have their tags automatically indexed in the underlying database. Tags for external connections are periodically scraped. Tags should only be updated  manually for Visual crossing connections."
        },
        "scraping": {
          "$ref": "#/definitions/ScrapingConfig"
        },
        "shouldScrape": {
          "type": "boolean"
        },
        "limits": {
          "$ref": "#/definitions/LimitsConfig"
        },
        "workspace": {
          "type": "string",
          "format": "rid",
          "x-alias": "WorkspaceRid",
          "description": "The workspace in which to create the connection. If not provided, the connection will be created in the default workspace for the user's organization, if the default workspace for the organization is configured."
        },
        "markingRids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "rid",
            "x-alias": "MarkingRid"
          },
          "uniqueItems": true,
          "description": "The markings to apply to the created connection. If not provided, the connection will be visible to all users in the same workspace."
        }
      },
      "required": [
        "name",
        "connectionDetails",
        "shouldScrape"
      ],
      "example": {
        "name": "<name>",
        "connectionDetails": {
          "type": "timescale",
          "timescale": {
            "database": "<database>",
            "host": "<host>",
            "port": 1,
            "username": "<username>",
            "passwordSecretRid": "<secret rid>"
          }
        },
        "shouldScrape": true
      }
    },
    "Duration": {
      "type": "object",
      "properties": {
        "unit": {
          "$ref": "#/definitions/TemporalUnit"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      },
      "required": [
        "unit",
        "count"
      ]
    },
    "HeaderValue": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "plain",
            "secretRid"
          ]
        },
        "plain": {
          "type": "string"
        },
        "secretRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "plain",
        "plain": "string"
      }
    },
    "Influx1ConnectionDetails": {
      "type": "object",
      "properties": {
        "host": {
          "type": "string"
        },
        "port": {
          "type": "integer",
          "format": "int32"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/HeaderValue"
          },
          "description": "A map of header name to value"
        },
        "credentials": {
          "$ref": "#/definitions/PasswordCredentials"
        }
      },
      "required": [
        "host",
        "port"
      ]
    },
    "Influx2ConnectionDetails": {
      "type": "object",
      "properties": {
        "host": {
          "type": "string"
        },
        "port": {
          "type": "integer",
          "format": "int32"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/HeaderValue"
          },
          "description": "A map of header name to value"
        },
        "org": {
          "type": "string",
          "x-alias": "OrgId"
        },
        "tokenSecretRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid",
          "description": "Secret Rid of token secret stored in Secrets Service."
        }
      },
      "required": [
        "host",
        "port",
        "org",
        "tokenSecretRid"
      ]
    },
    "InfluxChannelNameComponent": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "bucket",
            "measurement",
            "field"
          ]
        },
        "bucket": {
          "$ref": "#/definitions/Empty"
        },
        "measurement": {
          "$ref": "#/definitions/Empty"
        },
        "field": {
          "$ref": "#/definitions/Empty"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "bucket",
        "bucket": {}
      }
    },
    "InfluxScrapingConfig": {
      "type": "object",
      "properties": {
        "filter": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/InfluxScrapingFilter"
          },
          "description": "Filters are ANDed together"
        },
        "seriesArchetypeConstruction": {
          "$ref": "#/definitions/InfluxSeriesArchetypeConstructionConfig"
        }
      },
      "required": [
        "seriesArchetypeConstruction"
      ]
    },
    "InfluxScrapingFilter": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "not",
            "matchBucket",
            "matchMeasurement"
          ]
        },
        "not": {
          "$ref": "#/definitions/InfluxScrapingFilter"
        },
        "matchBucket": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "BucketName"
          },
          "uniqueItems": true,
          "description": "Match any of the specified buckets"
        },
        "matchMeasurement": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "MeasurementName"
          },
          "uniqueItems": true,
          "description": "Match any of the specified measurements"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "matchBucket",
        "matchBucket": [
          "string"
        ]
      }
    },
    "InfluxSeriesArchetypeConstructionConfig": {
      "description": "For example, for config of the form {components: [measurement, field, tag: vehicle], separator: \".\"} will construct a channel that looks like vehicle_a.measurement.field. Tags will automatically be specified inside of the archetype.",
      "type": "object",
      "properties": {
        "channelNameComponents": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/InfluxChannelNameComponent"
          }
        },
        "separator": {
          "type": "string"
        }
      },
      "required": [
        "separator"
      ]
    },
    "LimitsConfig": {
      "type": "object",
      "properties": {
        "maxQueryRange": {
          "$ref": "#/definitions/Duration"
        }
      }
    },
    "ListConnectionsResponse": {
      "type": "object",
      "properties": {
        "connections": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Connection"
          }
        },
        "nextPageToken": {
          "type": "string",
          "x-alias": "Token"
        }
      }
    },
    "NominalChannelNameComponent": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "channel",
            "valueOfTagWithName"
          ]
        },
        "channel": {
          "$ref": "#/definitions/Empty"
        },
        "valueOfTagWithName": {
          "type": "string",
          "x-alias": "TagName",
          "description": "The value of the specified TagName will be used. If the tag is not present, it will be omitted."
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "channel",
        "channel": {}
      }
    },
    "NominalConnectionDetails": {
      "type": "object",
      "properties": {
        "nominalDataSourceRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "NominalDataSourceRid"
        }
      },
      "required": [
        "nominalDataSourceRid"
      ]
    },
    "NominalScrapingConfig": {
      "type": "object",
      "properties": {
        "channelNameComponents": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/NominalChannelNameComponent"
          },
          "description": "channelNameComponents will be combined, together with separator, to form a fully qualified channel name."
        },
        "separator": {
          "type": "string"
        }
      },
      "required": [
        "separator"
      ]
    },
    "PasswordCredentials": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "passwordSecretRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid",
          "description": "Secret Rid of password secret stored in Secrets Service."
        }
      },
      "required": [
        "username",
        "passwordSecretRid"
      ]
    },
    "PivotedTimescaleChannelNameComponent": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "table",
            "name"
          ]
        },
        "table": {
          "$ref": "#/definitions/Empty"
        },
        "name": {
          "allOf": [
            {
              "$ref": "#/definitions/Empty"
            }
          ],
          "description": "The value of the name column."
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "table",
        "table": {}
      }
    },
    "PivotedTimescaleScrapingConfig": {
      "description": "This config is used to scrape data from a Timescale database that has a pivoted schema. time | name           | value | device 1   | temperature    | 1     | a",
      "type": "object",
      "properties": {
        "filter": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/TimescaleScrapingFilter"
          },
          "description": "In order for data to be picked up by the scraper, it must match all filters in this list. To exclude chunks of data, it's possible to use a not filter."
        },
        "timeColumn": {
          "type": "string",
          "x-alias": "ColumnName",
          "description": "The name of the column that holds the timestamp."
        },
        "nameColumn": {
          "type": "string",
          "x-alias": "ColumnName",
          "description": "The name of the column that holds the series name."
        },
        "valueColumn": {
          "type": "string",
          "x-alias": "ColumnName",
          "description": "The name of the column that holds the series values."
        },
        "dimensionColumns": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "ColumnName"
          },
          "uniqueItems": true,
          "description": "The names of the columns that comprise a dimension. They should have a database index for efficient filtering. We do not discover dimensions based on hypertable schema because they are not necessarily configured properly."
        },
        "channelNameComponents": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/PivotedTimescaleChannelNameComponent"
          },
          "description": "channelNameComponents will be combined, together with separator, to form a fully qualified channel name."
        },
        "separator": {
          "type": "string"
        }
      },
      "required": [
        "timeColumn",
        "nameColumn",
        "valueColumn",
        "separator"
      ]
    },
    "ScrapingConfig": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "influx",
            "nominal",
            "timestream",
            "timescale",
            "visualCrossing",
            "bigQuery",
            "api"
          ]
        },
        "influx": {
          "$ref": "#/definitions/InfluxScrapingConfig"
        },
        "nominal": {
          "$ref": "#/definitions/NominalScrapingConfig"
        },
        "timestream": {
          "$ref": "#/definitions/TimestreamScrapingConfig"
        },
        "timescale": {
          "$ref": "#/definitions/PivotedTimescaleScrapingConfig"
        },
        "visualCrossing": {
          "$ref": "#/definitions/VisualCrossingScrapingConfig"
        },
        "bigQuery": {
          "$ref": "#/definitions/BigQueryScrapingConfig"
        },
        "api": {
          "$ref": "#/definitions/ApiScrapingConfig"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "influx",
        "influx": {
          "filter": [
            {
              "type": "matchBucket",
              "matchBucket": [
                "string"
              ]
            }
          ],
          "seriesArchetypeConstruction": {
            "channelNameComponents": [
              {
                "type": "bucket",
                "bucket": {}
              }
            ],
            "separator": "string"
          }
        }
      }
    },
    "TemporalUnit": {
      "type": "string",
      "enum": [
        "HOURS",
        "DAYS",
        "WEEKS"
      ]
    },
    "TimescaleConnectionDetails": {
      "type": "object",
      "properties": {
        "database": {
          "type": "string"
        },
        "host": {
          "type": "string"
        },
        "port": {
          "type": "integer",
          "format": "int32"
        },
        "username": {
          "type": "string",
          "description": "This is also the reference to the secret containing the password"
        },
        "passwordSecretRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid",
          "description": "Secret Rid of password secret stored in Secrets Service."
        }
      },
      "required": [
        "database",
        "host",
        "port",
        "username",
        "passwordSecretRid"
      ]
    },
    "TimescaleScrapingFilter": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "not",
            "matchTable",
            "matchSchema"
          ]
        },
        "not": {
          "$ref": "#/definitions/TimescaleScrapingFilter"
        },
        "matchTable": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "TableName"
          },
          "uniqueItems": true,
          "description": "Match any of the specified tables in the database."
        },
        "matchSchema": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "SchemaName"
          },
          "uniqueItems": true,
          "description": "Match any of the specified schemas in the database."
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "matchTable",
        "matchTable": [
          "string"
        ]
      }
    },
    "TimestreamChannelNameComponent": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "table",
            "measure",
            "attribute",
            "valueOfTagWithName"
          ]
        },
        "table": {
          "$ref": "#/definitions/Empty"
        },
        "measure": {
          "$ref": "#/definitions/Empty"
        },
        "attribute": {
          "$ref": "#/definitions/Empty"
        },
        "valueOfTagWithName": {
          "type": "string",
          "x-alias": "TagName",
          "description": "The value of the specified TagName will be used. If the tag is not present, it will be omitted."
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "table",
        "table": {}
      }
    },
    "TimestreamConnectionDetails": {
      "type": "object",
      "properties": {
        "nominalRoleArn": {
          "type": "string",
          "description": "The role ARN owned by Nominal that has permission to assume the externalRoleArn."
        },
        "nominalRoleRegion": {
          "type": "string",
          "description": "AWS region that contains the Nominal role."
        },
        "externalRegion": {
          "type": "string",
          "description": "AWS region that contains the Timestream instance."
        },
        "externalRoleArn": {
          "type": "string",
          "description": "The role ARN used to make queries to Timestream. This role is owned by the AWS account that owns the Timestream instance."
        },
        "database": {
          "type": "string",
          "description": "Database inside of the Timestream instance to connect to."
        }
      },
      "required": [
        "nominalRoleArn",
        "nominalRoleRegion",
        "externalRegion",
        "externalRoleArn",
        "database"
      ]
    },
    "TimestreamScrapingConfig": {
      "type": "object",
      "properties": {
        "filter": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/TimestreamScrapingFilter"
          },
          "description": "In order for data to be picked up by the scraper, it must match all filters in this list."
        },
        "channelNameComponents": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/TimestreamChannelNameComponent"
          },
          "description": "channelNameComponents will be combined, together with separator, to form a fully qualified channel name."
        },
        "separator": {
          "type": "string"
        },
        "maxLookBackPeriodHours": {
          "type": "integer",
          "format": "int32",
          "description": "The maximum time in hours to look back over series data to find unique measure and tag combinations. If not specified, the default look back period will be used."
        }
      },
      "required": [
        "separator"
      ]
    },
    "TimestreamScrapingFilter": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "matchTable"
          ]
        },
        "matchTable": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "TableName"
          },
          "uniqueItems": true,
          "description": "Match any of the specified tables in the database."
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "matchTable",
        "matchTable": [
          "string"
        ]
      }
    },
    "UpdateConnectionRequest": {
      "description": "Fields that are empty will be treated as a no-op update.",
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "connectionDetails": {
          "$ref": "#/definitions/ConnectionDetails"
        },
        "requiredTagNames": {
          "type": "array",
          "items": {
            "type": "string",
            "x-alias": "TagName"
          },
          "uniqueItems": true
        },
        "availableTagValues": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string",
              "x-alias": "TagValue"
            },
            "uniqueItems": true
          },
          "x-map-key": "TagName",
          "description": "In most cases, this does not to be set by the user. Throws if populated for Nominal connections, which have their tags automatically indexed in the underlying database. Tags for external connections are periodically scraped. Tags should only be updated manually for Visual crossing connections."
        },
        "scraping": {
          "$ref": "#/definitions/ScrapingConfig"
        },
        "shouldScrape": {
          "type": "boolean"
        },
        "limits": {
          "$ref": "#/definitions/LimitsConfig"
        }
      },
      "example": {
        "name": "<name>",
        "description": "<description>",
        "metadata": {
          "<key>": "<value>"
        },
        "connectionDetails": {
          "type": "timescale",
          "timescale": {
            "database": "<database>",
            "host": "<host>",
            "port": 1,
            "username": "<username>",
            "passwordSecretRid": "<secret rid>"
          }
        },
        "requiredTagNames": [
          "<tag name>"
        ],
        "availableTagValues": {
          "<key>": [
            "<tag value>"
          ]
        },
        "scraping": {
          "type": "influx",
          "influx": {
            "seriesArchetypeConstruction": {
              "separator": "<separator>"
            }
          }
        },
        "shouldScrape": true,
        "limits": {
          "maxQueryRange": {
            "unit": "HOURS",
            "count": 1
          }
        }
      }
    },
    "VisualCrossingAvailableSeries": {
      "description": "Deprecated and not used for anything anymore, see record VisualCrossingAvailableSeries instead.",
      "type": "object",
      "properties": {
        "channel": {
          "type": "string",
          "x-alias": "Channel"
        },
        "unit": {
          "type": "string",
          "x-alias": "Unit"
        },
        "description": {
          "type": "string"
        },
        "type": {
          "$ref": "#/definitions/VisualCrossingType"
        }
      },
      "required": [
        "channel",
        "type"
      ]
    },
    "VisualCrossingConnectionDetails": {
      "type": "object",
      "properties": {
        "apiKeySecretRid": {
          "type": "string",
          "format": "rid",
          "x-alias": "SecretRid",
          "description": "Secret Rid of API key stored in Secrets Service."
        }
      },
      "required": [
        "apiKeySecretRid"
      ]
    },
    "VisualCrossingScrapingConfig": {
      "type": "object",
      "properties": {
        "availableSeries": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/VisualCrossingAvailableSeries"
          },
          "description": "list of available channels",
          "x-deprecated": "No longer used for anything"
        }
      }
    },
    "VisualCrossingType": {
      "type": "string",
      "enum": [
        "DOUBLE",
        "STRING"
      ]
    }
  },
  "tags": [
    {
      "name": "Connection Service",
      "x-displayName": "Connection service",
      "description": "A Connection contains the relevant metadata and information to be used as a data source for runs. The Connection Service is responsible for creating, updating, and retrieving database connections.",
      "x-errors": [
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Connection:ConnectionNotFound"
        },
        {
          "status": 500,
          "errorCode": "INTERNAL",
          "errorName": "Connection:FailedToCreateConnection"
        },
        {
          "status": 403,
          "errorCode": "PERMISSION_DENIED",
          "errorName": "Connection:NotAllowedToCreateConnection"
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "Connection:PopulateSeriesTimeRangeTooLarge"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Connection:SecretsNotFound"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Connection:DatasourceRidNotFound"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Connection:DatasetRidNotFound"
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "Connection:NoSecretRidProvided"
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "Connection:FailedToAddTagsToConnection",
          "description": "Cannot manually add tags to a Nominal connection."
        }
      ]
    }
  ]
}
