Skip to content

Commit 45659d8

Browse files
Python TFE - Cleaned example-variable_sets
1 parent ad46264 commit 45659d8

2 files changed

Lines changed: 43 additions & 7 deletions

File tree

examples/variable_sets.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
import os
1717

18-
from pytfe.types import (
18+
from pytfe import TFEClient, TFEConfig
19+
from pytfe.models import (
1920
CategoryType,
2021
Parent,
2122
Project,
@@ -24,17 +25,17 @@
2425
VariableSetCreateOptions,
2526
VariableSetIncludeOpt,
2627
VariableSetListOptions,
28+
VariableSetReadOptions,
2729
VariableSetRemoveFromProjectsOptions,
2830
VariableSetRemoveFromWorkspacesOptions,
2931
VariableSetUpdateOptions,
3032
VariableSetVariableCreateOptions,
3133
VariableSetVariableListOptions,
3234
VariableSetVariableUpdateOptions,
3335
Workspace,
36+
WorkspaceListOptions,
3437
)
3538

36-
from pytfe import TFEClient, TFEConfig
37-
3839

3940
def variable_set_example():
4041
"""Demonstrate Variable Set operations."""
@@ -193,8 +194,6 @@ def variable_set_example():
193194
print("7. Workspace operations example...")
194195
try:
195196
# List some workspaces first
196-
from pytfe.types import WorkspaceListOptions
197-
198197
workspace_options = WorkspaceListOptions(page_size=5)
199198
workspaces = list(
200199
client.workspaces.list(org_name, options=workspace_options)
@@ -272,8 +271,6 @@ def variable_set_example():
272271

273272
# 9. Read the variable set with includes
274273
print("9. Reading variable set with includes...")
275-
from pytfe.types import VariableSetReadOptions
276-
277274
read_options = VariableSetReadOptions(
278275
include=[VariableSetIncludeOpt.VARS, VariableSetIncludeOpt.WORKSPACES]
279276
)

src/pytfe/models/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,33 @@
279279

280280
# Variables
281281
from .variable import (
282+
CategoryType,
282283
Variable,
283284
VariableCreateOptions,
284285
VariableListOptions,
285286
VariableUpdateOptions,
286287
)
287288

289+
# ── Variable Sets ──────────────────────────────────────────────────────────────
290+
from .variable_set import (
291+
Parent,
292+
VariableSet,
293+
VariableSetApplyToProjectsOptions,
294+
VariableSetApplyToWorkspacesOptions,
295+
VariableSetCreateOptions,
296+
VariableSetIncludeOpt,
297+
VariableSetListOptions,
298+
VariableSetReadOptions,
299+
VariableSetRemoveFromProjectsOptions,
300+
VariableSetRemoveFromWorkspacesOptions,
301+
VariableSetUpdateOptions,
302+
VariableSetUpdateWorkspacesOptions,
303+
VariableSetVariable,
304+
VariableSetVariableCreateOptions,
305+
VariableSetVariableListOptions,
306+
VariableSetVariableUpdateOptions,
307+
)
308+
288309
# Workspaces
289310
from .workspace import (
290311
LockedByChoice,
@@ -442,6 +463,7 @@
442463
"Tag",
443464
"TagBinding",
444465
"TagList",
466+
"CategoryType",
445467
"Variable",
446468
"VariableCreateOptions",
447469
"VariableListOptions",
@@ -567,4 +589,21 @@
567589
"PolicySetUpdateOptions",
568590
"PolicyKind",
569591
"EnforcementLevel",
592+
# Variable Sets
593+
"Parent",
594+
"VariableSet",
595+
"VariableSetApplyToProjectsOptions",
596+
"VariableSetApplyToWorkspacesOptions",
597+
"VariableSetCreateOptions",
598+
"VariableSetIncludeOpt",
599+
"VariableSetListOptions",
600+
"VariableSetReadOptions",
601+
"VariableSetRemoveFromProjectsOptions",
602+
"VariableSetRemoveFromWorkspacesOptions",
603+
"VariableSetUpdateOptions",
604+
"VariableSetUpdateWorkspacesOptions",
605+
"VariableSetVariable",
606+
"VariableSetVariableCreateOptions",
607+
"VariableSetVariableListOptions",
608+
"VariableSetVariableUpdateOptions",
570609
]

0 commit comments

Comments
 (0)