コード例 #1
0
def resize_pool(client,
                pool_id,
                target_dedicated_nodes=None,
                target_low_priority_nodes=None,
                resize_timeout=None,
                node_deallocation_option=None,
                if_match=None,
                if_none_match=None,
                if_modified_since=None,
                if_unmodified_since=None,
                abort=False):
    if abort:
        stop_resize_option = PoolStopResizeOptions(
            if_match=if_match,
            if_none_match=if_none_match,
            if_modified_since=if_modified_since,
            if_unmodified_since=if_unmodified_since)
        return client.stop_resize(pool_id,
                                  pool_stop_resize_options=stop_resize_option)

    param = PoolResizeParameter(
        target_dedicated_nodes=target_dedicated_nodes,
        target_low_priority_nodes=target_low_priority_nodes,
        resize_timeout=resize_timeout,
        node_deallocation_option=node_deallocation_option)
    resize_option = PoolResizeOptions(if_match=if_match,
                                      if_none_match=if_none_match,
                                      if_modified_since=if_modified_since,
                                      if_unmodified_since=if_unmodified_since)
    return client.resize(pool_id, param, pool_resize_options=resize_option)
コード例 #2
0
 def action():
     if abort:
         stop_resize_option = PoolStopResizeOptions(if_match=if_match,
                                                    if_none_match=if_none_match,
                                                    if_modified_since=if_modified_since,
                                                    if_unmodified_since=if_unmodified_since)
         return client.stop_resize(pool_id, pool_stop_resize_options=stop_resize_option)
     else:
         param = PoolResizeParameter(target_dedicated,
                                     resize_timeout=resize_timeout,
                                     node_deallocation_option=node_deallocation_option)
         resize_option = PoolResizeOptions(if_match=if_match,
                                           if_none_match=if_none_match,
                                           if_modified_since=if_modified_since,
                                           if_unmodified_since=if_unmodified_since)
         return client.resize(pool_id, param, pool_resize_options=resize_option)