|
| 1 | +.. |
| 2 | + Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 3 | + not use this file except in compliance with the License. You may obtain |
| 4 | + a copy of the License at |
| 5 | +
|
| 6 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + |
| 8 | + Unless required by applicable law or agreed to in writing, software |
| 9 | + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 10 | + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 11 | + License for the specific language governing permissions and limitations |
| 12 | + under the License. |
| 13 | + |
| 14 | +================= |
| 15 | +Managing Profiles |
| 16 | +================= |
| 17 | + |
| 18 | +A **profile type** can be treated as the meta-type of a `Profile` object. A |
| 19 | +registry of profile types is built when the Cluster service starts. When |
| 20 | +creating a `Profile` object, you will indicate the profile type used in its |
| 21 | +`spec` property. |
| 22 | + |
| 23 | + |
| 24 | +List Profiles |
| 25 | +~~~~~~~~~~~~~ |
| 26 | + |
| 27 | +To examine the list of profiles: |
| 28 | + |
| 29 | +.. literalinclude:: ../../examples/cluster/profile.py |
| 30 | + :pyobject: list_profiles |
| 31 | + |
| 32 | +When listing profiles, you can specify the sorting option using the ``sort`` |
| 33 | +parameter and you can do pagination using the ``limit`` and ``marker`` |
| 34 | +parameters. |
| 35 | + |
| 36 | +Full example: `manage profile`_ |
| 37 | + |
| 38 | + |
| 39 | +Create Profile |
| 40 | +~~~~~~~~~~~~~~ |
| 41 | + |
| 42 | +When creating a profile, you will provide a dictionary with keys and values |
| 43 | +specified according to the profile type referenced. |
| 44 | + |
| 45 | +.. literalinclude:: ../../examples/cluster/profile.py |
| 46 | + :pyobject: create_profile |
| 47 | + |
| 48 | +Optionally, you can specify a ``metadata`` keyword argument that contains some |
| 49 | +key-value pairs to be associated with the profile. |
| 50 | + |
| 51 | +Full example: `manage profile`_ |
| 52 | + |
| 53 | + |
| 54 | +Find Profile |
| 55 | +~~~~~~~~~~~~ |
| 56 | + |
| 57 | +To find a profile based on its name or ID: |
| 58 | + |
| 59 | +.. literalinclude:: ../../examples/cluster/profile.py |
| 60 | + :pyobject: find_profile |
| 61 | + |
| 62 | +The Cluster service doesn't allow updating the ``spec`` of a profile. The only |
| 63 | +way to achieve that is to create a new profile. |
| 64 | + |
| 65 | +Full example: `manage profile`_ |
| 66 | + |
| 67 | + |
| 68 | +Get Profile |
| 69 | +~~~~~~~~~~~~ |
| 70 | + |
| 71 | +To get a profile based on its name or ID: |
| 72 | + |
| 73 | +.. literalinclude:: ../../examples/cluster/profile.py |
| 74 | + :pyobject: get_profile |
| 75 | + |
| 76 | +Full example: `manage profile`_ |
| 77 | + |
| 78 | + |
| 79 | +Update Profile |
| 80 | +~~~~~~~~~~~~~~ |
| 81 | + |
| 82 | +After a profile is created, most of its properties are immutable. Still, you |
| 83 | +can update a profile's ``name`` and/or ``metadata``. |
| 84 | + |
| 85 | +.. literalinclude:: ../../examples/cluster/profile.py |
| 86 | + :pyobject: update_profile |
| 87 | + |
| 88 | +The Cluster service doesn't allow updating the ``spec`` of a profile. The only |
| 89 | +way to achieve that is to create a new profile. |
| 90 | + |
| 91 | +Full example: `manage profile`_ |
| 92 | + |
| 93 | + |
| 94 | +Delete Profile |
| 95 | +~~~~~~~~~~~~~~ |
| 96 | + |
| 97 | +A profile can be deleted after creation, provided that it is not referenced |
| 98 | +by any active clusters or nodes. If you attempt to delete a profile that is |
| 99 | +still in use, you will get an error message. |
| 100 | + |
| 101 | +.. literalinclude:: ../../examples/cluster/profile.py |
| 102 | + :pyobject: delete_profile |
| 103 | + |
| 104 | + |
| 105 | +.. _manage profile: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/cluster/profile.py |
0 commit comments