Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
logging.basicConfig(level=logging.INFO)
arguments = parse_args()
interceptor = yandexcloud.RetryInterceptor(max_retry_count=5, retriable_codes=[grpc.StatusCode.UNAVAILABLE])
if arguments.token:
sdk = yandexcloud.SDK(interceptor=interceptor, token=arguments.token)
else:
with open(arguments.sa_json_path) as infile:
sdk = yandexcloud.SDK(interceptor=interceptor, service_account_key=json.load(infile))
fill_missing_arguments(sdk, arguments)
instance_id = None
try:
operation = create_instance(sdk, arguments.folder_id, arguments.zone, arguments.name, arguments.subnet_id)
operation_result = sdk.wait_operation_and_get_result(
operation,
response_type=Instance,
meta_type=CreateInstanceMetadata,
)
instance_id = operation_result.response.id
def main():
logging.basicConfig(level=logging.INFO)
arguments = parse_args()
interceptor = yandexcloud.RetryInterceptor(max_retry_count=5, retriable_codes=[grpc.StatusCode.UNAVAILABLE])
if arguments.token:
sdk = yandexcloud.SDK(interceptor=interceptor, token=arguments.token)
else:
with open(arguments.sa_json_path) as infile:
sdk = yandexcloud.SDK(interceptor=interceptor, service_account_key=json.load(infile))
fill_missing_arguments(sdk, arguments)
instance_id = None
try:
operation = create_instance(sdk, arguments.folder_id, arguments.zone, arguments.name, arguments.subnet_id)
operation_result = sdk.wait_operation_and_get_result(
operation,
response_type=Instance,
meta_type=CreateInstanceMetadata,
)
instance_id = operation_result.response.id
finally:
if instance_id:
def main():
flags = parse_cmd()
sdk = yandexcloud.SDK(token=flags.token)
fill_missing_flags(sdk, flags)
req = create_cluster_request(flags)
cluster = None
try:
cluster = create_cluster(sdk, req)
change_cluster_description(sdk, cluster)
add_cluster_host(sdk, cluster, flags)
finally:
if cluster is not None:
delete_cluster(sdk, cluster)
def main():
arguments = parse_cmd()
sdk = yandexcloud.SDK(token=arguments.token)
fill_missing_flags(sdk, arguments)
resources = common_pb.Resources(
resource_preset_id='s2.micro',
disk_size=15 * (1024 ** 3),
disk_type_id='network-ssd',
)
req = create_cluster_request(arguments, resources=resources)
cluster_id = None
try:
cluster = create_cluster(sdk, req)
cluster_id = cluster.id
change_cluster_description(sdk, cluster_id)
add_subcluster(sdk, cluster_id, arguments, resources=resources)
def main():
flags = parse_cmd()
sdk = yandexcloud.SDK(token=flags.token)
fill_missing_flags(sdk, flags)
req = create_cluster_request(flags)
cluster = None
try:
cluster = create_cluster(sdk, req)
change_cluster_description(sdk, cluster)
add_cluster_host(sdk, cluster, flags)
finally:
if cluster is not None:
delete_cluster(sdk, cluster)
def main():
flags = parse_cmd()
sdk = yandexcloud.SDK(token=flags.token)
fill_missing_flags(sdk, flags)
req = create_cluster_request(flags)
cluster = None
try:
cluster = create_cluster(sdk, req)
change_cluster_description(sdk, cluster)
add_cluster_host(sdk, cluster, flags)
finally:
if cluster is not None:
delete_cluster(sdk, cluster)