How to use resume_cluster method in localstack

Best Python code snippet using localstack_python

outputs.py

Source:outputs.py Github

copy

Full Screen

...255 """256 return pulumi.get(self, "resize_cluster")257 @property258 @pulumi.getter(name="resumeCluster")259 def resume_cluster(self) -> Optional['outputs.ScheduledActionTargetActionResumeCluster']:260 """261 An action that runs a `ResumeCluster` API operation. Documented below.262 """263 return pulumi.get(self, "resume_cluster")264@pulumi.output_type265class ScheduledActionTargetActionPauseCluster(dict):266 @staticmethod267 def __key_warning(key: str):268 suggest = None269 if key == "clusterIdentifier":270 suggest = "cluster_identifier"271 if suggest:272 pulumi.log.warn(f"Key '{key}' not found in ScheduledActionTargetActionPauseCluster. Access the value via the '{suggest}' property getter instead.")273 def __getitem__(self, key: str) -> Any:...

Full Screen

Full Screen

_inputs.py

Source:_inputs.py Github

copy

Full Screen

...227 def resize_cluster(self, value: Optional[pulumi.Input['ScheduledActionTargetActionResizeClusterArgs']]):228 pulumi.set(self, "resize_cluster", value)229 @property230 @pulumi.getter(name="resumeCluster")231 def resume_cluster(self) -> Optional[pulumi.Input['ScheduledActionTargetActionResumeClusterArgs']]:232 """233 An action that runs a `ResumeCluster` API operation. Documented below.234 """235 return pulumi.get(self, "resume_cluster")236 @resume_cluster.setter237 def resume_cluster(self, value: Optional[pulumi.Input['ScheduledActionTargetActionResumeClusterArgs']]):238 pulumi.set(self, "resume_cluster", value)239@pulumi.input_type240class ScheduledActionTargetActionPauseClusterArgs:241 def __init__(__self__, *,242 cluster_identifier: pulumi.Input[str]):243 """244 :param pulumi.Input[str] cluster_identifier: The identifier of the cluster to be resumed.245 """246 pulumi.set(__self__, "cluster_identifier", cluster_identifier)247 @property248 @pulumi.getter(name="clusterIdentifier")249 def cluster_identifier(self) -> pulumi.Input[str]:250 """251 The identifier of the cluster to be resumed....

Full Screen

Full Screen

bearnuatnixcluster.py

Source:bearnuatnixcluster.py Github

copy

Full Screen

1#!/usr/bin/env python32import codecs3import hashlib4import hmac5import logging6import os7import sys8import time9from pathlib import Path10import click11import requests12from dotenv import load_dotenv13from clusternutanix import nc2_cluster_status14from clusternutanixvm import pcvm_status15logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)16@click.command()17@click.option("--bear", default="", help="resume_cluster,hibernate")18def nc2_bear_status(bear):19 """To wake up the "bear" cluster or put the "bear" cluster to sleep this will also toggle the prism central vm to be power on or off"""20 ncs = nc2_cluster_status()21 # load the script configuration22 env_path_env = Path(".") / ".env"23 load_dotenv(dotenv_path=env_path_env)24 CLIENT_ID = os.getenv("CLIENT_ID")25 CLIENT_SECRET = os.getenv("CLIENT_SECRET")26 CLUSTER_ID = os.getenv("CLUSTER_ID")27 DOMAIN = os.getenv("DOMAIN")28 OUTPUT = os.getenv("OUTPUT")29 # load the script configuration30 env_path_nc2 = Path(OUTPUT) / "NC2clusterinfo.txt"31 load_dotenv(dotenv_path=env_path_nc2)32 # PE_IP = os.getenv("PE_IP")33 # AHV = os.getenv("AHV")34 # CVM = os.getenv("CVM")35 VER = os.getenv("VER")36 if VER >= "6.0.1.1":37 # Create signature38 timestamp = int(time.time())39 to_sign = "%s%s" % (timestamp, CLIENT_ID)40 signature = hmac.new(41 codecs.encode(CLIENT_SECRET),42 msg=codecs.encode(to_sign),43 digestmod=hashlib.sha256,44 ).hexdigest()45 # Prepare http request headers46 headers = {47 "X-Frame-ClientId": CLIENT_ID,48 "X-Frame-Timestamp": str(timestamp),49 "X-Frame-Signature": signature,50 }51 logging.info(headers)52 # https://docs.frame.nutanix.com/frame-apis/admin-api/admin-api.html53 # https://cpanel-backend-prod.frame.nutanix.com/api/v1/docs/clusters/index.html#/54 if bear == "resume_cluster":55 # query status of cluster56 if ncs == "hibernated":57 hibernate_req = requests.post(58 DOMAIN + "/v1/clusters/" + CLUSTER_ID + "/" + bear, headers=headers59 )60 logging.info(hibernate_req)61 # logging.info(hibernate_req.json())62 while (63 (ncs == "hibernated")64 or (ncs == "starting_nodes")65 or (ncs == "starting_services")66 or (ncs == "resuming")67 or (ncs == "starting")68 ):69 print("***" + ncs + "***")70 time.sleep(60)71 ncs = nc2_cluster_status()72 else:73 while ncs == "resume_failed":74 print("***BAD " + ncs + " BAD*** TAKING COUNTER MEASURES!!!!")75 time.sleep(600)76 ncs = nc2_cluster_status()77 """The code area below is in development"""78 # ~/cluster/bin$ python resume_hibernate_resume --workflow=resume79 # dir = os.getcwd()80 # print(dir)81 # ping to see if cluster IP is up it should come up after the cluster is online82 # cmd = ['ping', '-c2', '-W 5', PE_IP ]83 #84 #85 # cmd = ['ssh', '-i /home/jimb0/nutanix-NC2-/development-sts.pem', 'ec2-user@3.129.209.238', 'allssh genesis restart;','allssh genesis stop prism;','cluster start']86 # cmd = ["ssh -i /home/jimb0/nutanix-NC2-/development-sts.pem ec2-user@3.129.209.238 'allssh genesis restart; allssh genesis stop prism; cluster start'"]87 # cmd = ["ssh -i /home/jimb0/nutanix-NC2-/development-sts.pem ec2-user@3.129.209.238 'cm.sh'"]88 # response = subprocess.Popen("ssh -i /home/jimb0/nutanix-NC2-/development-sts.pem {user}@{host} {cmd}".format(user='ec2-user', host='3.129.209.238', cmd='allssh genesis restart; allssh genesis stop prism; cluster start'), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()89 # stdout, stderr = response.communicate()90 # print(response)91 # print(response.communicate())92 # print(cmd)93 # done = False94 # time.sleep(10)95 # timeout = 10 # default time out after 1000 times, set to -1 to disable timeout96 # logging.info("Waiting for cluster IP to come on-line.")97 # while not done and timeout:98 # response = subprocess.Popen(cmd, stdout=subprocess.PIPE)99 # stdout, stderr = response.communicate()100 # if response.returncode == 0:101 # print("Server up!")102 # done = True103 # else:104 # sys.stdout.write('.')105 # timeout -= 1106 # if not done:107 # logging.info("\nCluster failed to respond")108 """'Code above is in active development"""109 while (110 (ncs == "hibernated")111 or (ncs == "starting_nodes")112 or (ncs == "starting_services")113 or (ncs == "resuming")114 or (ncs == "starting")115 ):116 print("***" + ncs + "***")117 time.sleep(60)118 ncs = nc2_cluster_status()119 pcvm_status(TRANSITION_PAYLOAD="ON")120 elif bear == "hibernate":121 # query status of cluster122 pcvm_status(TRANSITION_PAYLOAD="ACPI_SHUTDOWN")123 if ncs == "running":124 hibernate_req = requests.post(125 DOMAIN + "/v1/clusters/" + CLUSTER_ID + "/" + bear, headers=headers126 )127 logging.debug(hibernate_req)128 # logging.info(hibernate_req.json())129 while (130 (ncs == "running")131 or (ncs == "hibernating")132 or (ncs == "stopping_nodes")133 or (ncs == "stopping_services")134 or (ncs == "resuming")135 ):136 print("***" + ncs + "***")137 time.sleep(60)138 ncs = nc2_cluster_status()139 else:140 print("no valid parm set (resume_cluster,hibernate)")141if __name__ == "__main__":...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful