Skip to content

Investigate: Another Common Type for Availability Zone #192

Open
@tombuildsstuff

Description

@tombuildsstuff

SQL @ 2023-02-01-preview now contains:

type AvailabilityZoneType string

const (
	AvailabilityZoneTypeNoPreference AvailabilityZoneType = "NoPreference"
	AvailabilityZoneTypeOne          AvailabilityZoneType = "1"
	AvailabilityZoneTypeThree        AvailabilityZoneType = "3"
	AvailabilityZoneTypeTwo          AvailabilityZoneType = "2"
)

func PossibleValuesForAvailabilityZoneType() []string {
	return []string{
		string(AvailabilityZoneTypeNoPreference),
		string(AvailabilityZoneTypeOne),
		string(AvailabilityZoneTypeThree),
		string(AvailabilityZoneTypeTwo),
	}
}

func (s *AvailabilityZoneType) UnmarshalJSON(bytes []byte) error {
	var decoded string
	if err := json.Unmarshal(bytes, &decoded); err != nil {
		return fmt.Errorf("unmarshaling: %+v", err)
	}
	out, err := parseAvailabilityZoneType(decoded)
	if err != nil {
		return fmt.Errorf("parsing %q: %+v", decoded, err)
	}
	*s = *out
	return nil
}

Which differs from other services - we need to investigate whether this needs to become a new Common Type (e.g. is centrally defined/used as a common swagger type) - and then create custom Expand and Flatten functions to normalise this on our side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions