Revision 52b2b3bd

b/docs/developers/clients-api.rst
252 252
    AUTHENTICATION_URL = 'https://accounts.example.com/identity/v2.0'
253 253
    TOKEN = 'replace this with your token'
254 254

  
255
    user = AstakosClient(AUTHENTICATION_URL, TOKEN)
255
    astakos = AstakosClient(AUTHENTICATION_URL, TOKEN)
256 256

  
257
    cyclades_endpoints = user.get_service_endpoints('compute')
258
    CYCLADES_URL = cyclades_endpoints['publicURL']
257
    CYCLADES_URL = astakos.get_service_endpoints('compute')['publicURL']
259 258
    cyclades = CycladesClient(CYCLADES_URL, TOKEN)
260 259

  
261 260
    #  (name, flavor-id, image-id)
......
282 281
    AUTHENTICATION_URL = 'https://accounts.example.com/identity/v2.0'
283 282
    TOKEN = 'replace this with your token'
284 283

  
285
    user = AstakosClient(AUTHENTICATION_URL, TOKEN)
284
    astakos = AstakosClient(AUTHENTICATION_URL, TOKEN)
286 285

  
287
    cyclades_endpoints = user.get_service_endpoints('compute')
288
    CYCLADES_URL = cyclades_endpoints['publicURL']
286
    CYCLADES_URL = astakos.get_service_endpoints('compute')['publicURL']
289 287
    cyclades = CycladesClient(CYCLADES_URL, TOKEN)
290 288

  
291 289
    for i in range(4):
......
327 325
        except ClientError:
328 326
            print 'Failed to register image %s' % IMAGE_PATH
329 327

  
328
..note::
329

  
330
    In plankton.register, the `location` argument can be either a triplet, as
331
    shown above, or a qualified URL of the form
332
    pithos://USER_UUID/IMAGE_CONTAINER/IMAGE_PATH
333
    which is the format used by the image API.
334

  
330 335
Two servers and a private network
331 336
'''''''''''''''''''''''''''''''''
332 337

  
......
340 345
    AUTHENTICATION_URL = 'https://accounts.example.com/identity/v2.0'
341 346
    TOKEN = 'replace this with your token'
342 347

  
343
    user = AstakosClient(AUTHENTICATION_URL, TOKEN)
344

  
345
    network_endpoints = user.get_service_endpoints('network')
346
    NETWORK_URL = network_endpoints['publicURL']
348
    astakos = AstakosClient(AUTHENTICATION_URL, TOKEN)
347 349

  
350
    NETWORK_URL = astakos.get_service_endpoints('network')['publicURL']
348 351
    network = CycladesNetworkClient(NETWORK_URL, TOKEN)
352

  
349 353
    net = network.create_network(type='MAC_FILTERED', name='My private network')
350 354

  
351
    cyclades_endpoints = user.get_service_endpoints('compute')
352
    CYCLADES_URL = cyclades_endpoints['publicURL']
355
    CYCLADES_URL = astakos.get_service_endpoints('compute')['publicURL']
356
    cyclades = CycladesClient(CYCLADES_URL, TOKEN)
353 357

  
354 358
    FLAVOR_ID = 'put your flavor id here'
355 359
    IMAGE_ID = 'put your image id here'
356
    cyclades = CycladesClient(CYCLADES_URL, TOKEN)
357 360

  
358 361
    srv1 = cyclades.create_server(
359 362
        'server 1', FLAVOR_ID, IMAGE_ID,
......
363 366
        networks=[{'uuid': net['id']}])
364 367

  
365 368
    srv_state1 = cyclades.wait_server(srv1['id'])
366
    assert srv_state1 in ('ACTIVE'), 'Server 1 built failure'
369
    assert srv_state1 in ('ACTIVE', ), 'Server 1 built failure'
367 370

  
368 371
    srv_state2 = cyclades.wait_server(srv2['id'])
369
    assert srv_state2 in ('ACTIVE'), 'Server 2 built failure'
372
    assert srv_state2 in ('ACTIVE', ), 'Server 2 built failure'

Also available in: Unified diff