// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"fmt"
)

type SourcePipelinerUpdateDataCenter string

const (
	SourcePipelinerUpdateDataCenterEuCentral   SourcePipelinerUpdateDataCenter = "eu-central"
	SourcePipelinerUpdateDataCenterUsEast      SourcePipelinerUpdateDataCenter = "us-east"
	SourcePipelinerUpdateDataCenterCaCentral   SourcePipelinerUpdateDataCenter = "ca-central"
	SourcePipelinerUpdateDataCenterApSoutheast SourcePipelinerUpdateDataCenter = "ap-southeast"
)

func (e SourcePipelinerUpdateDataCenter) ToPointer() *SourcePipelinerUpdateDataCenter {
	return &e
}
func (e *SourcePipelinerUpdateDataCenter) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "eu-central":
		fallthrough
	case "us-east":
		fallthrough
	case "ca-central":
		fallthrough
	case "ap-southeast":
		*e = SourcePipelinerUpdateDataCenter(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourcePipelinerUpdateDataCenter: %v", v)
	}
}

type SourcePipelinerUpdate struct {
	Password *string                         `json:"password,omitempty"`
	Service  SourcePipelinerUpdateDataCenter `json:"service"`
	Spaceid  string                          `json:"spaceid"`
	Username string                          `json:"username"`
}

func (o *SourcePipelinerUpdate) GetPassword() *string {
	if o == nil {
		return nil
	}
	return o.Password
}

func (o *SourcePipelinerUpdate) GetService() SourcePipelinerUpdateDataCenter {
	if o == nil {
		return SourcePipelinerUpdateDataCenter("")
	}
	return o.Service
}

func (o *SourcePipelinerUpdate) GetSpaceid() string {
	if o == nil {
		return ""
	}
	return o.Spaceid
}

func (o *SourcePipelinerUpdate) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}
