Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Create basic_launch_settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
timhll-amz authored Jun 13, 2024
1 parent d8d25b7 commit 8e7d128
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions DRS/DRS-Settings-Tool/classes/basic_launch_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import boto3
from utils.obj_to_dict import obj_to_dict
from utils.delete_none import delete_none
from utils.clients import drs_client
drs = drs_client()

class BasicLaunchSettings(object):
def __init__(self, copyPrivateIp=None, copyTags=None, ec2LaunchTemplateID=None, launchDisposition=None, launchIntoInstanceProperties=None, licensing=None, sourceServerID=None, targetInstanceTypeRightSizingMethod=None, **kwargs):
self.copyPrivateIp = copyPrivateIp
self.copyTags = copyTags
self.ec2LaunchTemplateID = ec2LaunchTemplateID
self.launchDisposition = launchDisposition
self.launchIntoInstanceProperties = launchIntoInstanceProperties
self.licensing = licensing
self.sourceServerID = sourceServerID
self.targetInstanceTypeRightSizingMethod = targetInstanceTypeRightSizingMethod

def update_basic_launch_settings(self, object):
launch_settings_dict = obj_to_dict(object)
launch_settings = delete_none(launch_settings_dict)
del launch_settings['ec2LaunchTemplateID']
drs.client.update_launch_configuration(**launch_settings)

def __eq__(self, other):
return (self.copyPrivateIp, self.copyTags, self.ec2LaunchTemplateID, self.launchDisposition, self.launchIntoInstanceProperties, self.licensing.__dict__, self.sourceServerID, self.targetInstanceTypeRightSizingMethod) == (other.copyPrivateIp, other.copyTags, other.ec2LaunchTemplateID, other.launchDisposition, other.launchIntoInstanceProperties, other.licensing.__dict__, other.sourceServerID, other.targetInstanceTypeRightSizingMethod)

def __ne__(self, other):
return (self.copyPrivateIp, self.copyTags, self.ec2LaunchTemplateID, self.launchDisposition, self.launchIntoInstanceProperties, self.licensing.__dict__, self.sourceServerID, self.targetInstanceTypeRightSizingMethod) != (other.copyPrivateIp, other.copyTags, other.ec2LaunchTemplateID, other.launchDisposition, other.launchIntoInstanceProperties, other.licensing.__dict__, other.sourceServerID, other.targetInstanceTypeRightSizingMethod)




class ByolSetting(object):
def __init__(self, osByol=None, **kwargs):
self.osByol = osByol

class LaunchIntoInstance(object):
def __init__(self, launchIntoEC2InstanceID=None):
self.launchIntoEC2InstanceID = launchIntoEC2InstanceID

0 comments on commit 8e7d128

Please sign in to comment.