|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +// Code generated by Microsoft (R) AutoRest Code Generator. |
| 4 | + |
| 5 | +package com.azure.resourcemanager.compute.fluent.models; |
| 6 | + |
| 7 | +import com.azure.core.annotation.Fluent; |
| 8 | +import com.azure.core.annotation.JsonFlatten; |
| 9 | +import com.azure.core.management.Resource; |
| 10 | +import com.azure.core.util.logging.ClientLogger; |
| 11 | +import com.azure.resourcemanager.compute.models.CapacityReservationGroupInstanceView; |
| 12 | +import com.azure.resourcemanager.compute.models.SubResourceReadOnly; |
| 13 | +import com.fasterxml.jackson.annotation.JsonIgnore; |
| 14 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 15 | +import java.util.List; |
| 16 | +import java.util.Map; |
| 17 | + |
| 18 | +/** |
| 19 | + * Specifies information about the capacity reservation group that the capacity reservations should be assigned to. |
| 20 | + * <br><br> Currently, a capacity reservation can only be added to a capacity reservation group at creation |
| 21 | + * time. An existing capacity reservation cannot be added or moved to another capacity reservation group. |
| 22 | + */ |
| 23 | +@JsonFlatten |
| 24 | +@Fluent |
| 25 | +public class CapacityReservationGroupInner extends Resource { |
| 26 | + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupInner.class); |
| 27 | + |
| 28 | + /* |
| 29 | + * Availability Zones to use for this capacity reservation group. The zones |
| 30 | + * can be assigned only during creation. If not provided, the group |
| 31 | + * supports only regional resources in the region. If provided, enforces |
| 32 | + * each capacity reservation in the group to be in one of the zones. |
| 33 | + */ |
| 34 | + @JsonProperty(value = "zones") |
| 35 | + private List<String> zones; |
| 36 | + |
| 37 | + /* |
| 38 | + * A list of all capacity reservation resource ids that belong to capacity |
| 39 | + * reservation group. |
| 40 | + */ |
| 41 | + @JsonProperty(value = "properties.capacityReservations", access = JsonProperty.Access.WRITE_ONLY) |
| 42 | + private List<SubResourceReadOnly> capacityReservations; |
| 43 | + |
| 44 | + /* |
| 45 | + * A list of references to all virtual machines associated to the capacity |
| 46 | + * reservation group. |
| 47 | + */ |
| 48 | + @JsonProperty(value = "properties.virtualMachinesAssociated", access = JsonProperty.Access.WRITE_ONLY) |
| 49 | + private List<SubResourceReadOnly> virtualMachinesAssociated; |
| 50 | + |
| 51 | + /* |
| 52 | + * The capacity reservation group instance view which has the list of |
| 53 | + * instance views for all the capacity reservations that belong to the |
| 54 | + * capacity reservation group. |
| 55 | + */ |
| 56 | + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) |
| 57 | + private CapacityReservationGroupInstanceView instanceView; |
| 58 | + |
| 59 | + /** |
| 60 | + * Get the zones property: Availability Zones to use for this capacity reservation group. The zones can be assigned |
| 61 | + * only during creation. If not provided, the group supports only regional resources in the region. If provided, |
| 62 | + * enforces each capacity reservation in the group to be in one of the zones. |
| 63 | + * |
| 64 | + * @return the zones value. |
| 65 | + */ |
| 66 | + public List<String> zones() { |
| 67 | + return this.zones; |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Set the zones property: Availability Zones to use for this capacity reservation group. The zones can be assigned |
| 72 | + * only during creation. If not provided, the group supports only regional resources in the region. If provided, |
| 73 | + * enforces each capacity reservation in the group to be in one of the zones. |
| 74 | + * |
| 75 | + * @param zones the zones value to set. |
| 76 | + * @return the CapacityReservationGroupInner object itself. |
| 77 | + */ |
| 78 | + public CapacityReservationGroupInner withZones(List<String> zones) { |
| 79 | + this.zones = zones; |
| 80 | + return this; |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Get the capacityReservations property: A list of all capacity reservation resource ids that belong to capacity |
| 85 | + * reservation group. |
| 86 | + * |
| 87 | + * @return the capacityReservations value. |
| 88 | + */ |
| 89 | + public List<SubResourceReadOnly> capacityReservations() { |
| 90 | + return this.capacityReservations; |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * Get the virtualMachinesAssociated property: A list of references to all virtual machines associated to the |
| 95 | + * capacity reservation group. |
| 96 | + * |
| 97 | + * @return the virtualMachinesAssociated value. |
| 98 | + */ |
| 99 | + public List<SubResourceReadOnly> virtualMachinesAssociated() { |
| 100 | + return this.virtualMachinesAssociated; |
| 101 | + } |
| 102 | + |
| 103 | + /** |
| 104 | + * Get the instanceView property: The capacity reservation group instance view which has the list of instance views |
| 105 | + * for all the capacity reservations that belong to the capacity reservation group. |
| 106 | + * |
| 107 | + * @return the instanceView value. |
| 108 | + */ |
| 109 | + public CapacityReservationGroupInstanceView instanceView() { |
| 110 | + return this.instanceView; |
| 111 | + } |
| 112 | + |
| 113 | + /** {@inheritDoc} */ |
| 114 | + @Override |
| 115 | + public CapacityReservationGroupInner withLocation(String location) { |
| 116 | + super.withLocation(location); |
| 117 | + return this; |
| 118 | + } |
| 119 | + |
| 120 | + /** {@inheritDoc} */ |
| 121 | + @Override |
| 122 | + public CapacityReservationGroupInner withTags(Map<String, String> tags) { |
| 123 | + super.withTags(tags); |
| 124 | + return this; |
| 125 | + } |
| 126 | + |
| 127 | + /** |
| 128 | + * Validates the instance. |
| 129 | + * |
| 130 | + * @throws IllegalArgumentException thrown if the instance is not valid. |
| 131 | + */ |
| 132 | + public void validate() { |
| 133 | + if (capacityReservations() != null) { |
| 134 | + capacityReservations().forEach(e -> e.validate()); |
| 135 | + } |
| 136 | + if (virtualMachinesAssociated() != null) { |
| 137 | + virtualMachinesAssociated().forEach(e -> e.validate()); |
| 138 | + } |
| 139 | + if (instanceView() != null) { |
| 140 | + instanceView().validate(); |
| 141 | + } |
| 142 | + } |
| 143 | +} |
0 commit comments