Merge pull request #2287 from bkovacki/add-instance-create-time-to-db-instance

Add InstanceCreateTime to DBInstance
This commit is contained in:
Steve Pulec 2019-07-08 19:43:07 -05:00 committed by GitHub
commit d758952d84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -70,6 +70,7 @@ class Database(BaseModel):
self.port = Database.default_port(self.engine) self.port = Database.default_port(self.engine)
self.db_instance_identifier = kwargs.get('db_instance_identifier') self.db_instance_identifier = kwargs.get('db_instance_identifier')
self.db_name = kwargs.get("db_name") self.db_name = kwargs.get("db_name")
self.instance_create_time = iso_8601_datetime_with_milliseconds(datetime.datetime.now())
self.publicly_accessible = kwargs.get("publicly_accessible") self.publicly_accessible = kwargs.get("publicly_accessible")
if self.publicly_accessible is None: if self.publicly_accessible is None:
self.publicly_accessible = True self.publicly_accessible = True
@ -148,6 +149,7 @@ class Database(BaseModel):
<VpcSecurityGroups/> <VpcSecurityGroups/>
<DBInstanceIdentifier>{{ database.db_instance_identifier }}</DBInstanceIdentifier> <DBInstanceIdentifier>{{ database.db_instance_identifier }}</DBInstanceIdentifier>
<DbiResourceId>{{ database.dbi_resource_id }}</DbiResourceId> <DbiResourceId>{{ database.dbi_resource_id }}</DbiResourceId>
<InstanceCreateTime>{{ database.instance_create_time }}</InstanceCreateTime>
<PreferredBackupWindow>03:50-04:20</PreferredBackupWindow> <PreferredBackupWindow>03:50-04:20</PreferredBackupWindow>
<PreferredMaintenanceWindow>wed:06:38-wed:07:08</PreferredMaintenanceWindow> <PreferredMaintenanceWindow>wed:06:38-wed:07:08</PreferredMaintenanceWindow>
<ReadReplicaDBInstanceIdentifiers> <ReadReplicaDBInstanceIdentifiers>
@ -373,7 +375,7 @@ class Database(BaseModel):
"Address": "{{ database.address }}", "Address": "{{ database.address }}",
"Port": "{{ database.port }}" "Port": "{{ database.port }}"
}, },
"InstanceCreateTime": null, "InstanceCreateTime": "{{ database.instance_create_time }}",
"Iops": null, "Iops": null,
"ReadReplicaDBInstanceIdentifiers": [{%- for replica in database.replicas -%} "ReadReplicaDBInstanceIdentifiers": [{%- for replica in database.replicas -%}
{%- if not loop.first -%},{%- endif -%} {%- if not loop.first -%},{%- endif -%}

View File

@ -34,6 +34,7 @@ def test_create_database():
db_instance['IAMDatabaseAuthenticationEnabled'].should.equal(False) db_instance['IAMDatabaseAuthenticationEnabled'].should.equal(False)
db_instance['DbiResourceId'].should.contain("db-") db_instance['DbiResourceId'].should.contain("db-")
db_instance['CopyTagsToSnapshot'].should.equal(False) db_instance['CopyTagsToSnapshot'].should.equal(False)
db_instance['InstanceCreateTime'].should.be.a("datetime.datetime")
@mock_rds2 @mock_rds2