func GetWorkstationsWorkstationConfigApiObject()

in tfplan2cai/converters/google/resources/services/workstations/workstations_workstation_config.go [57:163]


func GetWorkstationsWorkstationConfigApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
	obj := make(map[string]interface{})
	displayNameProp, err := expandWorkstationsWorkstationConfigDisplayName(d.Get("display_name"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
		obj["displayName"] = displayNameProp
	}
	etagProp, err := expandWorkstationsWorkstationConfigEtag(d.Get("etag"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("etag"); !tpgresource.IsEmptyValue(reflect.ValueOf(etagProp)) && (ok || !reflect.DeepEqual(v, etagProp)) {
		obj["etag"] = etagProp
	}
	idleTimeoutProp, err := expandWorkstationsWorkstationConfigIdleTimeout(d.Get("idle_timeout"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("idle_timeout"); !tpgresource.IsEmptyValue(reflect.ValueOf(idleTimeoutProp)) && (ok || !reflect.DeepEqual(v, idleTimeoutProp)) {
		obj["idleTimeout"] = idleTimeoutProp
	}
	runningTimeoutProp, err := expandWorkstationsWorkstationConfigRunningTimeout(d.Get("running_timeout"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("running_timeout"); !tpgresource.IsEmptyValue(reflect.ValueOf(runningTimeoutProp)) && (ok || !reflect.DeepEqual(v, runningTimeoutProp)) {
		obj["runningTimeout"] = runningTimeoutProp
	}
	replicaZonesProp, err := expandWorkstationsWorkstationConfigReplicaZones(d.Get("replica_zones"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("replica_zones"); !tpgresource.IsEmptyValue(reflect.ValueOf(replicaZonesProp)) && (ok || !reflect.DeepEqual(v, replicaZonesProp)) {
		obj["replicaZones"] = replicaZonesProp
	}
	enableAuditAgentProp, err := expandWorkstationsWorkstationConfigEnableAuditAgent(d.Get("enable_audit_agent"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("enable_audit_agent"); !tpgresource.IsEmptyValue(reflect.ValueOf(enableAuditAgentProp)) && (ok || !reflect.DeepEqual(v, enableAuditAgentProp)) {
		obj["enableAuditAgent"] = enableAuditAgentProp
	}
	hostProp, err := expandWorkstationsWorkstationConfigHost(d.Get("host"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("host"); !tpgresource.IsEmptyValue(reflect.ValueOf(hostProp)) && (ok || !reflect.DeepEqual(v, hostProp)) {
		obj["host"] = hostProp
	}
	persistentDirectoriesProp, err := expandWorkstationsWorkstationConfigPersistentDirectories(d.Get("persistent_directories"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("persistent_directories"); !tpgresource.IsEmptyValue(reflect.ValueOf(persistentDirectoriesProp)) && (ok || !reflect.DeepEqual(v, persistentDirectoriesProp)) {
		obj["persistentDirectories"] = persistentDirectoriesProp
	}
	ephemeralDirectoriesProp, err := expandWorkstationsWorkstationConfigEphemeralDirectories(d.Get("ephemeral_directories"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("ephemeral_directories"); !tpgresource.IsEmptyValue(reflect.ValueOf(ephemeralDirectoriesProp)) && (ok || !reflect.DeepEqual(v, ephemeralDirectoriesProp)) {
		obj["ephemeralDirectories"] = ephemeralDirectoriesProp
	}
	containerProp, err := expandWorkstationsWorkstationConfigContainer(d.Get("container"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("container"); !tpgresource.IsEmptyValue(reflect.ValueOf(containerProp)) && (ok || !reflect.DeepEqual(v, containerProp)) {
		obj["container"] = containerProp
	}
	encryptionKeyProp, err := expandWorkstationsWorkstationConfigEncryptionKey(d.Get("encryption_key"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("encryption_key"); !tpgresource.IsEmptyValue(reflect.ValueOf(encryptionKeyProp)) && (ok || !reflect.DeepEqual(v, encryptionKeyProp)) {
		obj["encryptionKey"] = encryptionKeyProp
	}
	readinessChecksProp, err := expandWorkstationsWorkstationConfigReadinessChecks(d.Get("readiness_checks"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("readiness_checks"); !tpgresource.IsEmptyValue(reflect.ValueOf(readinessChecksProp)) && (ok || !reflect.DeepEqual(v, readinessChecksProp)) {
		obj["readinessChecks"] = readinessChecksProp
	}
	disableTcpConnectionsProp, err := expandWorkstationsWorkstationConfigDisableTcpConnections(d.Get("disable_tcp_connections"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("disable_tcp_connections"); !tpgresource.IsEmptyValue(reflect.ValueOf(disableTcpConnectionsProp)) && (ok || !reflect.DeepEqual(v, disableTcpConnectionsProp)) {
		obj["disableTcpConnections"] = disableTcpConnectionsProp
	}
	maxUsableWorkstationsProp, err := expandWorkstationsWorkstationConfigMaxUsableWorkstations(d.Get("max_usable_workstations"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("max_usable_workstations"); !tpgresource.IsEmptyValue(reflect.ValueOf(maxUsableWorkstationsProp)) && (ok || !reflect.DeepEqual(v, maxUsableWorkstationsProp)) {
		obj["maxUsableWorkstations"] = maxUsableWorkstationsProp
	}
	allowedPortsProp, err := expandWorkstationsWorkstationConfigAllowedPorts(d.Get("allowed_ports"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("allowed_ports"); !tpgresource.IsEmptyValue(reflect.ValueOf(allowedPortsProp)) && (ok || !reflect.DeepEqual(v, allowedPortsProp)) {
		obj["allowedPorts"] = allowedPortsProp
	}
	labelsProp, err := expandWorkstationsWorkstationConfigEffectiveLabels(d.Get("effective_labels"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
		obj["labels"] = labelsProp
	}
	annotationsProp, err := expandWorkstationsWorkstationConfigEffectiveAnnotations(d.Get("effective_annotations"), d, config)
	if err != nil {
		return nil, err
	} else if v, ok := d.GetOkExists("effective_annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(annotationsProp)) && (ok || !reflect.DeepEqual(v, annotationsProp)) {
		obj["annotations"] = annotationsProp
	}

	return obj, nil
}