instance_switcher
instance_switcher ¶
InstanceSwitcher
dataclass
¶
InstanceSwitcher(
auth: DomoAuth,
domo_instance_switcher_mapping: list[
InstanceSwitcher_Mapping
] = list(),
)
Manages instance switcher configuration for a Domo instance.
This class handles the configuration of instance switching mappings, which allow users with specific attributes to switch between different Domo instances.
Attributes:
| Name | Type | Description |
|---|---|---|
auth |
DomoAuth
|
Authentication object for API requests |
domo_instance_switcher_mapping |
list[InstanceSwitcher_Mapping]
|
list of instance switcher mappings |
add_mapping
async
¶
add_mapping(
mapping_to_add_ls: list[InstanceSwitcher_Mapping],
session: AsyncClient | None = None,
debug_api: bool = False,
debug_num_stacks_to_drop: int = 2,
timeout: int = 20,
wait: int = 5,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> list[InstanceSwitcher_Mapping]
Add new mappings to existing configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mapping_to_add_ls
|
list[InstanceSwitcher_Mapping]
|
list of mappings to add |
required |
session
|
AsyncClient | None
|
HTTP client session |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop for debugging |
2
|
timeout
|
int
|
Request timeout in seconds |
20
|
wait
|
int
|
Seconds to wait before retrieving updated mappings |
5
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
Returns:
| Type | Description |
|---|---|
list[InstanceSwitcher_Mapping]
|
Updated list of instance switcher mappings |
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
get
async
¶
get(
debug_api: bool = False,
session: AsyncClient | None = None,
timeout: int = 20,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> InstanceSwitcher
Fill in the instance's current switcher mappings.
Replaces domo_instance_switcher_mapping with what the instance holds now,
so mappings removed in Domo do not linger (get_mapping only adds).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session |
None
|
timeout
|
int
|
Request timeout in seconds |
20
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
Returns:
| Type | Description |
|---|---|
InstanceSwitcher
|
This InstanceSwitcher, with its mappings refreshed. |
Raises:
| Type | Description |
|---|---|
InstanceSwitcher_GET_Error
|
If mapping retrieval fails |
Calls route
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
get_mapping
async
¶
get_mapping(
debug_api: bool = False,
return_raw: bool = False,
session: AsyncClient | None = None,
debug_num_stacks_to_drop: int = 2,
timeout: int = 20,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> list[InstanceSwitcher_Mapping]
Retrieve current instance switcher mappings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
return_raw
|
bool
|
Return raw response without processing |
False
|
session
|
AsyncClient | None
|
HTTP client session |
None
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop for debugging |
2
|
timeout
|
int
|
Request timeout in seconds |
20
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
Returns:
| Type | Description |
|---|---|
list[InstanceSwitcher_Mapping]
|
list of instance switcher mappings or raw response if return_raw=True |
Calls route
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
set_mapping
async
¶
set_mapping(
mapping_ls: list[InstanceSwitcher_Mapping]
| None = None,
session: AsyncClient | None = None,
debug_api: bool = False,
return_raw: bool = False,
debug_num_stacks_to_drop: int = 2,
timeout: int = 60,
wait: int = 5,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> list[InstanceSwitcher_Mapping]
Overwrite existing mappings with new mapping list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mapping_ls
|
list[InstanceSwitcher_Mapping] | None
|
list of mappings to set (defaults to self.domo_instance_switcher_mapping) |
None
|
session
|
AsyncClient | None
|
HTTP client session |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
return_raw
|
bool
|
Return raw response without processing |
False
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop for debugging |
2
|
timeout
|
int
|
Request timeout in seconds |
60
|
wait
|
int
|
Seconds to wait before retrieving updated mappings |
5
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
Returns:
| Type | Description |
|---|---|
list[InstanceSwitcher_Mapping]
|
Updated list of instance switcher mappings or raw response if return_raw=True |
Calls route
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
InstanceSwitcher_CRUD_Error ¶
InstanceSwitcher_CRUD_Error(
operation: str,
entity_id: str | None = None,
res=None,
message: str | None = None,
**kwargs,
)
Bases: RouteError
Raised when instance switcher mapping create, update, or delete operations fail.
Source code in src/crew_dcs/routes/instance_config/instance_switcher.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
InstanceSwitcher_GET_Error ¶
InstanceSwitcher_GET_Error(
entity_id: str | None = None,
res=None,
message: str | None = None,
**kwargs,
)
Bases: RouteError
Raised when instance switcher mapping retrieval operations fail.
Source code in src/crew_dcs/routes/instance_config/instance_switcher.py
29 30 31 32 33 34 35 36 37 38 39 40 41 | |
InstanceSwitcher_Mapping
dataclass
¶
InstanceSwitcher_Mapping(
user_attribute: str, target_instance: str
)
Represents a single instance switcher mapping configuration.
Maps a user attribute to a target Domo instance that users can switch to.
Attributes:
| Name | Type | Description |
|---|---|---|
user_attribute |
str
|
The user attribute key used for mapping |
target_instance |
str
|
The Domo instance domain (without .domo.com) |
from_dict
classmethod
¶
from_dict(obj: dict[str, Any]) -> InstanceSwitcher_Mapping
Create a mapping from API response dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
dict[str, Any]
|
Dictionary with userAttribute and instance keys |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DomoInstanceConfig_InstanceSwitcher_Mapping |
InstanceSwitcher_Mapping
|
New mapping instance |
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
from_obj
classmethod
¶
from_obj(obj: dict[str, Any]) -> InstanceSwitcher_Mapping
Legacy method - calls from_dict for compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
dict[str, Any]
|
Dictionary with userAttribute and instance keys |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DomoInstanceConfig_InstanceSwitcher_Mapping |
InstanceSwitcher_Mapping
|
New mapping instance |
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
88 89 90 91 92 93 94 95 96 97 98 | |
to_dict ¶
to_dict() -> dict
Convert mapping to API request format.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary with userAttribute and instance (including .domo.com) |
Source code in src/crew_dcs/classes/DomoInstanceConfig/instance_switcher.py
100 101 102 103 104 105 106 107 108 109 | |