Skip to content

mfa

mfa

MFA_Config dataclass

MFA_Config(
    auth: DomoAuth,
    is_multifactor_required: bool = None,
    max_code_attempts: int = None,
    num_days_valid: int = None,
)

disable async

disable(
    is_ignore_test: bool = False,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

will have enable_value=False and will disable mfa in the instance

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
async def disable(
    self,
    is_ignore_test: bool = False,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    """will have enable_value=False and will disable mfa in the instance"""
    return await self.toggle_mfa(
        is_ignore_test=is_ignore_test,
        context=context,
        is_enable_MFA=False,
        **context_kwargs,
    )

enable async

enable(
    is_ignore_test: bool = False,
    session: AsyncClient = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

will have enable_value=True and will enable mfa in the instance

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
async def enable(
    self,
    is_ignore_test: bool = False,
    session: httpx.AsyncClient = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    """will have enable_value=True and will enable mfa in the instance"""
    return await self.toggle_mfa(
        is_ignore_test=is_ignore_test,
        context=context,
        is_enable_MFA=True,
        **context_kwargs,
    )

get async

get(
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
async def get(
    self,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    base_context = RouteContext.build_context(
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        parent_class=self.__class__.__name__,
        **context_kwargs,
    )
    context = RouteContext.build_context(context=context or base_context)

    res = await mfa_routes.get_mfa_config(
        auth=self.auth,
        incl_is_multifactor_required=True,
        incl_num_days_valid=True,
        incl_max_code_attempts=True,
        context=context,
    )

    if return_raw:
        return res

    self.num_days_valid = res.response.get("num_days_valid")
    self.max_code_attempts = res.response.get("max_code_attempts")
    self.is_multifactor_required = res.response.get("is_multifactor_required")

    return self

get_instance_config async classmethod

get_instance_config(
    auth: DomoAuth,
    incl_is_multifactor_required: bool = True,
    incl_num_days_valid: bool = True,
    incl_max_code_attempts: bool = True,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@classmethod
async def get_instance_config(
    cls,
    auth: DomoAuth,
    incl_is_multifactor_required: bool = True,
    incl_num_days_valid: bool = True,
    incl_max_code_attempts: bool = True,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    base_context = RouteContext.build_context(
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        parent_class=cls.__name__,
        **context_kwargs,
    )
    context = RouteContext.build_context(context=context or base_context)

    res = await mfa_routes.get_mfa_config(
        auth=auth,
        incl_is_multifactor_required=incl_is_multifactor_required,
        incl_num_days_valid=incl_num_days_valid,
        incl_max_code_attempts=incl_max_code_attempts,
        return_raw=return_raw,
        context=context,
    )

    if return_raw:
        return res

    return cls.from_dict(auth=auth, obj=res.response)

set_max_code_attempts async

set_max_code_attempts(
    max_code_attempts: int,
    is_ignore_test: bool = False,
    session: AsyncClient = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    suppress_update_self: bool = False,
    debug_prn: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
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
238
239
240
async def set_max_code_attempts(
    self,
    max_code_attempts: int,
    is_ignore_test: bool = False,
    session: httpx.AsyncClient = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    suppress_update_self: bool = False,
    debug_prn: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    base_context = RouteContext.build_context(
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop + 1,
        parent_class=self.__class__.__name__,
        **context_kwargs,
    )
    context = RouteContext.build_context(context=context or base_context)

    need_update_config = self._test_need_update_config(
        attr_name="max_code_attempts",
        new_value=max_code_attempts,
        is_ignore_test=is_ignore_test,
        debug_prn=debug_prn,
    )

    if not need_update_config:
        return self

    await mfa_routes.set_mfa_max_code_attempts(
        auth=self.auth,
        max_code_attempts=max_code_attempts,
        context=context,
    )

    if suppress_update_self:
        return self

    return await self.get(context=context)

set_num_days_valid async

set_num_days_valid(
    num_days_valid: int,
    is_ignore_test: bool = False,
    session: AsyncClient = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    suppress_update_self: bool = False,
    debug_prn: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
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
async def set_num_days_valid(
    self,
    num_days_valid: int,
    is_ignore_test: bool = False,
    session: httpx.AsyncClient = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    suppress_update_self: bool = False,
    debug_prn: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    base_context = RouteContext.build_context(
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop + 1,
        parent_class=self.__class__.__name__,
        **context_kwargs,
    )
    context = RouteContext.build_context(context=context or base_context)

    need_update_config = self._test_need_update_config(
        attr_name="num_days_valid",
        new_value=num_days_valid,
        is_ignore_test=is_ignore_test,
        debug_prn=debug_prn,
    )

    if not need_update_config:
        return self

    await mfa_routes.set_mfa_num_days_valid(
        auth=self.auth,
        num_days_valid=num_days_valid,
        context=context,
    )
    if not suppress_update_self:
        return self

    return await self.get(context=context)

toggle_mfa async

toggle_mfa(
    is_enable_MFA: bool,
    is_ignore_test: bool = False,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    suppress_update_self: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/mfa.py
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
async def toggle_mfa(
    self,
    is_enable_MFA: bool,
    is_ignore_test: bool = False,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop: int = 2,
    suppress_update_self: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    base_context = RouteContext.build_context(
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop + 1,
        parent_class=self.__class__.__name__,
        **context_kwargs,
    )
    context = RouteContext.build_context(context=context or base_context)

    need_update_config = self._test_need_update_config(
        attr_name="is_multifactor_required",
        new_value=is_enable_MFA,
        is_ignore_test=is_ignore_test,
    )

    if not need_update_config:
        return self

    await mfa_routes.toggle_enable_mfa(
        auth=self.auth,
        is_enable_MFA=is_enable_MFA,
        context=context,
    )

    if suppress_update_self:
        return self

    return await self.get(context=context)