This commit is contained in:
Edward Samuel Pasaribu 2025-02-07 05:35:24 +00:00 committed by GitHub
commit ab19223c36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 211 additions and 0 deletions

View file

@ -388,6 +388,35 @@ options:
field to "{{ name-of-resource }}"'
required: false
type: dict
reservation_affinity:
description:
- Specifies the reservations that this instance can consume from.
required: false
type: dict
suboptions:
consume_reservation_type:
description:
- 'Specifies the type of reservation from which this instance can consume
resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION.'
- 'Some valid choices include: "ANY_RESERVATION", "SPECIFIC_RESERVATION",
"NO_RESERVATION"'
required: false
type: str
key:
description:
- Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION
by name, specify googleapis.com/reservation-name as the key and specify
the name of your reservation as its value.
required: false
type: str
values:
description:
- Corresponds to the label values of a reservation resource. This can be either
a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name"
to target a shared reservation in the same zone but in a different project.
elements: str
required: false
type: list
scheduling:
description:
- Sets the scheduling options for this instance.
@ -962,6 +991,32 @@ networkInterfaces:
If the network is in custom subnet mode, then this field should be specified.
returned: success
type: dict
reservationAffinity:
description:
- Specifies the reservations that this instance can consume from.
returned: success
type: complex
contains:
consumeReservationType:
description:
- 'Specifies the type of reservation from which this instance can consume resources:
ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION.'
returned: success
type: str
key:
description:
- Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION
by name, specify googleapis.com/reservation-name as the key and specify the
name of your reservation as its value.
returned: success
type: str
values:
description:
- Corresponds to the label values of a reservation resource. This can be either
a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name"
to target a shared reservation in the same zone but in a different project.
returned: success
type: list
scheduling:
description:
- Sets the scheduling options for this instance.
@ -1168,6 +1223,9 @@ def main():
subnetwork=dict(type='dict'),
),
),
reservation_affinity=dict(
type='dict', options=dict(consume_reservation_type=dict(type='str'), key=dict(type='str'), values=dict(type='list', elements='str'))
),
scheduling=dict(
type='dict', options=dict(automatic_restart=dict(type='bool'), on_host_maintenance=dict(type='str'), preemptible=dict(type='bool'))
),
@ -1274,6 +1332,7 @@ def resource_to_request(module):
u'minCpuPlatform': module.params.get('min_cpu_platform'),
u'name': module.params.get('name'),
u'networkInterfaces': InstanceNetworkinterfacesArray(module.params.get('network_interfaces', []), module).to_request(),
u'reservationAffinity': InstanceReservationaffinity(module.params.get('reservation_affinity', {}), module).to_request(),
u'scheduling': InstanceScheduling(module.params.get('scheduling', {}), module).to_request(),
u'serviceAccounts': InstanceServiceaccountsArray(module.params.get('service_accounts', []), module).to_request(),
u'shieldedInstanceConfig': InstanceShieldedinstanceconfig(module.params.get('shielded_instance_config', {}), module).to_request(),
@ -1364,6 +1423,7 @@ def response_to_hash(module, response):
u'minCpuPlatform': response.get(u'minCpuPlatform'),
u'name': response.get(u'name'),
u'networkInterfaces': InstanceNetworkinterfacesArray(response.get(u'networkInterfaces', []), module).from_response(),
u'reservationAffinity': InstanceReservationaffinity(response.get(u'reservationAffinity', {}), module).from_response(),
u'scheduling': InstanceScheduling(response.get(u'scheduling', {}), module).from_response(),
u'serviceAccounts': InstanceServiceaccountsArray(response.get(u'serviceAccounts', []), module).from_response(),
u'shieldedInstanceConfig': InstanceShieldedinstanceconfig(response.get(u'shieldedInstanceConfig', {}), module).from_response(),
@ -1792,6 +1852,25 @@ class InstanceAliasiprangesArray(object):
return remove_nones_from_dict({u'ipCidrRange': item.get(u'ipCidrRange'), u'subnetworkRangeName': item.get(u'subnetworkRangeName')})
class InstanceReservationaffinity(object):
def __init__(self, request, module):
self.module = module
if request:
self.request = request
else:
self.request = {}
def to_request(self):
return remove_nones_from_dict(
{u'consumeReservationType': self.request.get('consume_reservation_type'), u'key': self.request.get('key'), u'values': self.request.get('values')}
)
def from_response(self):
return remove_nones_from_dict(
{u'consumeReservationType': self.request.get(u'consumeReservationType'), u'key': self.request.get(u'key'), u'values': self.request.get(u'values')}
)
class InstanceScheduling(object):
def __init__(self, request, module):
self.module = module

View file

@ -478,6 +478,32 @@ resources:
If the network is in custom subnet mode, then this field should be specified.
returned: success
type: dict
reservationAffinity:
description:
- Specifies the reservations that this instance can consume from.
returned: success
type: complex
contains:
consumeReservationType:
description:
- 'Specifies the type of reservation from which this instance can consume
resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION.'
returned: success
type: str
key:
description:
- Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION
by name, specify googleapis.com/reservation-name as the key and specify
the name of your reservation as its value.
returned: success
type: str
values:
description:
- Corresponds to the label values of a reservation resource. This can be
either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name"
to target a shared reservation in the same zone but in a different project.
returned: success
type: list
scheduling:
description:
- Sets the scheduling options for this instance.

View file

@ -399,6 +399,35 @@ options:
and then set this subnetwork field to "{{ name-of-resource }}"'
required: false
type: dict
reservation_affinity:
description:
- Specifies the reservations that this instance can consume from.
required: false
type: dict
suboptions:
consume_reservation_type:
description:
- 'Specifies the type of reservation from which this instance can consume
resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION.'
- 'Some valid choices include: "ANY_RESERVATION", "SPECIFIC_RESERVATION",
"NO_RESERVATION"'
required: false
type: str
key:
description:
- Corresponds to the label key of a reservation resource. To target a
SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name
as the key and specify the name of your reservation as its value.
required: false
type: str
values:
description:
- Corresponds to the label values of a reservation resource. This can
be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name"
to target a shared reservation in the same zone but in a different project.
elements: str
required: false
type: list
scheduling:
description:
- Sets the scheduling options for this instance.
@ -906,6 +935,32 @@ properties:
If the network is in custom subnet mode, then this field should be specified.
returned: success
type: dict
reservationAffinity:
description:
- Specifies the reservations that this instance can consume from.
returned: success
type: complex
contains:
consumeReservationType:
description:
- 'Specifies the type of reservation from which this instance can consume
resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION.'
returned: success
type: str
key:
description:
- Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION
by name, specify googleapis.com/reservation-name as the key and specify
the name of your reservation as its value.
returned: success
type: str
values:
description:
- Corresponds to the label values of a reservation resource. This can be
either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name"
to target a shared reservation in the same zone but in a different project.
returned: success
type: list
scheduling:
description:
- Sets the scheduling options for this instance.
@ -1068,6 +1123,9 @@ def main():
subnetwork=dict(type='dict'),
),
),
reservation_affinity=dict(
type='dict', options=dict(consume_reservation_type=dict(type='str'), key=dict(type='str'), values=dict(type='list', elements='str'))
),
scheduling=dict(
type='dict', options=dict(automatic_restart=dict(type='bool'), on_host_maintenance=dict(type='str'), preemptible=dict(type='bool'))
),
@ -1326,6 +1384,7 @@ class InstanceTemplateProperties(object):
u'metadata': self.request.get('metadata'),
u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get('guest_accelerators', []), self.module).to_request(),
u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get('network_interfaces', []), self.module).to_request(),
u'reservationAffinity': InstanceTemplateReservationaffinity(self.request.get('reservation_affinity', {}), self.module).to_request(),
u'scheduling': InstanceTemplateScheduling(self.request.get('scheduling', {}), self.module).to_request(),
u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get('service_accounts', []), self.module).to_request(),
u'tags': InstanceTemplateTags(self.request.get('tags', {}), self.module).to_request(),
@ -1344,6 +1403,7 @@ class InstanceTemplateProperties(object):
u'metadata': self.request.get(u'metadata'),
u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get(u'guestAccelerators', []), self.module).from_response(),
u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get(u'networkInterfaces', []), self.module).from_response(),
u'reservationAffinity': InstanceTemplateReservationaffinity(self.request.get(u'reservationAffinity', {}), self.module).from_response(),
u'scheduling': InstanceTemplateScheduling(self.request.get(u'scheduling', {}), self.module).from_response(),
u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get(u'serviceAccounts', []), self.module).from_response(),
u'tags': InstanceTemplateTags(self.request.get(u'tags', {}), self.module).from_response(),
@ -1611,6 +1671,25 @@ class InstanceTemplateAliasiprangesArray(object):
return remove_nones_from_dict({u'ipCidrRange': item.get(u'ipCidrRange'), u'subnetworkRangeName': item.get(u'subnetworkRangeName')})
class InstanceTemplateReservationaffinity(object):
def __init__(self, request, module):
self.module = module
if request:
self.request = request
else:
self.request = {}
def to_request(self):
return remove_nones_from_dict(
{u'consumeReservationType': self.request.get('consume_reservation_type'), u'key': self.request.get('key'), u'values': self.request.get('values')}
)
def from_response(self):
return remove_nones_from_dict(
{u'consumeReservationType': self.request.get(u'consumeReservationType'), u'key': self.request.get(u'key'), u'values': self.request.get(u'values')}
)
class InstanceTemplateScheduling(object):
def __init__(self, request, module):
self.module = module

View file

@ -475,6 +475,33 @@ resources:
should be specified.
returned: success
type: dict
reservationAffinity:
description:
- Specifies the reservations that this instance can consume from.
returned: success
type: complex
contains:
consumeReservationType:
description:
- 'Specifies the type of reservation from which this instance can consume
resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION.'
returned: success
type: str
key:
description:
- Corresponds to the label key of a reservation resource. To target
a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name
as the key and specify the name of your reservation as its value.
returned: success
type: str
values:
description:
- Corresponds to the label values of a reservation resource. This can
be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name"
to target a shared reservation in the same zone but in a different
project.
returned: success
type: list
scheduling:
description:
- Sets the scheduling options for this instance.