// WithDomain takes either a domain name or ID and sets the `domainid` parameter
338986
func WithDomain(domain string) OptionFunc {
	return func(cs *CloudStackClient, p interface{}) error {
		ps, ok := p.(DomainIDSetter)

		if !ok || domain == "" {
			return nil
		}

		if !IsID(domain) {
			id, _, err := cs.Domain.GetDomainID(domain)
			if err != nil {
				return err
			}
			domain = id
		}

		ps.SetDomainid(domain)

		return nil
	}
}
1260836
func (client *Client) AddDomain(args *AddDomainArgs) (response *AddDomainResponse, err error) {
	action := "AddDomain"
	response = &AddDomainResponse{}
	err = client.Invoke(action, args, response)
	if err == nil {
		return response, nil
	} else {
		log.Printf("%s error, %v", action, err)
		return response, err
	}
}
510669
func (o *GetOAuth2ClientParams) WithID(id string) *GetOAuth2ClientParams {
	o.SetID(id)
	return o
}
1217258
func (s *DomainValidation) SetValidationDomain(v string) *DomainValidation {
	s.ValidationDomain = &v
	return s
}
205916
func (s *LoadBalancerTlsCertificateDomainValidationRecord) SetDomainName(v string) *LoadBalancerTlsCertificateDomainValidationRecord {
	s.DomainName = &v
	return s
}
1022666
func (s *StreamingDistributionSummary) SetDomainName(v string) *StreamingDistributionSummary {
	s.DomainName = &v
	return s
}
11708
func (s *StreamingDistribution) SetDomainName(v string) *StreamingDistribution {
	s.DomainName = &v
	return s
}
1072327
func (s *UpdateAvailabilityOptionsInput) SetDomainName(v string) *UpdateAvailabilityOptionsInput {
	s.DomainName = &v
	return s
}
314291
func NewDomain() *Domain {

	return &Domain{
		PATEnabled:            "DISABLED",
		DHCPBehavior:          "CONSUME",
		FIPIgnoreDefaultRoute: "DISABLED",
		FIPUnderlay:           false,
		DPI:                   "DISABLED",
		VXLANECMPEnabled:      false,
		MaintenanceMode:       "DISABLED",
		AggregateFlowsEnabled: false,
		FlowCollectionEnabled: "INHERITED",
		Encryption:            "DISABLED",
		UnderlayEnabled:       "DISABLED",
		TunnelType:            "DC_DEFAULT",
	}
}
1049551
func (s *DescribeDomainInput) SetDomainName(v string) *DescribeDomainInput {
	s.DomainName = &v
	return s
}
75874
func (s *DescribeIndexFieldsInput) SetDomainName(v string) *DescribeIndexFieldsInput {
	s.DomainName = &v
	return s
}
387252
func (s *DnsRequestAction) SetDomain(v string) *DnsRequestAction {
	s.Domain = &v
	return s
}
465130
func (s *UpdateDomainEntryInput) SetDomainName(v string) *UpdateDomainEntryInput {
	s.DomainName = &v
	return s
}
683268
func (s *Distribution) SetDomainName(v string) *Distribution {
	s.DomainName = &v
	return s
}
124911
func (s *DisableDomainTransferLockInput) SetDomainName(v string) *DisableDomainTransferLockInput {
	s.DomainName = &v
	return s
}
974962
func (s *CreateDBInstanceInput) SetDomain(v string) *CreateDBInstanceInput {
	s.Domain = &v
	return s
}
1154093
func (s *CountPendingDecisionTasksInput) SetDomain(v string) *CountPendingDecisionTasksInput {
	s.Domain = &v
	return s
}