Skip to content

Commit 2af7306

Browse files
Mei HsiehMei Hsieh
authored andcommitted
DEVDOCS-10532 Py Admin 1 cD markers
1 parent fbb17b8 commit 2af7306

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

app/admin/examples/eg001_create_a_new_user.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def get_permission_profiles(args):
4141
header_value=f"Bearer {access_token}"
4242
)
4343

44-
# Step 3 start
44+
#ds-snippet-start:Admin1Step3
4545
accounts_api = AccountsApi(api_client=api_client)
4646
profiles = accounts_api.list_permissions(account_id=account_id)
4747
profiles_list = profiles.to_dict()["permission_profiles"]
48-
# Step 3 end
48+
#ds-snippet-end:Admin1Step3
4949
return profiles_list
5050

5151
@staticmethod
@@ -62,12 +62,12 @@ def get_groups(args):
6262
header_value=f"Bearer {access_token}"
6363
)
6464

65-
# Step 4 start
65+
#ds-snippet-start:Admin1Step4
6666
groups_api = GroupsApi(api_client)
6767
groups = groups_api.list_groups(account_id=account_id)
6868
groups_dict = groups.to_dict()
6969
groups_list = groups_dict["groups"]
70-
# Step 4 end
70+
#ds-snippet-end:Admin1Step4
7171
return groups_list
7272

7373
@staticmethod
@@ -93,16 +93,16 @@ def worker(self, args):
9393
profile_name = profile["permission_profile_name"]
9494

9595
# Create the API client object
96-
# Step 2 start
96+
#ds-snippet-start:Admin1Step2
9797
api_client = create_admin_api_client(
9898
access_token=session["ds_access_token"]
9999
)
100100
# Create the user API request object
101101
user_api = UsersApi(api_client=api_client)
102-
# Step 2 end
102+
#ds-snippet-end:Admin1Step2
103103

104104
# Create a request body for the create_user method
105-
# Step 5 start
105+
#ds-snippet-start:Admin1Step5
106106
request_body = {
107107
"user_name": args["user_name"],
108108
"first_name": args['first_name'],
@@ -123,13 +123,13 @@ def worker(self, args):
123123
}
124124
]
125125
}
126-
# Step 5 end
126+
#ds-snippet-end:Admin1Step5
127127

128128
# Creates a user using a method from the user API
129-
# Step 6 start
129+
#ds-snippet-start:Admin1Step6
130130
response = user_api.create_user(
131131
args["organization_id"],
132132
request_body
133133
)
134-
# Step 6 end
134+
#ds-snippet-end:Admin1Step6
135135
return response

0 commit comments

Comments
 (0)