Class: Google::Apis::OsconfigV1beta::Assignment

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/osconfig_v1beta/classes.rb,
generated/google/apis/osconfig_v1beta/representations.rb,
generated/google/apis/osconfig_v1beta/representations.rb

Overview

An assignment represents the group or groups of VM instances that the policy applies to. If an assignment is empty, it applies to all VM instances. Otherwise, the targeted VM instances must meet all the criteria specified. So if both labels and zones are specified, the policy applies to VM instances with those labels and in those zones.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Assignment

Returns a new instance of Assignment.



151
152
153
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 151

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#group_labelsArray<Google::Apis::OsconfigV1beta::AssignmentGroupLabel>

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging". Corresponds to the JSON property groupLabels



119
120
121
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 119

def group_labels
  @group_labels
end

#instance_name_prefixesArray<String>

Targets VM instances whose name starts with one of these prefixes. Like labels, this is another way to group VM instances when targeting configs, for example prefix="prod-". Only supported for project-level policies. Corresponds to the JSON property instanceNamePrefixes

Returns:

  • (Array<String>)


126
127
128
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 126

def instance_name_prefixes
  @instance_name_prefixes
end

#instancesArray<String>

Targets any of the instances specified. Instances are specified by their URI in the form zones/[ZONE]/instances/[INSTANCE_NAME]. Instance targeting is uncommon and is supported to facilitate the management of changes by the instance or to target specific VM instances for development and testing. Only supported for project-level policies and must reference instances within this project. Corresponds to the JSON property instances

Returns:

  • (Array<String>)


136
137
138
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 136

def instances
  @instances
end

#os_typesArray<Google::Apis::OsconfigV1beta::AssignmentOsType>

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included. Corresponds to the JSON property osTypes



142
143
144
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 142

def os_types
  @os_types
end

#zonesArray<String>

Targets instances in any of these zones. Leave empty to target instances in any zone. Zonal targeting is uncommon and is supported to facilitate the management of changes by zone. Corresponds to the JSON property zones

Returns:

  • (Array<String>)


149
150
151
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 149

def zones
  @zones
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



156
157
158
159
160
161
162
# File 'generated/google/apis/osconfig_v1beta/classes.rb', line 156

def update!(**args)
  @group_labels = args[:group_labels] if args.key?(:group_labels)
  @instance_name_prefixes = args[:instance_name_prefixes] if args.key?(:instance_name_prefixes)
  @instances = args[:instances] if args.key?(:instances)
  @os_types = args[:os_types] if args.key?(:os_types)
  @zones = args[:zones] if args.key?(:zones)
end