Skip to content

Commit 158906d

Browse files
committed
Removes START / END blocks for snippets.
1 parent cfa07e8 commit 158906d

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

iot/api-client/manager/manager.py

-16
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def get_client(service_account_json, api_key):
6464
"""Returns an authorized API client by discovering the IoT API using the
6565
provided API key and creating a service object using the service account
6666
credentials JSON."""
67-
# [START authorize]
6867
api_scopes = ['https://www.googleapis.com/auth/cloud-platform']
6968
api_version = 'v1beta1'
7069
discovery_api = 'https://cloudiot.googleapis.com/$discovery/rest'
@@ -82,15 +81,13 @@ def get_client(service_account_json, api_key):
8281
api_version,
8382
discoveryServiceUrl=discovery_url,
8483
credentials=scoped_credentials)
85-
# [END authorize]
8684

8785

8886
def create_rs256_device(
8987
service_account_json, api_key, project_id, cloud_region, registry_id,
9088
device_id, certificate_file):
9189
"""Create a new device with the given id, using RS256 for
9290
authentication."""
93-
# [START create_rs256_device]
9491
registry_name = 'projects/{}/locations/{}/registries/{}'.format(
9592
project_id, cloud_region, registry_id)
9693

@@ -111,15 +108,13 @@ def create_rs256_device(
111108

112109
devices = client.projects().locations().registries().devices()
113110
return devices.create(parent=registry_name, body=device_template).execute()
114-
# [END create_rs256_device]
115111

116112

117113
def create_es256_device(
118114
service_account_json, api_key, project_id, cloud_region, registry_id,
119115
device_id, public_key_file):
120116
"""Create a new device with the given id, using ES256 for
121117
authentication."""
122-
# [START create_rs256_device]
123118
registry_name = 'projects/{}/locations/{}/registries/{}'.format(
124119
project_id, cloud_region, registry_id)
125120

@@ -140,14 +135,12 @@ def create_es256_device(
140135

141136
devices = client.projects().locations().registries().devices()
142137
return devices.create(parent=registry_name, body=device_template).execute()
143-
# [END create_rs256_device]
144138

145139

146140
def create_unauth_device(
147141
service_account_json, api_key, project_id, cloud_region, registry_id,
148142
device_id):
149143
"""Create a new device without authentication."""
150-
# [START create_noauth_device]
151144
registry_name = 'projects/{}/locations/{}/registries/{}'.format(
152145
project_id, cloud_region, registry_id)
153146

@@ -158,14 +151,12 @@ def create_unauth_device(
158151

159152
devices = client.projects().locations().registries().devices()
160153
return devices.create(parent=registry_name, body=device_template).execute()
161-
# [END create_noauth_device]
162154

163155

164156
def delete_device(
165157
service_account_json, api_key, project_id, cloud_region, registry_id,
166158
device_id):
167159
"""Delete the device with the given id."""
168-
# [START delete_device]
169160
print('Delete device')
170161
client = get_client(service_account_json, api_key)
171162
registry_name = 'projects/{}/locations/{}/registries/{}'.format(
@@ -175,28 +166,24 @@ def delete_device(
175166

176167
devices = client.projects().locations().registries().devices()
177168
return devices.delete(name=device_name).execute()
178-
# [END delete_device]
179169

180170

181171
def delete_registry(
182172
service_account_json, api_key, project_id, cloud_region, registry_id):
183173
"""Deletes the specified registry."""
184-
# [START delete_registry]
185174
print('Delete registry')
186175
client = get_client(service_account_json, api_key)
187176
registry_name = 'projects/{}/locations/{}/registries/{}'.format(
188177
project_id, cloud_region, registry_id)
189178

190179
registries = client.projects().locations().registries()
191180
return registries.delete(name=registry_name).execute()
192-
# [END delete_registry]
193181

194182

195183
def get_device(
196184
service_account_json, api_key, project_id, cloud_region, registry_id,
197185
device_id):
198186
"""Retrieve the device with the given id."""
199-
# [START delete_device]
200187
print('Getting device')
201188
client = get_client(service_account_json, api_key)
202189
registry_name = 'projects/{}/locations/{}/registries/{}'.format(
@@ -223,13 +210,11 @@ def get_device(
223210
'cloudUpdateTime')))
224211

225212
return device
226-
# [END delete_device]
227213

228214

229215
def list_devices(
230216
service_account_json, api_key, project_id, cloud_region, registry_id):
231217
"""List all devices in the registry."""
232-
# [START list_devices]
233218
print('Listing devices')
234219
registry_path = 'projects/{}/locations/{}/registries/{}'.format(
235220
project_id, cloud_region, registry_id)
@@ -243,7 +228,6 @@ def list_devices(
243228
device.get('id')))
244229

245230
return devices
246-
# [list_devices]
247231

248232

249233
def open_registry(

0 commit comments

Comments
 (0)