Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "vantage-python"
version = "0.4.0"
version = "0.5.0"
description = "Python SDK for the Vantage API"
readme = "README.md"
license = "MIT"
Expand Down
28 changes: 28 additions & 0 deletions src/vantage/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,20 @@ async def get(self) -> Me:
return Me.model_validate(data)
return data

async def update(self, body: UpdateMe) -> Me:
"""
Update authenticated user

Update the authenticated User.
"""
path = "/v2/me"
params = None
body_data = body.model_dump(by_alias=True, exclude_none=True) if hasattr(body, 'model_dump') else body
data = await self._client.request("PUT", path, params=params, body=body_data)
if isinstance(data, dict):
return Me.model_validate(data)
return data


class NetworkFlowReportsAsyncApi:
"""Async API methods for network_flow_reports resource."""
Expand Down Expand Up @@ -2980,6 +2994,20 @@ async def get(self, user_token: str) -> User:
return User.model_validate(data)
return data

async def update(self, user_token: str, body: UpdateUser) -> User:
"""
Update a user

Update a specific User.
"""
path = f"/v2/users/{quote(str(user_token), safe='')}"
params = None
body_data = body.model_dump(by_alias=True, exclude_none=True) if hasattr(body, 'model_dump') else body
data = await self._client.request("PUT", path, params=params, body=body_data)
if isinstance(data, dict):
return User.model_validate(data)
return data


class VirtualTagConfigsAsyncApi:
"""Async API methods for virtual_tag_configs resource."""
Expand Down
28 changes: 28 additions & 0 deletions src/vantage/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,20 @@ def get(self) -> Me:
return Me.model_validate(data)
return data

def update(self, body: UpdateMe) -> Me:
"""
Update authenticated user

Update the authenticated User.
"""
path = "/v2/me"
params = None
body_data = body.model_dump(by_alias=True, exclude_none=True) if hasattr(body, 'model_dump') else body
data = self._client.request("PUT", path, params=params, body=body_data)
if isinstance(data, dict):
return Me.model_validate(data)
return data


class NetworkFlowReportsApi:
"""API methods for network_flow_reports resource."""
Expand Down Expand Up @@ -2980,6 +2994,20 @@ def get(self, user_token: str) -> User:
return User.model_validate(data)
return data

def update(self, user_token: str, body: UpdateUser) -> User:
"""
Update a user

Update a specific User.
"""
path = f"/v2/users/{quote(str(user_token), safe='')}"
params = None
body_data = body.model_dump(by_alias=True, exclude_none=True) if hasattr(body, 'model_dump') else body
data = self._client.request("PUT", path, params=params, body=body_data)
if isinstance(data, dict):
return User.model_validate(data)
return data


class VirtualTagConfigsApi:
"""API methods for virtual_tag_configs resource."""
Expand Down
31 changes: 24 additions & 7 deletions src/vantage/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ class Me(BaseModel):
"""Me model"""

default_workspace_token: Optional[str]
default_dashboard_token: Optional[str] = Field(default=None, description="The token of the default Dashboard for the User.")
workspaces: List[Workspace]
bearer_token: BearerToken

Expand All @@ -1197,6 +1198,12 @@ class BearerToken(BaseModel):
scope: List[str] = Field(description="The scopes applied to the BearerToken used to authenticate this request.")


class UpdateMe(BaseModel):
"""Update the authenticated User."""

default_dashboard_token: Optional[str] = Field(default=None, description="The token of a Dashboard to set as the User default. Send null to clear.")


class CostProviders(BaseModel):
"""CostProviders model"""

Expand Down Expand Up @@ -1672,6 +1679,7 @@ class Team(BaseModel):
workspace_tokens: List[str] = Field(description="The tokens for any Workspaces that the Team belongs to")
user_emails: List[str] = Field(description="The email addresses for Users that belong to the Team")
user_tokens: List[str] = Field(description="The tokens for Users that belong to the Team")
default_dashboard_token: Optional[str] = Field(description="The token of the default Dashboard for the Team.")


class CreateTeam(BaseModel):
Expand All @@ -1683,6 +1691,7 @@ class CreateTeam(BaseModel):
user_tokens: Optional[List[str]] = Field(default=None, description="The User tokens to associate to the Team.")
user_emails: Optional[List[str]] = Field(default=None, description="The User emails to associate to the Team.")
role: Optional[str] = Field(default=None, description="The role to assign to the provided Users. Defaults to 'editor' which has editor permissions.")
default_dashboard_token: Optional[str] = Field(default=None, description="The token of a Dashboard to set as the Team default. Send null to clear.")


class UpdateTeam(BaseModel):
Expand All @@ -1694,6 +1703,7 @@ class UpdateTeam(BaseModel):
user_tokens: Optional[List[str]] = Field(default=None, description="The User tokens to associate to the Team.")
user_emails: Optional[List[str]] = Field(default=None, description="The User emails to associate to the Team.")
role: Optional[str] = Field(default=None, description="The role to assign to the provided Users. Defaults to 'editor' which has editor permissions.")
default_dashboard_token: Optional[str] = Field(default=None, description="The token of a Dashboard to set as the Team default. Send null to clear.")


class TeamMembers(BaseModel):
Expand Down Expand Up @@ -1760,9 +1770,16 @@ class User(BaseModel):
name: Optional[str] = Field(description="The name of the User.")
email: str = Field(description="The email of the User.")
role: str = Field(description="The role of the User.")
default_dashboard_token: Optional[str] = Field(default=None, description="The token of the default Dashboard for the User.")
last_seen_at: Optional[str] = Field(default=None, description="The last time the User logged in.")


class UpdateUser(BaseModel):
"""Update a specific User."""

default_dashboard_token: Optional[str] = Field(default=None, description="The token of a Dashboard to set as the User default. Send null to clear.")


class VirtualTagConfigs(BaseModel):
"""VirtualTagConfigs model"""

Expand Down Expand Up @@ -1847,6 +1864,13 @@ class UpdateVirtualTagConfig(BaseModel):
values: Optional[List[VirtualTagConfigValue]] = Field(default=None, description="Values for the VirtualTagConfig, with match precedence determined by order in the list.")


class AsyncVirtualTagConfigUpdate(BaseModel):
"""AsyncVirtualTagConfigUpdate model"""

request_id: str = Field(description="The request ID of the async virtual tag config update.")
status_url: str = Field(description="The status path of the async virtual tag config update.")


class UpdateAsyncVirtualTagConfig(BaseModel):
"""Asynchronously updates an existing VirtualTagConfig."""

Expand All @@ -1857,13 +1881,6 @@ class UpdateAsyncVirtualTagConfig(BaseModel):
values: Optional[List[VirtualTagConfigValue]] = Field(default=None, description="Values for the VirtualTagConfig, with match precedence determined by order in the list.")


class AsyncVirtualTagConfigUpdate(BaseModel):
"""AsyncVirtualTagConfigUpdate model"""

request_id: str = Field(description="The request ID of the async virtual tag config update.")
status_url: str = Field(description="The status path of the async virtual tag config update.")


class Workspaces(BaseModel):
"""Workspaces model"""

Expand Down