@@ -39,23 +39,23 @@ def main():
3939 address = os .environ .get ("TFE_ADDRESS" , "https://app.terraform.io" )
4040
4141 if not token :
42- print ("❌ TFE_TOKEN environment variable is required" )
42+ print (" TFE_TOKEN environment variable is required" )
4343 return 1
4444
4545 if not org :
46- print ("❌ TFE_ORG environment variable is required" )
46+ print (" TFE_ORG environment variable is required" )
4747 return 1
4848
4949 # Create TFE client
5050 config = TFEConfig (token = token , address = address )
5151 client = TFEClient (config = config )
5252
53- print (f"🔗 Connected to: { address } " )
54- print (f"🏢 Organization: { org } " )
53+ print (f"Connected to: { address } " )
54+ print (f" Organization: { org } " )
5555
5656 try :
5757 # Example 1: List existing agent pools
58- print ("\n 📋 Listing existing agent pools..." )
58+ print ("\n Listing existing agent pools..." )
5959 list_options = AgentPoolListOptions (page_size = 10 ) # Optional parameters
6060 agent_pools = client .agent_pools .list (org , options = list_options )
6161
@@ -66,7 +66,7 @@ def main():
6666 print (f" - { pool .name } (ID: { pool .id } , Agents: { pool .agent_count } )" )
6767
6868 # Example 2: Create a new agent pool
69- print ("\n 🆕 Creating a new agent pool..." )
69+ print ("\n Creating a new agent pool..." )
7070 unique_name = f"sdk-example-pool-{ uuid .uuid4 ().hex [:8 ]} "
7171
7272 create_options = AgentPoolCreateOptions (
@@ -76,39 +76,39 @@ def main():
7676 )
7777
7878 new_pool = client .agent_pools .create (org , create_options )
79- print (f"✅ Created agent pool: { new_pool .name } (ID: { new_pool .id } )" )
79+ print (f"Created agent pool: { new_pool .name } (ID: { new_pool .id } )" )
8080
8181 # Example 3: Read the agent pool
82- print ("\n 📖 Reading agent pool details..." )
82+ print ("\n Reading agent pool details..." )
8383 pool_details = client .agent_pools .read (new_pool .id )
8484 print (f" Name: { pool_details .name } " )
8585 print (f" Organization Scoped: { pool_details .organization_scoped } " )
8686 print (f" Policy: { pool_details .allowed_workspace_policy } " )
8787 print (f" Agent Count: { pool_details .agent_count } " )
8888
8989 # Example 4: Update the agent pool
90- print ("\n ✏️ Updating agent pool..." )
90+ print ("\n Updating agent pool..." )
9191 update_options = AgentPoolUpdateOptions (
9292 name = f"{ unique_name } -updated" ,
9393 organization_scoped = False , # Making this optional parameter different
9494 )
9595
9696 updated_pool = client .agent_pools .update (new_pool .id , update_options )
97- print (f"✅ Updated agent pool name to: { updated_pool .name } " )
97+ print (f"Updated agent pool name to: { updated_pool .name } " )
9898
9999 # Example 5: Create an agent token
100- print ("\n 🔑 Creating agent token..." )
100+ print ("\n Creating agent token..." )
101101 token_options = AgentTokenCreateOptions (
102102 description = "SDK example token" # Optional description
103103 )
104104
105105 agent_token = client .agent_tokens .create (new_pool .id , token_options )
106- print (f"✅ Created agent token: { agent_token .id } " )
106+ print (f"Created agent token: { agent_token .id } " )
107107 if agent_token .token :
108108 print (f" Token (first 10 chars): { agent_token .token [:10 ]} ..." )
109109
110110 # Example 6: List agent tokens
111- print ("\n 📝 Listing agent tokens..." )
111+ print ("\n Listing agent tokens..." )
112112 tokens = client .agent_tokens .list (new_pool .id )
113113
114114 # Convert to list to get count and iterate
@@ -120,19 +120,19 @@ def main():
120120 # Example 7: Clean up - delete the token and pool
121121 print ("\n 🧹 Cleaning up..." )
122122 client .agent_tokens .delete (agent_token .id )
123- print ("✅ Deleted agent token" )
123+ print ("Deleted agent token" )
124124
125125 client .agent_pools .delete (new_pool .id )
126- print ("✅ Deleted agent pool" )
126+ print ("Deleted agent pool" )
127127
128- print ("\n 🎉 Agent pool operations completed successfully!" )
128+ print ("\n Agent pool operations completed successfully!" )
129129 return 0
130130
131131 except NotFound as e :
132- print (f"❌ Resource not found: { e } " )
132+ print (f" Resource not found: { e } " )
133133 return 1
134134 except Exception as e :
135- print (f"❌ Error: { e } " )
135+ print (f" Error: { e } " )
136136 return 1
137137
138138
0 commit comments