From 3badba6be4fd63f38e198408ecddb12d85e6e73e Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Tue, 15 Sep 2026 14:01:58 -0700 Subject: [PATCH] feat: add credential APIs resource to gaos. PiperOrigin-RevId: 982027263 --- google/genai/_gaos/credentials.py | 2868 ----------------- google/genai/_gaos/models/__init__.py | 70 - google/genai/_gaos/models/createcredential.py | 92 - google/genai/_gaos/models/deletecredential.py | 90 - google/genai/_gaos/models/getcredential.py | 90 - google/genai/_gaos/models/listcredentials.py | 103 - google/genai/_gaos/models/updatecredential.py | 112 - google/genai/_gaos/resources/__init__.py | 10 +- .../_gaos/resources/credentials/__init__.py | 64 - .../interactions/environment/__init__.py | 3 +- google/genai/_gaos/sdk.py | 21 - google/genai/_gaos/types/__init__.py | 11 +- .../genai/_gaos/types/credentials/__init__.py | 124 - .../_gaos/types/credentials/credential.py | 96 - .../credentials/credentialcreateparams.py | 43 - .../credentials/credentiallistresponse.py | 52 - .../types/credentials/credentialupdate.py | 47 - .../credentials/environmentvariableconfig.py | 120 - .../environmentvariableupdateconfig.py | 121 - .../types/credentials/httpbearerconfig.py | 92 - .../credentials/httpbearerupdateconfig.py | 89 - .../credentials/injectionlocation_enum.py | 28 - .../_gaos/types/credentials/oauth2config.py | 92 - .../types/credentials/oauth2updateconfig.py | 91 - .../_gaos/types/interactions/__init__.py | 11 - .../types/interactions/allowlistentry.py | 7 +- .../_gaos/types/interactions/environment.py | 18 +- .../genai/_gaos/types/interactions/envvar.py | 59 - 28 files changed, 7 insertions(+), 4617 deletions(-) delete mode 100644 google/genai/_gaos/credentials.py delete mode 100644 google/genai/_gaos/models/createcredential.py delete mode 100644 google/genai/_gaos/models/deletecredential.py delete mode 100644 google/genai/_gaos/models/getcredential.py delete mode 100644 google/genai/_gaos/models/listcredentials.py delete mode 100644 google/genai/_gaos/models/updatecredential.py delete mode 100644 google/genai/_gaos/resources/credentials/__init__.py delete mode 100644 google/genai/_gaos/types/credentials/__init__.py delete mode 100644 google/genai/_gaos/types/credentials/credential.py delete mode 100644 google/genai/_gaos/types/credentials/credentialcreateparams.py delete mode 100644 google/genai/_gaos/types/credentials/credentiallistresponse.py delete mode 100644 google/genai/_gaos/types/credentials/credentialupdate.py delete mode 100644 google/genai/_gaos/types/credentials/environmentvariableconfig.py delete mode 100644 google/genai/_gaos/types/credentials/environmentvariableupdateconfig.py delete mode 100644 google/genai/_gaos/types/credentials/httpbearerconfig.py delete mode 100644 google/genai/_gaos/types/credentials/httpbearerupdateconfig.py delete mode 100644 google/genai/_gaos/types/credentials/injectionlocation_enum.py delete mode 100644 google/genai/_gaos/types/credentials/oauth2config.py delete mode 100644 google/genai/_gaos/types/credentials/oauth2updateconfig.py delete mode 100644 google/genai/_gaos/types/interactions/envvar.py diff --git a/google/genai/_gaos/credentials.py b/google/genai/_gaos/credentials.py deleted file mode 100644 index 576a9c33f..000000000 --- a/google/genai/_gaos/credentials.py +++ /dev/null @@ -1,2868 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .basesdk import AsyncBaseSDK, BaseSDK -from . import errors, models, types, utils -from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .types import ( - BaseModel, - OptionalNullable, - UNSET, - credentials, - interactions, -) -from .utils import get_security_from_env, response_helpers -from .utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, List, Literal, Mapping, Optional, Union, cast, overload - - -class Credentials(BaseSDK): - @property - def with_raw_response(self): - return CredentialsWithRawResponse(self) - - @property - def with_streaming_response(self): - return CredentialsWithStreamingResponse(self) - - def list( - self, - *, - api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.CredentialListResponse: - r"""Lists credentials for a project. - - :param api_version: Which version of the API to use. - :param page_size: Optional. Maximum number of credentials to return. - If unspecified, defaults to 50. Maximum is 1000. - :param page_token: Optional. Pagination token. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.ListCredentialsRequest( - api_version=api_version, - page_size=page_size, - page_token=page_token, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/{api_version}/credentials", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.ListCredentialsGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.CredentialListResponse, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListCredentials", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - @overload - def create( - self, - *, - request: Union[ - models.CreateCredentialRequest, models.CreateCredentialRequestParam - ], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param body: - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def create( - self, - *, - api_version: Optional[str] = None, - client_id: str, - client_secret: str, - id: str, - refresh_token: str, - scopes: List[str] = ..., - token_url: str, - type_: Literal["oauth2"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param client_id: Required. OAuth2 client ID. - :param client_secret: Required. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param id: - :param refresh_token: Required. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Required. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def create( - self, - *, - api_version: Optional[str] = None, - id: str, - injection_location: credentials.EnvironmentVariableConfigInjectionLocationParam, - trusted_domains: List[str] = ..., - type_: Literal["environment_variable"], - value: str, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param id: - :param injection_location: Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param type: - :param value: Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def create( - self, - *, - api_version: Optional[str] = None, - header_name: str = ..., - id: str, - prefix: str = ..., - token: str, - type_: Literal["bearer_token"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param id: - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Required. Input only. The static bearer token. Write-only; never returned in responses. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def create( - self, - *, - request: OptionalNullable[ - Union[models.CreateCredentialRequest, models.CreateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param client_id: Required. OAuth2 client ID. - :param client_secret: Required. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param id: - :param refresh_token: Required. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Required. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Required. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - def create( - self, - *, - request: OptionalNullable[ - Union[models.CreateCredentialRequest, models.CreateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param client_id: Required. OAuth2 client ID. - :param client_secret: Required. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param id: - :param refresh_token: Required. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Required. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Required. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - if "client_id" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'injection_location'.") - if "client_id" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'trusted_domains'.") - if "client_id" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'value'.") - if "client_id" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'header_name'.") - if "client_id" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'prefix'.") - if "client_id" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'token'.") - if "client_secret" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'injection_location'." - ) - if "client_secret" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'trusted_domains'." - ) - if "client_secret" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'value'.") - if "client_secret" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'header_name'.") - if "client_secret" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'prefix'.") - if "client_secret" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'token'.") - if "refresh_token" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'injection_location'." - ) - if "refresh_token" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'trusted_domains'." - ) - if "refresh_token" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'value'.") - if "refresh_token" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'header_name'.") - if "refresh_token" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'prefix'.") - if "refresh_token" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'token'.") - if "scopes" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'injection_location'.") - if "scopes" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'trusted_domains'.") - if "scopes" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'value'.") - if "scopes" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'header_name'.") - if "scopes" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'prefix'.") - if "scopes" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'token'.") - if "token_url" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'injection_location'.") - if "token_url" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'trusted_domains'.") - if "token_url" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'value'.") - if "token_url" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'header_name'.") - if "token_url" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'prefix'.") - if "token_url" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'token'.") - if "injection_location" in body_kwargs and "header_name" in body_kwargs: - raise ValueError( - "Cannot supply both 'injection_location' and 'header_name'." - ) - if "injection_location" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'prefix'.") - if "injection_location" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'token'.") - if "trusted_domains" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'header_name'.") - if "trusted_domains" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'prefix'.") - if "trusted_domains" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'token'.") - if "value" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'header_name'.") - if "value" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'prefix'.") - if "value" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'token'.") - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - if request is not UNSET: - request = cast( - models.CreateCredentialRequest, - request - if isinstance(request, BaseModel) - else utils.unmarshal( - cast(Any, request), models.CreateCredentialRequest - ), - ) - else: - _body_kwargs = dict(body_kwargs) - _body_kwargs = {k: v for k, v in _body_kwargs.items() if v is not UNSET} - _request_kwargs: dict[str, Any] = {"api_version": api_version} - _request_kwargs = { - k: v for k, v in _request_kwargs.items() if v is not UNSET - } - _request_kwargs["body"] = _body_kwargs - request = cast( - models.CreateCredentialRequest, - utils.unmarshal(_request_kwargs, models.CreateCredentialRequest), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="POST", - path="/{api_version}/credentials", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.CreateCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - credentials.CredentialCreateParams, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.Credential, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="CreateCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def delete( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a credential. Fails if referenced by active triggers. - - :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.DeleteCredentialRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="DELETE", - path="/{api_version}/credentials/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.DeleteCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="DeleteCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def get( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Gets metadata of a single credential (no secret fields). - - :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.GetCredentialRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/{api_version}/credentials/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.GetCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.Credential, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - @overload - def update( - self, - id: str, - *, - request: Union[ - models.UpdateCredentialRequest, models.UpdateCredentialRequestParam - ], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param body: - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def update( - self, - id: str, - *, - api_version: Optional[str] = None, - update_mask: Optional[str] = None, - client_id: str = ..., - client_secret: str = ..., - refresh_token: str = ..., - scopes: List[str] = ..., - token_url: str = ..., - type_: Literal["oauth2"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param client_id: Optional. OAuth2 client ID. - :param client_secret: Optional. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param refresh_token: Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Optional. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def update( - self, - id: str, - *, - api_version: Optional[str] = None, - update_mask: Optional[str] = None, - injection_location: credentials.EnvironmentVariableUpdateConfigInjectionLocationParam = ..., - trusted_domains: List[str] = ..., - type_: Literal["environment_variable"], - value: str = ..., - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param injection_location: Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param type: - :param value: Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def update( - self, - id: str, - *, - api_version: Optional[str] = None, - update_mask: Optional[str] = None, - header_name: str = ..., - prefix: str = ..., - token: str = ..., - type_: Literal["bearer_token"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Optional. Input only. The static bearer token. Write-only; never returned in responses. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def update( - self, - id: str, - *, - request: OptionalNullable[ - Union[models.UpdateCredentialRequest, models.UpdateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - update_mask: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param client_id: Optional. OAuth2 client ID. - :param client_secret: Optional. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param refresh_token: Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Optional. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Optional. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - def update( - self, - id: str, - *, - request: OptionalNullable[ - Union[models.UpdateCredentialRequest, models.UpdateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - update_mask: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param client_id: Optional. OAuth2 client ID. - :param client_secret: Optional. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param refresh_token: Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Optional. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Optional. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - if "client_id" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'injection_location'.") - if "client_id" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'trusted_domains'.") - if "client_id" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'value'.") - if "client_id" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'header_name'.") - if "client_id" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'prefix'.") - if "client_id" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'token'.") - if "client_secret" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'injection_location'." - ) - if "client_secret" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'trusted_domains'." - ) - if "client_secret" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'value'.") - if "client_secret" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'header_name'.") - if "client_secret" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'prefix'.") - if "client_secret" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'token'.") - if "refresh_token" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'injection_location'." - ) - if "refresh_token" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'trusted_domains'." - ) - if "refresh_token" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'value'.") - if "refresh_token" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'header_name'.") - if "refresh_token" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'prefix'.") - if "refresh_token" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'token'.") - if "scopes" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'injection_location'.") - if "scopes" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'trusted_domains'.") - if "scopes" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'value'.") - if "scopes" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'header_name'.") - if "scopes" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'prefix'.") - if "scopes" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'token'.") - if "token_url" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'injection_location'.") - if "token_url" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'trusted_domains'.") - if "token_url" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'value'.") - if "token_url" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'header_name'.") - if "token_url" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'prefix'.") - if "token_url" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'token'.") - if "injection_location" in body_kwargs and "header_name" in body_kwargs: - raise ValueError( - "Cannot supply both 'injection_location' and 'header_name'." - ) - if "injection_location" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'prefix'.") - if "injection_location" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'token'.") - if "trusted_domains" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'header_name'.") - if "trusted_domains" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'prefix'.") - if "trusted_domains" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'token'.") - if "value" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'header_name'.") - if "value" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'prefix'.") - if "value" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'token'.") - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - if request is not UNSET: - request = cast( - models.UpdateCredentialRequest, - request - if isinstance(request, BaseModel) - else utils.unmarshal( - cast(Any, request), models.UpdateCredentialRequest - ), - ) - else: - _body_kwargs = dict(body_kwargs) - _body_kwargs = {k: v for k, v in _body_kwargs.items() if v is not UNSET} - _request_kwargs: dict[str, Any] = { - "api_version": api_version, - "id": id, - "update_mask": update_mask, - } - _request_kwargs = { - k: v for k, v in _request_kwargs.items() if v is not UNSET - } - _request_kwargs["body"] = _body_kwargs - request = cast( - models.UpdateCredentialRequest, - utils.unmarshal(_request_kwargs, models.UpdateCredentialRequest), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="PATCH", - path="/{api_version}/credentials/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.UpdateCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - credentials.CredentialUpdate, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.Credential, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="UpdateCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - -class CredentialsWithRawResponse: - def __init__(self, sdk: Credentials) -> None: - self._sdk = sdk - self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") - self.create = response_helpers.to_raw_response_wrapper( - sdk.create, "extra_headers" - ) - self.delete = response_helpers.to_raw_response_wrapper( - sdk.delete, "extra_headers" - ) - self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") - self.update = response_helpers.to_raw_response_wrapper( - sdk.update, "extra_headers" - ) - - -class CredentialsWithStreamingResponse: - def __init__(self, sdk: Credentials) -> None: - self._sdk = sdk - self.list = response_helpers.to_streamed_response_wrapper( - sdk.list, "extra_headers" - ) - self.create = response_helpers.to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) - self.delete = response_helpers.to_streamed_response_wrapper( - sdk.delete, "extra_headers" - ) - self.get = response_helpers.to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.to_streamed_response_wrapper( - sdk.update, "extra_headers" - ) - - -class AsyncCredentials(AsyncBaseSDK): - @property - def with_raw_response(self): - return AsyncCredentialsWithRawResponse(self) - - @property - def with_streaming_response(self): - return AsyncCredentialsWithStreamingResponse(self) - - async def list( - self, - *, - api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.CredentialListResponse: - r"""Lists credentials for a project. - - :param api_version: Which version of the API to use. - :param page_size: Optional. Maximum number of credentials to return. - If unspecified, defaults to 50. Maximum is 1000. - :param page_token: Optional. Pagination token. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.ListCredentialsRequest( - api_version=api_version, - page_size=page_size, - page_token=page_token, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/{api_version}/credentials", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.ListCredentialsGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.CredentialListResponse, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListCredentials", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - @overload - async def create( - self, - *, - request: Union[ - models.CreateCredentialRequest, models.CreateCredentialRequestParam - ], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param body: - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def create( - self, - *, - api_version: Optional[str] = None, - client_id: str, - client_secret: str, - id: str, - refresh_token: str, - scopes: List[str] = ..., - token_url: str, - type_: Literal["oauth2"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param client_id: Required. OAuth2 client ID. - :param client_secret: Required. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param id: - :param refresh_token: Required. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Required. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def create( - self, - *, - api_version: Optional[str] = None, - id: str, - injection_location: credentials.EnvironmentVariableConfigInjectionLocationParam, - trusted_domains: List[str] = ..., - type_: Literal["environment_variable"], - value: str, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param id: - :param injection_location: Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param type: - :param value: Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def create( - self, - *, - api_version: Optional[str] = None, - header_name: str = ..., - id: str, - prefix: str = ..., - token: str, - type_: Literal["bearer_token"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param id: - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Required. Input only. The static bearer token. Write-only; never returned in responses. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def create( - self, - *, - request: OptionalNullable[ - Union[models.CreateCredentialRequest, models.CreateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param client_id: Required. OAuth2 client ID. - :param client_secret: Required. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param id: - :param refresh_token: Required. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Required. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Required. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - async def create( - self, - *, - request: OptionalNullable[ - Union[models.CreateCredentialRequest, models.CreateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Creates a credential. - - :param api_version: Which version of the API to use. - :param client_id: Required. OAuth2 client ID. - :param client_secret: Required. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param id: - :param refresh_token: Required. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Required. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Required. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - if "client_id" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'injection_location'.") - if "client_id" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'trusted_domains'.") - if "client_id" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'value'.") - if "client_id" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'header_name'.") - if "client_id" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'prefix'.") - if "client_id" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'token'.") - if "client_secret" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'injection_location'." - ) - if "client_secret" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'trusted_domains'." - ) - if "client_secret" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'value'.") - if "client_secret" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'header_name'.") - if "client_secret" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'prefix'.") - if "client_secret" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'token'.") - if "refresh_token" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'injection_location'." - ) - if "refresh_token" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'trusted_domains'." - ) - if "refresh_token" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'value'.") - if "refresh_token" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'header_name'.") - if "refresh_token" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'prefix'.") - if "refresh_token" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'token'.") - if "scopes" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'injection_location'.") - if "scopes" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'trusted_domains'.") - if "scopes" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'value'.") - if "scopes" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'header_name'.") - if "scopes" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'prefix'.") - if "scopes" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'token'.") - if "token_url" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'injection_location'.") - if "token_url" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'trusted_domains'.") - if "token_url" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'value'.") - if "token_url" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'header_name'.") - if "token_url" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'prefix'.") - if "token_url" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'token'.") - if "injection_location" in body_kwargs and "header_name" in body_kwargs: - raise ValueError( - "Cannot supply both 'injection_location' and 'header_name'." - ) - if "injection_location" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'prefix'.") - if "injection_location" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'token'.") - if "trusted_domains" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'header_name'.") - if "trusted_domains" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'prefix'.") - if "trusted_domains" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'token'.") - if "value" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'header_name'.") - if "value" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'prefix'.") - if "value" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'token'.") - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - if request is not UNSET: - request = cast( - models.CreateCredentialRequest, - request - if isinstance(request, BaseModel) - else utils.unmarshal( - cast(Any, request), models.CreateCredentialRequest - ), - ) - else: - _body_kwargs = dict(body_kwargs) - _body_kwargs = {k: v for k, v in _body_kwargs.items() if v is not UNSET} - _request_kwargs: dict[str, Any] = {"api_version": api_version} - _request_kwargs = { - k: v for k, v in _request_kwargs.items() if v is not UNSET - } - _request_kwargs["body"] = _body_kwargs - request = cast( - models.CreateCredentialRequest, - utils.unmarshal(_request_kwargs, models.CreateCredentialRequest), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="POST", - path="/{api_version}/credentials", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.CreateCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - credentials.CredentialCreateParams, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.Credential, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="CreateCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def delete( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a credential. Fails if referenced by active triggers. - - :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.DeleteCredentialRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="DELETE", - path="/{api_version}/credentials/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.DeleteCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="DeleteCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def get( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Gets metadata of a single credential (no secret fields). - - :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.GetCredentialRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/{api_version}/credentials/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.GetCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.Credential, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - @overload - async def update( - self, - id: str, - *, - request: Union[ - models.UpdateCredentialRequest, models.UpdateCredentialRequestParam - ], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param body: - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def update( - self, - id: str, - *, - api_version: Optional[str] = None, - update_mask: Optional[str] = None, - client_id: str = ..., - client_secret: str = ..., - refresh_token: str = ..., - scopes: List[str] = ..., - token_url: str = ..., - type_: Literal["oauth2"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param client_id: Optional. OAuth2 client ID. - :param client_secret: Optional. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param refresh_token: Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Optional. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def update( - self, - id: str, - *, - api_version: Optional[str] = None, - update_mask: Optional[str] = None, - injection_location: credentials.EnvironmentVariableUpdateConfigInjectionLocationParam = ..., - trusted_domains: List[str] = ..., - type_: Literal["environment_variable"], - value: str = ..., - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param injection_location: Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param type: - :param value: Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def update( - self, - id: str, - *, - api_version: Optional[str] = None, - update_mask: Optional[str] = None, - header_name: str = ..., - prefix: str = ..., - token: str = ..., - type_: Literal["bearer_token"], - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Optional. Input only. The static bearer token. Write-only; never returned in responses. - :param type: - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - async def update( - self, - id: str, - *, - request: OptionalNullable[ - Union[models.UpdateCredentialRequest, models.UpdateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - update_mask: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param client_id: Optional. OAuth2 client ID. - :param client_secret: Optional. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param refresh_token: Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Optional. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Optional. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - async def update( - self, - id: str, - *, - request: OptionalNullable[ - Union[models.UpdateCredentialRequest, models.UpdateCredentialRequestParam] - ] = UNSET, - api_version: OptionalNullable[str] = UNSET, - update_mask: OptionalNullable[str] = UNSET, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - **body_kwargs: Any, - ) -> credentials.Credential: - r"""Updates a credential. - - :param api_version: Which version of the API to use. - :param update_mask: Optional. The list of fields to update. - :param client_id: Optional. OAuth2 client ID. - :param client_secret: Optional. Input only. OAuth2 client secret. Write-only; never returned in responses. - :param refresh_token: Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses. - :param scopes: Optional. List of OAuth2 scopes. - :param token_url: Optional. OAuth2 token endpoint URL for refreshing access tokens. - :param type: - :param injection_location: Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - :param trusted_domains: Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - :param value: Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - :param header_name: Optional. Header name to inject the token into. Defaults to - 'Authorization'. - :param prefix: Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - :param token: Optional. Input only. The static bearer token. Write-only; never returned in responses. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - if "client_id" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'injection_location'.") - if "client_id" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'trusted_domains'.") - if "client_id" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'value'.") - if "client_id" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'header_name'.") - if "client_id" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'prefix'.") - if "client_id" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_id' and 'token'.") - if "client_secret" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'injection_location'." - ) - if "client_secret" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'client_secret' and 'trusted_domains'." - ) - if "client_secret" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'value'.") - if "client_secret" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'header_name'.") - if "client_secret" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'prefix'.") - if "client_secret" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'client_secret' and 'token'.") - if "refresh_token" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'injection_location'." - ) - if "refresh_token" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError( - "Cannot supply both 'refresh_token' and 'trusted_domains'." - ) - if "refresh_token" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'value'.") - if "refresh_token" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'header_name'.") - if "refresh_token" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'prefix'.") - if "refresh_token" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'refresh_token' and 'token'.") - if "scopes" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'injection_location'.") - if "scopes" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'trusted_domains'.") - if "scopes" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'value'.") - if "scopes" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'header_name'.") - if "scopes" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'prefix'.") - if "scopes" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'scopes' and 'token'.") - if "token_url" in body_kwargs and "injection_location" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'injection_location'.") - if "token_url" in body_kwargs and "trusted_domains" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'trusted_domains'.") - if "token_url" in body_kwargs and "value" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'value'.") - if "token_url" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'header_name'.") - if "token_url" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'prefix'.") - if "token_url" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'token_url' and 'token'.") - if "injection_location" in body_kwargs and "header_name" in body_kwargs: - raise ValueError( - "Cannot supply both 'injection_location' and 'header_name'." - ) - if "injection_location" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'prefix'.") - if "injection_location" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'injection_location' and 'token'.") - if "trusted_domains" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'header_name'.") - if "trusted_domains" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'prefix'.") - if "trusted_domains" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'trusted_domains' and 'token'.") - if "value" in body_kwargs and "header_name" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'header_name'.") - if "value" in body_kwargs and "prefix" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'prefix'.") - if "value" in body_kwargs and "token" in body_kwargs: - raise ValueError("Cannot supply both 'value' and 'token'.") - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - if request is not UNSET: - request = cast( - models.UpdateCredentialRequest, - request - if isinstance(request, BaseModel) - else utils.unmarshal( - cast(Any, request), models.UpdateCredentialRequest - ), - ) - else: - _body_kwargs = dict(body_kwargs) - _body_kwargs = {k: v for k, v in _body_kwargs.items() if v is not UNSET} - _request_kwargs: dict[str, Any] = { - "api_version": api_version, - "id": id, - "update_mask": update_mask, - } - _request_kwargs = { - k: v for k, v in _request_kwargs.items() if v is not UNSET - } - _request_kwargs["body"] = _body_kwargs - request = cast( - models.UpdateCredentialRequest, - utils.unmarshal(_request_kwargs, models.UpdateCredentialRequest), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="PATCH", - path="/{api_version}/credentials/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.UpdateCredentialGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - credentials.CredentialUpdate, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - credentials.Credential, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="UpdateCredential", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - -class AsyncCredentialsWithRawResponse: - def __init__(self, sdk: AsyncCredentials) -> None: - self._sdk = sdk - self.list = response_helpers.async_to_raw_response_wrapper( - sdk.list, "extra_headers" - ) - self.create = response_helpers.async_to_raw_response_wrapper( - sdk.create, "extra_headers" - ) - self.delete = response_helpers.async_to_raw_response_wrapper( - sdk.delete, "extra_headers" - ) - self.get = response_helpers.async_to_raw_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.async_to_raw_response_wrapper( - sdk.update, "extra_headers" - ) - - -class AsyncCredentialsWithStreamingResponse: - def __init__(self, sdk: AsyncCredentials) -> None: - self._sdk = sdk - self.list = response_helpers.async_to_streamed_response_wrapper( - sdk.list, "extra_headers" - ) - self.create = response_helpers.async_to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) - self.delete = response_helpers.async_to_streamed_response_wrapper( - sdk.delete, "extra_headers" - ) - self.get = response_helpers.async_to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.async_to_streamed_response_wrapper( - sdk.update, "extra_headers" - ) diff --git a/google/genai/_gaos/models/__init__.py b/google/genai/_gaos/models/__init__.py index d1f924469..37c5c8919 100644 --- a/google/genai/_gaos/models/__init__.py +++ b/google/genai/_gaos/models/__init__.py @@ -34,12 +34,6 @@ CreateAgentRequest, CreateAgentRequestParam, ) - from .createcredential import ( - CreateCredentialGlobals, - CreateCredentialGlobalsTypedDict, - CreateCredentialRequest, - CreateCredentialRequestParam, - ) from .createenvironment import ( CreateEnvironmentGlobals, CreateEnvironmentGlobalsTypedDict, @@ -74,12 +68,6 @@ DeleteAgentRequest, DeleteAgentRequestParam, ) - from .deletecredential import ( - DeleteCredentialGlobals, - DeleteCredentialGlobalsTypedDict, - DeleteCredentialRequest, - DeleteCredentialRequestParam, - ) from .deleteenvironment import ( DeleteEnvironmentGlobals, DeleteEnvironmentGlobalsTypedDict, @@ -110,12 +98,6 @@ GetAgentRequest, GetAgentRequestParam, ) - from .getcredential import ( - GetCredentialGlobals, - GetCredentialGlobalsTypedDict, - GetCredentialRequest, - GetCredentialRequestParam, - ) from .getenvironment import ( GetEnvironmentGlobals, GetEnvironmentGlobalsTypedDict, @@ -154,12 +136,6 @@ ListAgentsRequest, ListAgentsRequestParam, ) - from .listcredentials import ( - ListCredentialsGlobals, - ListCredentialsGlobalsTypedDict, - ListCredentialsRequest, - ListCredentialsRequestParam, - ) from .listenvironments import ( ListEnvironmentsGlobals, ListEnvironmentsGlobalsTypedDict, @@ -202,12 +178,6 @@ RunTriggerRequest, RunTriggerRequestParam, ) - from .updatecredential import ( - UpdateCredentialGlobals, - UpdateCredentialGlobalsTypedDict, - UpdateCredentialRequest, - UpdateCredentialRequestParam, - ) from .updatetrigger import ( UpdateTriggerGlobals, UpdateTriggerGlobalsTypedDict, @@ -231,10 +201,6 @@ "CreateAgentGlobalsTypedDict", "CreateAgentRequest", "CreateAgentRequestParam", - "CreateCredentialGlobals", - "CreateCredentialGlobalsTypedDict", - "CreateCredentialRequest", - "CreateCredentialRequestParam", "CreateEnvironmentGlobals", "CreateEnvironmentGlobalsTypedDict", "CreateEnvironmentRequest", @@ -259,10 +225,6 @@ "DeleteAgentGlobalsTypedDict", "DeleteAgentRequest", "DeleteAgentRequestParam", - "DeleteCredentialGlobals", - "DeleteCredentialGlobalsTypedDict", - "DeleteCredentialRequest", - "DeleteCredentialRequestParam", "DeleteEnvironmentGlobals", "DeleteEnvironmentGlobalsTypedDict", "DeleteEnvironmentRequest", @@ -283,10 +245,6 @@ "GetAgentGlobalsTypedDict", "GetAgentRequest", "GetAgentRequestParam", - "GetCredentialGlobals", - "GetCredentialGlobalsTypedDict", - "GetCredentialRequest", - "GetCredentialRequestParam", "GetEnvironmentFilesGlobals", "GetEnvironmentFilesGlobalsTypedDict", "GetEnvironmentFilesRequest", @@ -313,10 +271,6 @@ "ListAgentsGlobalsTypedDict", "ListAgentsRequest", "ListAgentsRequestParam", - "ListCredentialsGlobals", - "ListCredentialsGlobalsTypedDict", - "ListCredentialsRequest", - "ListCredentialsRequestParam", "ListEnvironmentsGlobals", "ListEnvironmentsGlobalsTypedDict", "ListEnvironmentsRequest", @@ -345,10 +299,6 @@ "RunTriggerGlobalsTypedDict", "RunTriggerRequest", "RunTriggerRequestParam", - "UpdateCredentialGlobals", - "UpdateCredentialGlobalsTypedDict", - "UpdateCredentialRequest", - "UpdateCredentialRequestParam", "UpdateTriggerGlobals", "UpdateTriggerGlobalsTypedDict", "UpdateTriggerRequest", @@ -368,10 +318,6 @@ "CreateAgentGlobalsTypedDict": ".createagent", "CreateAgentRequest": ".createagent", "CreateAgentRequestParam": ".createagent", - "CreateCredentialGlobals": ".createcredential", - "CreateCredentialGlobalsTypedDict": ".createcredential", - "CreateCredentialRequest": ".createcredential", - "CreateCredentialRequestParam": ".createcredential", "CreateEnvironmentGlobals": ".createenvironment", "CreateEnvironmentGlobalsTypedDict": ".createenvironment", "CreateEnvironmentRequest": ".createenvironment", @@ -396,10 +342,6 @@ "DeleteAgentGlobalsTypedDict": ".deleteagent", "DeleteAgentRequest": ".deleteagent", "DeleteAgentRequestParam": ".deleteagent", - "DeleteCredentialGlobals": ".deletecredential", - "DeleteCredentialGlobalsTypedDict": ".deletecredential", - "DeleteCredentialRequest": ".deletecredential", - "DeleteCredentialRequestParam": ".deletecredential", "DeleteEnvironmentGlobals": ".deleteenvironment", "DeleteEnvironmentGlobalsTypedDict": ".deleteenvironment", "DeleteEnvironmentRequest": ".deleteenvironment", @@ -420,10 +362,6 @@ "GetAgentGlobalsTypedDict": ".getagent", "GetAgentRequest": ".getagent", "GetAgentRequestParam": ".getagent", - "GetCredentialGlobals": ".getcredential", - "GetCredentialGlobalsTypedDict": ".getcredential", - "GetCredentialRequest": ".getcredential", - "GetCredentialRequestParam": ".getcredential", "GetEnvironmentGlobals": ".getenvironment", "GetEnvironmentGlobalsTypedDict": ".getenvironment", "GetEnvironmentRequest": ".getenvironment", @@ -450,10 +388,6 @@ "ListAgentsGlobalsTypedDict": ".listagents", "ListAgentsRequest": ".listagents", "ListAgentsRequestParam": ".listagents", - "ListCredentialsGlobals": ".listcredentials", - "ListCredentialsGlobalsTypedDict": ".listcredentials", - "ListCredentialsRequest": ".listcredentials", - "ListCredentialsRequestParam": ".listcredentials", "ListEnvironmentsGlobals": ".listenvironments", "ListEnvironmentsGlobalsTypedDict": ".listenvironments", "ListEnvironmentsRequest": ".listenvironments", @@ -482,10 +416,6 @@ "RunTriggerGlobalsTypedDict": ".runtrigger", "RunTriggerRequest": ".runtrigger", "RunTriggerRequestParam": ".runtrigger", - "UpdateCredentialGlobals": ".updatecredential", - "UpdateCredentialGlobalsTypedDict": ".updatecredential", - "UpdateCredentialRequest": ".updatecredential", - "UpdateCredentialRequestParam": ".updatecredential", "UpdateTriggerGlobals": ".updatetrigger", "UpdateTriggerGlobalsTypedDict": ".updatetrigger", "UpdateTriggerRequest": ".updatetrigger", diff --git a/google/genai/_gaos/models/createcredential.py b/google/genai/_gaos/models/createcredential.py deleted file mode 100644 index dd6eb8bd7..000000000 --- a/google/genai/_gaos/models/createcredential.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..types.credentials import ( - credentialcreateparams as credentials_credentialcreateparams, -) -from ..utils import FieldMetadata, PathParamMetadata, RequestMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CreateCredentialGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class CreateCredentialGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class CreateCredentialRequestParam(TypedDict): - body: credentials_credentialcreateparams.CredentialCreateParamsParam - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class CreateCredentialRequest(BaseModel): - body: Annotated[ - credentials_credentialcreateparams.CredentialCreateParams, - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/deletecredential.py b/google/genai/_gaos/models/deletecredential.py deleted file mode 100644 index 08f965320..000000000 --- a/google/genai/_gaos/models/deletecredential.py +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class DeleteCredentialGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class DeleteCredentialGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class DeleteCredentialRequestParam(TypedDict): - id: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class DeleteCredentialRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/getcredential.py b/google/genai/_gaos/models/getcredential.py deleted file mode 100644 index bf6aafdc1..000000000 --- a/google/genai/_gaos/models/getcredential.py +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCredentialGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class GetCredentialGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class GetCredentialRequestParam(TypedDict): - id: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class GetCredentialRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/listcredentials.py b/google/genai/_gaos/models/listcredentials.py deleted file mode 100644 index 168dbf9c6..000000000 --- a/google/genai/_gaos/models/listcredentials.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCredentialsGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class ListCredentialsGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class ListCredentialsRequestParam(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - page_size: NotRequired[int] - r"""Optional. Maximum number of credentials to return. - If unspecified, defaults to 50. Maximum is 1000. - """ - page_token: NotRequired[str] - r"""Optional. Pagination token.""" - - -class ListCredentialsRequest(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - page_size: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Maximum number of credentials to return. - If unspecified, defaults to 50. Maximum is 1000. - """ - - page_token: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Pagination token.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version", "page_size", "page_token"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/updatecredential.py b/google/genai/_gaos/models/updatecredential.py deleted file mode 100644 index 1e3181d79..000000000 --- a/google/genai/_gaos/models/updatecredential.py +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..types.credentials import ( - credentialupdate as credentials_credentialupdate, -) -from ..utils import ( - FieldMetadata, - PathParamMetadata, - QueryParamMetadata, - RequestMetadata, -) -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class UpdateCredentialGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class UpdateCredentialGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class UpdateCredentialRequestParam(TypedDict): - id: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - body: credentials_credentialupdate.CredentialUpdateParam - api_version: NotRequired[str] - r"""Which version of the API to use.""" - update_mask: NotRequired[str] - r"""Optional. The list of fields to update.""" - - -class UpdateCredentialRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - body: Annotated[ - credentials_credentialupdate.CredentialUpdate, - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - update_mask: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. The list of fields to update.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version", "update_mask"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/resources/__init__.py b/google/genai/_gaos/resources/__init__.py index 81ed4cc08..e1cb1569d 100644 --- a/google/genai/_gaos/resources/__init__.py +++ b/google/genai/_gaos/resources/__init__.py @@ -18,17 +18,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from . import agents -from . import credentials from . import environments from . import interactions from . import triggers from . import webhooks -__all__ = [ - "agents", - "credentials", - "environments", - "interactions", - "triggers", - "webhooks", -] +__all__ = ["agents", "environments", "interactions", "triggers", "webhooks"] diff --git a/google/genai/_gaos/resources/credentials/__init__.py b/google/genai/_gaos/resources/credentials/__init__.py deleted file mode 100644 index 01282fcf4..000000000 --- a/google/genai/_gaos/resources/credentials/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ...models.deletecredential import ( - DeleteCredentialRequestParam as CredentialDeleteParams, -) -from ...models.getcredential import GetCredentialRequestParam as CredentialGetParams -from ...models.listcredentials import ( - ListCredentialsRequestParam as CredentialListParams, -) -from ...types.credentials.credential import Credential -from ...types.credentials.credentialcreateparams import ( - CredentialCreateParamsParam as CredentialCreateParams, -) -from ...types.credentials.credentiallistresponse import CredentialListResponse -from ...types.credentials.credentialupdate import ( - CredentialUpdateParam as CredentialUpdate, -) -from ...types.credentials.environmentvariableconfig import EnvironmentVariableConfig -from ...types.credentials.environmentvariableupdateconfig import ( - EnvironmentVariableUpdateConfig, -) -from ...types.credentials.httpbearerconfig import HTTPBearerConfig -from ...types.credentials.httpbearerupdateconfig import HTTPBearerUpdateConfig -from ...types.credentials.injectionlocation_enum import InjectionLocationEnum -from ...types.credentials.oauth2config import OAuth2Config -from ...types.credentials.oauth2updateconfig import OAuth2UpdateConfig -from ...types.interactions.empty import Empty as CredentialDeleteResponse - -InjectionLocation = InjectionLocationEnum -__all__ = [ - "Credential", - "CredentialCreateParams", - "CredentialDeleteParams", - "CredentialDeleteResponse", - "CredentialGetParams", - "CredentialListParams", - "CredentialListResponse", - "CredentialUpdate", - "EnvironmentVariableConfig", - "EnvironmentVariableUpdateConfig", - "HTTPBearerConfig", - "HTTPBearerUpdateConfig", - "InjectionLocation", - "InjectionLocationEnum", - "OAuth2Config", - "OAuth2UpdateConfig", -] diff --git a/google/genai/_gaos/resources/interactions/environment/__init__.py b/google/genai/_gaos/resources/interactions/environment/__init__.py index 1c0f12c81..11a0950d0 100644 --- a/google/genai/_gaos/resources/interactions/environment/__init__.py +++ b/google/genai/_gaos/resources/interactions/environment/__init__.py @@ -18,7 +18,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from ....types.interactions.environmentnetworkegressallowlist import Allowlist -from ....types.interactions.envvar import EnvVar from ....types.interactions.source import Source -__all__ = ["Allowlist", "EnvVar", "Source"] +__all__ = ["Allowlist", "Source"] diff --git a/google/genai/_gaos/sdk.py b/google/genai/_gaos/sdk.py index 5ff3c28c3..2cb5caeaa 100644 --- a/google/genai/_gaos/sdk.py +++ b/google/genai/_gaos/sdk.py @@ -40,7 +40,6 @@ if TYPE_CHECKING: from .agents import Agents, AsyncAgents - from .credentials import AsyncCredentials, Credentials from .environments import AsyncEnvironments, Environments from .interactions import AsyncInteractions, Interactions from .triggers import AsyncTriggers, Triggers @@ -59,14 +58,12 @@ def with_streaming_response(self): return GenAIWithStreamingResponse(self) agents: "Agents" - credentials: "Credentials" environments: "Environments" interactions: "Interactions" triggers: "Triggers" webhooks: "Webhooks" _sub_sdk_map = { "agents": (".agents", "Agents"), - "credentials": (".credentials", "Credentials"), "environments": (".environments", "Environments"), "interactions": (".interactions", "Interactions"), "triggers": (".triggers", "Triggers"), @@ -218,10 +215,6 @@ def __init__(self, sdk: GenAI) -> None: def agents(self): return self._sdk.agents.with_raw_response - @property - def credentials(self): - return self._sdk.credentials.with_raw_response - @property def environments(self): return self._sdk.environments.with_raw_response @@ -247,10 +240,6 @@ def __init__(self, sdk: GenAI) -> None: def agents(self): return self._sdk.agents.with_streaming_response - @property - def credentials(self): - return self._sdk.credentials.with_streaming_response - @property def environments(self): return self._sdk.environments.with_streaming_response @@ -280,14 +269,12 @@ def with_streaming_response(self): return AsyncGenAIWithStreamingResponse(self) agents: "AsyncAgents" - credentials: "AsyncCredentials" environments: "AsyncEnvironments" interactions: "AsyncInteractions" triggers: "AsyncTriggers" webhooks: "AsyncWebhooks" _sub_sdk_map = { "agents": (".agents", "AsyncAgents"), - "credentials": (".credentials", "AsyncCredentials"), "environments": (".environments", "AsyncEnvironments"), "interactions": (".interactions", "AsyncInteractions"), "triggers": (".triggers", "AsyncTriggers"), @@ -437,10 +424,6 @@ def __init__(self, sdk: AsyncGenAI) -> None: def agents(self): return self._sdk.agents.with_raw_response - @property - def credentials(self): - return self._sdk.credentials.with_raw_response - @property def environments(self): return self._sdk.environments.with_raw_response @@ -466,10 +449,6 @@ def __init__(self, sdk: AsyncGenAI) -> None: def agents(self): return self._sdk.agents.with_streaming_response - @property - def credentials(self): - return self._sdk.credentials.with_streaming_response - @property def environments(self): return self._sdk.environments.with_streaming_response diff --git a/google/genai/_gaos/types/__init__.py b/google/genai/_gaos/types/__init__.py index 767369fe4..903687c90 100644 --- a/google/genai/_gaos/types/__init__.py +++ b/google/genai/_gaos/types/__init__.py @@ -33,7 +33,7 @@ if TYPE_CHECKING: from .security import Security, SecurityTypedDict - from . import agents, credentials, environments, interactions, triggers, webhooks + from . import agents, environments, interactions, triggers, webhooks __all__ = [ "Base64EncodedString", @@ -54,14 +54,7 @@ "SecurityTypedDict": ".security", } -_sub_packages = [ - "agents", - "credentials", - "environments", - "interactions", - "triggers", - "webhooks", -] +_sub_packages = ["agents", "environments", "interactions", "triggers", "webhooks"] def __getattr__(attr_name: str) -> Any: diff --git a/google/genai/_gaos/types/credentials/__init__.py b/google/genai/_gaos/types/credentials/__init__.py deleted file mode 100644 index ceb75189d..000000000 --- a/google/genai/_gaos/types/credentials/__init__.py +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from typing import Any, TYPE_CHECKING - -from ...utils.dynamic_imports import lazy_getattr, lazy_dir - -if TYPE_CHECKING: - from .credential import Credential, CredentialTypedDict, Status, Type - from .credentialcreateparams import ( - CredentialCreateParams, - CredentialCreateParamsParam, - ) - from .credentiallistresponse import ( - CredentialListResponse, - CredentialListResponseTypedDict, - ) - from .credentialupdate import CredentialUpdate, CredentialUpdateParam - from .environmentvariableconfig import ( - EnvironmentVariableConfig, - EnvironmentVariableConfigInjectionLocation, - EnvironmentVariableConfigInjectionLocationParam, - EnvironmentVariableConfigParam, - ) - from .environmentvariableupdateconfig import ( - EnvironmentVariableUpdateConfig, - EnvironmentVariableUpdateConfigInjectionLocation, - EnvironmentVariableUpdateConfigInjectionLocationParam, - EnvironmentVariableUpdateConfigParam, - ) - from .httpbearerconfig import HTTPBearerConfig, HTTPBearerConfigParam - from .httpbearerupdateconfig import ( - HTTPBearerUpdateConfig, - HTTPBearerUpdateConfigParam, - ) - from .injectionlocation_enum import InjectionLocationEnum - from .oauth2config import OAuth2Config, OAuth2ConfigParam - from .oauth2updateconfig import OAuth2UpdateConfig, OAuth2UpdateConfigParam - -__all__ = [ - "Credential", - "CredentialCreateParams", - "CredentialCreateParamsParam", - "CredentialListResponse", - "CredentialListResponseTypedDict", - "CredentialTypedDict", - "CredentialUpdate", - "CredentialUpdateParam", - "EnvironmentVariableConfig", - "EnvironmentVariableConfigInjectionLocation", - "EnvironmentVariableConfigInjectionLocationParam", - "EnvironmentVariableConfigParam", - "EnvironmentVariableUpdateConfig", - "EnvironmentVariableUpdateConfigInjectionLocation", - "EnvironmentVariableUpdateConfigInjectionLocationParam", - "EnvironmentVariableUpdateConfigParam", - "HTTPBearerConfig", - "HTTPBearerConfigParam", - "HTTPBearerUpdateConfig", - "HTTPBearerUpdateConfigParam", - "InjectionLocationEnum", - "OAuth2Config", - "OAuth2ConfigParam", - "OAuth2UpdateConfig", - "OAuth2UpdateConfigParam", - "Status", - "Type", -] - -_dynamic_imports: dict[str, str] = { - "Credential": ".credential", - "CredentialTypedDict": ".credential", - "Status": ".credential", - "Type": ".credential", - "CredentialCreateParams": ".credentialcreateparams", - "CredentialCreateParamsParam": ".credentialcreateparams", - "CredentialListResponse": ".credentiallistresponse", - "CredentialListResponseTypedDict": ".credentiallistresponse", - "CredentialUpdate": ".credentialupdate", - "CredentialUpdateParam": ".credentialupdate", - "EnvironmentVariableConfig": ".environmentvariableconfig", - "EnvironmentVariableConfigInjectionLocation": ".environmentvariableconfig", - "EnvironmentVariableConfigInjectionLocationParam": ".environmentvariableconfig", - "EnvironmentVariableConfigParam": ".environmentvariableconfig", - "EnvironmentVariableUpdateConfig": ".environmentvariableupdateconfig", - "EnvironmentVariableUpdateConfigInjectionLocation": ".environmentvariableupdateconfig", - "EnvironmentVariableUpdateConfigInjectionLocationParam": ".environmentvariableupdateconfig", - "EnvironmentVariableUpdateConfigParam": ".environmentvariableupdateconfig", - "HTTPBearerConfig": ".httpbearerconfig", - "HTTPBearerConfigParam": ".httpbearerconfig", - "HTTPBearerUpdateConfig": ".httpbearerupdateconfig", - "HTTPBearerUpdateConfigParam": ".httpbearerupdateconfig", - "InjectionLocationEnum": ".injectionlocation_enum", - "OAuth2Config": ".oauth2config", - "OAuth2ConfigParam": ".oauth2config", - "OAuth2UpdateConfig": ".oauth2updateconfig", - "OAuth2UpdateConfigParam": ".oauth2updateconfig", -} - - -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports=_dynamic_imports - ) - - -def __dir__(): - return lazy_dir(dynamic_imports=_dynamic_imports) diff --git a/google/genai/_gaos/types/credentials/credential.py b/google/genai/_gaos/types/credentials/credential.py deleted file mode 100644 index 9f829a86b..000000000 --- a/google/genai/_gaos/types/credentials/credential.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from datetime import datetime -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from pydantic import model_serializer -from typing import Literal, Optional, Union -from typing_extensions import NotRequired, TypedDict - - -Status = Union[ - Literal[ - "active", - "revoked", - ], - UnrecognizedStr, -] -r"""Output only. Current status of the credential.""" - - -Type = Union[ - Literal[ - "bearer_token", - "oauth2", - "environment_variable", - ], - UnrecognizedStr, -] -r"""Required. Output only. The type of credential.""" - - -class CredentialTypedDict(TypedDict): - r"""Server-managed credential resource stored in Secret Manager.""" - - id: str - r"""Required. Output only. Identifier. Unique identifier for the credential.""" - create_time: NotRequired[datetime] - r"""Output only. The timestamp when the credential was created.""" - status: NotRequired[Status] - r"""Output only. Current status of the credential.""" - type: NotRequired[Type] - r"""Required. Output only. The type of credential.""" - update_time: NotRequired[datetime] - r"""Output only. The timestamp when the credential was last updated.""" - - -class Credential(BaseModel): - r"""Server-managed credential resource stored in Secret Manager.""" - - id: str - r"""Required. Output only. Identifier. Unique identifier for the credential.""" - - create_time: Optional[datetime] = None - r"""Output only. The timestamp when the credential was created.""" - - status: Optional[Status] = None - r"""Output only. Current status of the credential.""" - - type: Optional[Type] = None - r"""Required. Output only. The type of credential.""" - - update_time: Optional[datetime] = None - r"""Output only. The timestamp when the credential was last updated.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["create_time", "status", "type", "update_time"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/credentials/credentialcreateparams.py b/google/genai/_gaos/types/credentials/credentialcreateparams.py deleted file mode 100644 index 8eed6bbb0..000000000 --- a/google/genai/_gaos/types/credentials/credentialcreateparams.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .environmentvariableconfig import ( - EnvironmentVariableConfig, - EnvironmentVariableConfigParam, -) -from .httpbearerconfig import HTTPBearerConfig, HTTPBearerConfigParam -from .oauth2config import OAuth2Config, OAuth2ConfigParam -from pydantic import Field -from typing import Union -from typing_extensions import Annotated, TypeAliasType - - -CredentialCreateParamsParam = TypeAliasType( - "CredentialCreateParamsParam", - Union[EnvironmentVariableConfigParam, HTTPBearerConfigParam, OAuth2ConfigParam], -) -r"""Represents the fields of a Credential provided on creation.""" - - -CredentialCreateParams = Annotated[ - Union[EnvironmentVariableConfig, HTTPBearerConfig, OAuth2Config], - Field(discriminator="type"), -] -r"""Represents the fields of a Credential provided on creation.""" diff --git a/google/genai/_gaos/types/credentials/credentiallistresponse.py b/google/genai/_gaos/types/credentials/credentiallistresponse.py deleted file mode 100644 index 8a93a8ef5..000000000 --- a/google/genai/_gaos/types/credentials/credentiallistresponse.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .credential import Credential, CredentialTypedDict -from .. import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class CredentialListResponseTypedDict(TypedDict): - credentials: NotRequired[List[CredentialTypedDict]] - next_page_token: NotRequired[str] - - -class CredentialListResponse(BaseModel): - credentials: Optional[List[Credential]] = None - - next_page_token: Optional[str] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["credentials", "next_page_token"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/credentials/credentialupdate.py b/google/genai/_gaos/types/credentials/credentialupdate.py deleted file mode 100644 index 45ebffd55..000000000 --- a/google/genai/_gaos/types/credentials/credentialupdate.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .environmentvariableupdateconfig import ( - EnvironmentVariableUpdateConfig, - EnvironmentVariableUpdateConfigParam, -) -from .httpbearerupdateconfig import HTTPBearerUpdateConfig, HTTPBearerUpdateConfigParam -from .oauth2updateconfig import OAuth2UpdateConfig, OAuth2UpdateConfigParam -from pydantic import Field -from typing import Union -from typing_extensions import Annotated, TypeAliasType - - -CredentialUpdateParam = TypeAliasType( - "CredentialUpdateParam", - Union[ - EnvironmentVariableUpdateConfigParam, - HTTPBearerUpdateConfigParam, - OAuth2UpdateConfigParam, - ], -) -r"""Represents the fields of a Credential that can be updated.""" - - -CredentialUpdate = Annotated[ - Union[EnvironmentVariableUpdateConfig, HTTPBearerUpdateConfig, OAuth2UpdateConfig], - Field(discriminator="type"), -] -r"""Represents the fields of a Credential that can be updated.""" diff --git a/google/genai/_gaos/types/credentials/environmentvariableconfig.py b/google/genai/_gaos/types/credentials/environmentvariableconfig.py deleted file mode 100644 index c4f42342c..000000000 --- a/google/genai/_gaos/types/credentials/environmentvariableconfig.py +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .injectionlocation_enum import InjectionLocationEnum -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -EnvironmentVariableConfigInjectionLocationParam = TypeAliasType( - "EnvironmentVariableConfigInjectionLocationParam", - Union[InjectionLocationEnum, List[InjectionLocationEnum]], -) -r"""Required. Locations where the environment variable can be injected in -outgoing HTTP requests. Must contain at least one location. -Accepts either a single location (e.g. \"header\") or an array of locations. -""" - - -EnvironmentVariableConfigInjectionLocation = TypeAliasType( - "EnvironmentVariableConfigInjectionLocation", - Union[InjectionLocationEnum, List[InjectionLocationEnum]], -) -r"""Required. Locations where the environment variable can be injected in -outgoing HTTP requests. Must contain at least one location. -Accepts either a single location (e.g. \"header\") or an array of locations. -""" - - -class EnvironmentVariableConfigParam(TypedDict): - r"""Configuration for environment variable credentials.""" - - id: str - injection_location: EnvironmentVariableConfigInjectionLocationParam - r"""Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - """ - value: str - r"""Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - """ - trusted_domains: NotRequired[List[str]] - r"""Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - """ - type: Literal["environment_variable"] - - -class EnvironmentVariableConfig(BaseModel): - r"""Configuration for environment variable credentials.""" - - id: str - - injection_location: EnvironmentVariableConfigInjectionLocation - r"""Required. Locations where the environment variable can be injected in - outgoing HTTP requests. Must contain at least one location. - Accepts either a single location (e.g. \"header\") or an array of locations. - """ - - value: str - r"""Required. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - """ - - trusted_domains: Optional[List[str]] = None - r"""Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - """ - - type: Annotated[ - Annotated[ - Literal["environment_variable"], - AfterValidator(validate_const("environment_variable")), - ], - pydantic.Field(alias="type"), - ] = "environment_variable" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["trusted_domains"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - EnvironmentVariableConfig.model_rebuild() -except NameError: - pass diff --git a/google/genai/_gaos/types/credentials/environmentvariableupdateconfig.py b/google/genai/_gaos/types/credentials/environmentvariableupdateconfig.py deleted file mode 100644 index 5dcd6631e..000000000 --- a/google/genai/_gaos/types/credentials/environmentvariableupdateconfig.py +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .injectionlocation_enum import InjectionLocationEnum -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -EnvironmentVariableUpdateConfigInjectionLocationParam = TypeAliasType( - "EnvironmentVariableUpdateConfigInjectionLocationParam", - Union[InjectionLocationEnum, List[InjectionLocationEnum]], -) -r"""Optional. Locations where the environment variable can be injected in -outgoing HTTP requests. -Accepts either a single location (e.g. \"header\") or an array of locations. -""" - - -EnvironmentVariableUpdateConfigInjectionLocation = TypeAliasType( - "EnvironmentVariableUpdateConfigInjectionLocation", - Union[InjectionLocationEnum, List[InjectionLocationEnum]], -) -r"""Optional. Locations where the environment variable can be injected in -outgoing HTTP requests. -Accepts either a single location (e.g. \"header\") or an array of locations. -""" - - -class EnvironmentVariableUpdateConfigParam(TypedDict): - r"""Configuration for updating environment variable credentials.""" - - injection_location: NotRequired[ - EnvironmentVariableUpdateConfigInjectionLocationParam - ] - r"""Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - """ - trusted_domains: NotRequired[List[str]] - r"""Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - """ - type: Literal["environment_variable"] - value: NotRequired[str] - r"""Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - """ - - -class EnvironmentVariableUpdateConfig(BaseModel): - r"""Configuration for updating environment variable credentials.""" - - injection_location: Optional[EnvironmentVariableUpdateConfigInjectionLocation] = ( - None - ) - r"""Optional. Locations where the environment variable can be injected in - outgoing HTTP requests. - Accepts either a single location (e.g. \"header\") or an array of locations. - """ - - trusted_domains: Optional[List[str]] = None - r"""Optional. List of domains allowed to receive this environment variable - value in HTTP requests. - """ - - type: Annotated[ - Annotated[ - Literal["environment_variable"], - AfterValidator(validate_const("environment_variable")), - ], - pydantic.Field(alias="type"), - ] = "environment_variable" - - value: Optional[str] = None - r"""Optional. Input only. Secret value of the environment variable. Write-only; never - returned in responses. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["injection_location", "trusted_domains", "value"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - EnvironmentVariableUpdateConfig.model_rebuild() -except NameError: - pass diff --git a/google/genai/_gaos/types/credentials/httpbearerconfig.py b/google/genai/_gaos/types/credentials/httpbearerconfig.py deleted file mode 100644 index c334f31f0..000000000 --- a/google/genai/_gaos/types/credentials/httpbearerconfig.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class HTTPBearerConfigParam(TypedDict): - r"""Configuration for HTTP Bearer token credentials.""" - - id: str - token: str - r"""Required. Input only. The static bearer token. Write-only; never returned in responses.""" - header_name: NotRequired[str] - r"""Optional. Header name to inject the token into. Defaults to - 'Authorization'. - """ - prefix: NotRequired[str] - r"""Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - """ - type: Literal["bearer_token"] - - -class HTTPBearerConfig(BaseModel): - r"""Configuration for HTTP Bearer token credentials.""" - - id: str - - token: str - r"""Required. Input only. The static bearer token. Write-only; never returned in responses.""" - - header_name: Optional[str] = None - r"""Optional. Header name to inject the token into. Defaults to - 'Authorization'. - """ - - prefix: Optional[str] = None - r"""Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - """ - - type: Annotated[ - Annotated[ - Literal["bearer_token"], AfterValidator(validate_const("bearer_token")) - ], - pydantic.Field(alias="type"), - ] = "bearer_token" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["header_name", "prefix"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - HTTPBearerConfig.model_rebuild() -except NameError: - pass diff --git a/google/genai/_gaos/types/credentials/httpbearerupdateconfig.py b/google/genai/_gaos/types/credentials/httpbearerupdateconfig.py deleted file mode 100644 index 34e94f880..000000000 --- a/google/genai/_gaos/types/credentials/httpbearerupdateconfig.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class HTTPBearerUpdateConfigParam(TypedDict): - r"""Configuration for updating HTTP Bearer token credentials.""" - - header_name: NotRequired[str] - r"""Optional. Header name to inject the token into. Defaults to - 'Authorization'. - """ - prefix: NotRequired[str] - r"""Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - """ - token: NotRequired[str] - r"""Optional. Input only. The static bearer token. Write-only; never returned in responses.""" - type: Literal["bearer_token"] - - -class HTTPBearerUpdateConfig(BaseModel): - r"""Configuration for updating HTTP Bearer token credentials.""" - - header_name: Optional[str] = None - r"""Optional. Header name to inject the token into. Defaults to - 'Authorization'. - """ - - prefix: Optional[str] = None - r"""Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' - for no prefix. - """ - - token: Optional[str] = None - r"""Optional. Input only. The static bearer token. Write-only; never returned in responses.""" - - type: Annotated[ - Annotated[ - Literal["bearer_token"], AfterValidator(validate_const("bearer_token")) - ], - pydantic.Field(alias="type"), - ] = "bearer_token" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["header_name", "prefix", "token"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - HTTPBearerUpdateConfig.model_rebuild() -except NameError: - pass diff --git a/google/genai/_gaos/types/credentials/injectionlocation_enum.py b/google/genai/_gaos/types/credentials/injectionlocation_enum.py deleted file mode 100644 index a81a4e499..000000000 --- a/google/genai/_gaos/types/credentials/injectionlocation_enum.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from typing import Literal - - -InjectionLocationEnum = Literal[ - "header", - "query", - "body", -] diff --git a/google/genai/_gaos/types/credentials/oauth2config.py b/google/genai/_gaos/types/credentials/oauth2config.py deleted file mode 100644 index 45e40ad6a..000000000 --- a/google/genai/_gaos/types/credentials/oauth2config.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class OAuth2ConfigParam(TypedDict): - r"""Configuration for OAuth2 credentials with automatic token refresh.""" - - client_id: str - r"""Required. OAuth2 client ID.""" - client_secret: str - r"""Required. Input only. OAuth2 client secret. Write-only; never returned in responses.""" - id: str - refresh_token: str - r"""Required. Input only. OAuth2 refresh token. Write-only; never returned in responses.""" - token_url: str - r"""Required. OAuth2 token endpoint URL for refreshing access tokens.""" - scopes: NotRequired[List[str]] - r"""Optional. List of OAuth2 scopes.""" - type: Literal["oauth2"] - - -class OAuth2Config(BaseModel): - r"""Configuration for OAuth2 credentials with automatic token refresh.""" - - client_id: str - r"""Required. OAuth2 client ID.""" - - client_secret: str - r"""Required. Input only. OAuth2 client secret. Write-only; never returned in responses.""" - - id: str - - refresh_token: str - r"""Required. Input only. OAuth2 refresh token. Write-only; never returned in responses.""" - - token_url: str - r"""Required. OAuth2 token endpoint URL for refreshing access tokens.""" - - scopes: Optional[List[str]] = None - r"""Optional. List of OAuth2 scopes.""" - - type: Annotated[ - Annotated[Literal["oauth2"], AfterValidator(validate_const("oauth2"))], - pydantic.Field(alias="type"), - ] = "oauth2" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["scopes"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - OAuth2Config.model_rebuild() -except NameError: - pass diff --git a/google/genai/_gaos/types/credentials/oauth2updateconfig.py b/google/genai/_gaos/types/credentials/oauth2updateconfig.py deleted file mode 100644 index a7fb9d60a..000000000 --- a/google/genai/_gaos/types/credentials/oauth2updateconfig.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class OAuth2UpdateConfigParam(TypedDict): - r"""Configuration for updating OAuth2 credentials.""" - - client_id: NotRequired[str] - r"""Optional. OAuth2 client ID.""" - client_secret: NotRequired[str] - r"""Optional. Input only. OAuth2 client secret. Write-only; never returned in responses.""" - refresh_token: NotRequired[str] - r"""Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses.""" - scopes: NotRequired[List[str]] - r"""Optional. List of OAuth2 scopes.""" - token_url: NotRequired[str] - r"""Optional. OAuth2 token endpoint URL for refreshing access tokens.""" - type: Literal["oauth2"] - - -class OAuth2UpdateConfig(BaseModel): - r"""Configuration for updating OAuth2 credentials.""" - - client_id: Optional[str] = None - r"""Optional. OAuth2 client ID.""" - - client_secret: Optional[str] = None - r"""Optional. Input only. OAuth2 client secret. Write-only; never returned in responses.""" - - refresh_token: Optional[str] = None - r"""Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses.""" - - scopes: Optional[List[str]] = None - r"""Optional. List of OAuth2 scopes.""" - - token_url: Optional[str] = None - r"""Optional. OAuth2 token endpoint URL for refreshing access tokens.""" - - type: Annotated[ - Annotated[Literal["oauth2"], AfterValidator(validate_const("oauth2"))], - pydantic.Field(alias="type"), - ] = "oauth2" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["client_id", "client_secret", "refresh_token", "scopes", "token_url"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - OAuth2UpdateConfig.model_rebuild() -except NameError: - pass diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index 6385067bb..85241e0f4 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -107,8 +107,6 @@ from .dynamicagentconfig import DynamicAgentConfig, DynamicAgentConfigParam from .empty import Empty, EmptyTypedDict from .environment import ( - Env, - EnvParam, Environment, EnvironmentParam, Network, @@ -122,7 +120,6 @@ EnvironmentNetworkEgressAllowlist, EnvironmentNetworkEgressAllowlistParam, ) - from .envvar import EnvVar, EnvVarParam from .error import Error, ErrorTypedDict from .errorevent import ErrorEvent, ErrorEventTypedDict from .exaaisearchconfig import ExaAISearchConfig, ExaAISearchConfigParam @@ -513,10 +510,6 @@ "DynamicAgentConfigParam", "Empty", "EmptyTypedDict", - "Env", - "EnvParam", - "EnvVar", - "EnvVarParam", "Environment", "EnvironmentEnum", "EnvironmentNetworkEgressAllowlist", @@ -922,8 +915,6 @@ "DynamicAgentConfigParam": ".dynamicagentconfig", "Empty": ".empty", "EmptyTypedDict": ".empty", - "Env": ".environment", - "EnvParam": ".environment", "Environment": ".environment", "EnvironmentParam": ".environment", "Network": ".environment", @@ -934,8 +925,6 @@ "Disabled": ".environmentnetworkegressallowlist", "EnvironmentNetworkEgressAllowlist": ".environmentnetworkegressallowlist", "EnvironmentNetworkEgressAllowlistParam": ".environmentnetworkegressallowlist", - "EnvVar": ".envvar", - "EnvVarParam": ".envvar", "Error": ".error", "ErrorTypedDict": ".error", "ErrorEvent": ".errorevent", diff --git a/google/genai/_gaos/types/interactions/allowlistentry.py b/google/genai/_gaos/types/interactions/allowlistentry.py index d6e4f1288..b8e511d5f 100644 --- a/google/genai/_gaos/types/interactions/allowlistentry.py +++ b/google/genai/_gaos/types/interactions/allowlistentry.py @@ -39,8 +39,6 @@ class AllowlistEntryParam(TypedDict): domain: str r"""Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.""" - credential: NotRequired[str] - r"""Optional. Reference to a server-managed Credential resource by ID.""" transform: NotRequired[TransformParam] r"""Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.""" @@ -51,15 +49,12 @@ class AllowlistEntry(BaseModel): domain: str r"""Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.""" - credential: Optional[str] = None - r"""Optional. Reference to a server-managed Credential resource by ID.""" - transform: Optional[Transform] = None r"""Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["credential", "transform"]) + optional_fields = set(["transform"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/environment.py b/google/genai/_gaos/types/interactions/environment.py index a47edc5c6..41be41c22 100644 --- a/google/genai/_gaos/types/interactions/environment.py +++ b/google/genai/_gaos/types/interactions/environment.py @@ -22,25 +22,16 @@ EnvironmentNetworkEgressAllowlist, EnvironmentNetworkEgressAllowlistParam, ) -from .envvar import EnvVar, EnvVarParam from .source import Source, SourceParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator -from typing import Dict, List, Literal, Optional, Union +from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -EnvParam = TypeAliasType("EnvParam", Union[Dict[str, EnvVarParam], str]) -r"""Environment variables to set in the sandbox environment.""" - - -Env = TypeAliasType("Env", Union[Dict[str, EnvVar], str]) -r"""Environment variables to set in the sandbox environment.""" - - NetworkEnum = Literal["disabled",] @@ -59,8 +50,6 @@ class EnvironmentParam(TypedDict): r"""Configuration for a custom environment.""" - env: NotRequired[EnvParam] - r"""Environment variables to set in the sandbox environment.""" environment_id: NotRequired[str] r"""Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one. @@ -74,9 +63,6 @@ class EnvironmentParam(TypedDict): class Environment(BaseModel): r"""Configuration for a custom environment.""" - env: Optional[Env] = None - r"""Environment variables to set in the sandbox environment.""" - environment_id: Optional[str] = None r"""Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one. @@ -94,7 +80,7 @@ class Environment(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["env", "environment_id", "network", "sources"]) + optional_fields = set(["environment_id", "network", "sources"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/envvar.py b/google/genai/_gaos/types/interactions/envvar.py deleted file mode 100644 index 6605130c8..000000000 --- a/google/genai/_gaos/types/interactions/envvar.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable -# pylint: skip-file - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict - - -class EnvVarParam(TypedDict): - r"""An environment variable to set in the execution environment.""" - - credential: NotRequired[str] - r"""Optional reference to a server-managed Credential resource by ID.""" - value: NotRequired[str] - r"""Direct string value for plain environment variables.""" - - -class EnvVar(BaseModel): - r"""An environment variable to set in the execution environment.""" - - credential: Optional[str] = None - r"""Optional reference to a server-managed Credential resource by ID.""" - - value: Optional[str] = None - r"""Direct string value for plain environment variables.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["credential", "value"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m