This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8d25b7
commit 8e7d128
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |