Struggling to understand how to structure Classes and methods /u/redrabbit1984 Python Education

Hi,

I’ve been using Python for years but for simple scripts and IT related things. I’m starting a new project to do with AWS.

Data:

AWS has Regions (us-east-1, eu-west-3, etc) Regions have EC-2 instances

So my thought is:

Class Instance: xxx Class Region: xxx

My question is, let’s say the script starts and I want to output all the instances. How would that work?

Would Region have a method called: def get_instances(self.region_id) in which it would get all the regions, or would it go to Instance?

Would be great to get an idea of how you’d structure this.

The script will:

List all regions List all instances in the regions and their state Allow the user to stop the instance or start it

And other things after that

Thanks

submitted by /u/redrabbit1984
[link] [comments]

​r/learnpython Hi, I’ve been using Python for years but for simple scripts and IT related things. I’m starting a new project to do with AWS. ​ Data: AWS has Regions (us-east-1, eu-west-3, etc) Regions have EC-2 instances ​ So my thought is: Class Instance: xxx Class Region: xxx My question is, let’s say the script starts and I want to output all the instances. How would that work? Would Region have a method called: def get_instances(self.region_id) in which it would get all the regions, or would it go to Instance? Would be great to get an idea of how you’d structure this. The script will: List all regions List all instances in the regions and their state Allow the user to stop the instance or start it And other things after that Thanks ​ submitted by /u/redrabbit1984 [link] [comments] 

Hi,

I’ve been using Python for years but for simple scripts and IT related things. I’m starting a new project to do with AWS.

Data:

AWS has Regions (us-east-1, eu-west-3, etc) Regions have EC-2 instances

So my thought is:

Class Instance: xxx Class Region: xxx

My question is, let’s say the script starts and I want to output all the instances. How would that work?

Would Region have a method called: def get_instances(self.region_id) in which it would get all the regions, or would it go to Instance?

Would be great to get an idea of how you’d structure this.

The script will:

List all regions List all instances in the regions and their state Allow the user to stop the instance or start it

And other things after that

Thanks

submitted by /u/redrabbit1984
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *