// Code generated by go-swagger; DO NOT EDIT. package admin // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "net/http" "time" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // NewDomainAllowCreateParams creates a new DomainAllowCreateParams object, // with the default timeout for this client. // // Default values are not hydrated, since defaults are normally applied by the API server side. // // To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDomainAllowCreateParams() *DomainAllowCreateParams { return &DomainAllowCreateParams{ timeout: cr.DefaultTimeout, } } // NewDomainAllowCreateParamsWithTimeout creates a new DomainAllowCreateParams object // with the ability to set a timeout on a request. func NewDomainAllowCreateParamsWithTimeout(timeout time.Duration) *DomainAllowCreateParams { return &DomainAllowCreateParams{ timeout: timeout, } } // NewDomainAllowCreateParamsWithContext creates a new DomainAllowCreateParams object // with the ability to set a context for a request. func NewDomainAllowCreateParamsWithContext(ctx context.Context) *DomainAllowCreateParams { return &DomainAllowCreateParams{ Context: ctx, } } // NewDomainAllowCreateParamsWithHTTPClient creates a new DomainAllowCreateParams object // with the ability to set a custom HTTPClient for a request. func NewDomainAllowCreateParamsWithHTTPClient(client *http.Client) *DomainAllowCreateParams { return &DomainAllowCreateParams{ HTTPClient: client, } } /* DomainAllowCreateParams contains all the parameters to send to the API endpoint for the domain allow create operation. Typically these are written to a http.Request. */ type DomainAllowCreateParams struct { /* Domain. Single domain to allow. Used only if `import` is not `true`. */ Domain *string /* Domains. JSON-formatted list of domain allows to import. This is only used if `import` is set to `true`. */ Domains runtime.NamedReadCloser /* Import. Signal that a list of domain allows is being imported as a file. If set to `true`, then 'domains' must be present as a JSON-formatted file. If set to `false`, then `domains` will be ignored, and `domain` must be present. */ Import *bool /* Obfuscate. Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. Used only if `import` is not `true`. */ Obfuscate *bool /* PrivateComment. Private comment about this domain allow. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up allowed. Used only if `import` is not `true`. */ PrivateComment *string /* PublicComment. Public comment about this domain allow. This will be displayed alongside the domain allow if you choose to share allows. Used only if `import` is not `true`. */ PublicComment *string timeout time.Duration Context context.Context HTTPClient *http.Client } // WithDefaults hydrates default values in the domain allow create params (not the query body). // // All values with no default are reset to their zero value. func (o *DomainAllowCreateParams) WithDefaults() *DomainAllowCreateParams { o.SetDefaults() return o } // SetDefaults hydrates default values in the domain allow create params (not the query body). // // All values with no default are reset to their zero value. func (o *DomainAllowCreateParams) SetDefaults() { var ( importVarDefault = bool(false) ) val := DomainAllowCreateParams{ Import: &importVarDefault, } val.timeout = o.timeout val.Context = o.Context val.HTTPClient = o.HTTPClient *o = val } // WithTimeout adds the timeout to the domain allow create params func (o *DomainAllowCreateParams) WithTimeout(timeout time.Duration) *DomainAllowCreateParams { o.SetTimeout(timeout) return o } // SetTimeout adds the timeout to the domain allow create params func (o *DomainAllowCreateParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } // WithContext adds the context to the domain allow create params func (o *DomainAllowCreateParams) WithContext(ctx context.Context) *DomainAllowCreateParams { o.SetContext(ctx) return o } // SetContext adds the context to the domain allow create params func (o *DomainAllowCreateParams) SetContext(ctx context.Context) { o.Context = ctx } // WithHTTPClient adds the HTTPClient to the domain allow create params func (o *DomainAllowCreateParams) WithHTTPClient(client *http.Client) *DomainAllowCreateParams { o.SetHTTPClient(client) return o } // SetHTTPClient adds the HTTPClient to the domain allow create params func (o *DomainAllowCreateParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } // WithDomain adds the domain to the domain allow create params func (o *DomainAllowCreateParams) WithDomain(domain *string) *DomainAllowCreateParams { o.SetDomain(domain) return o } // SetDomain adds the domain to the domain allow create params func (o *DomainAllowCreateParams) SetDomain(domain *string) { o.Domain = domain } // WithDomains adds the domains to the domain allow create params func (o *DomainAllowCreateParams) WithDomains(domains runtime.NamedReadCloser) *DomainAllowCreateParams { o.SetDomains(domains) return o } // SetDomains adds the domains to the domain allow create params func (o *DomainAllowCreateParams) SetDomains(domains runtime.NamedReadCloser) { o.Domains = domains } // WithImport adds the importVar to the domain allow create params func (o *DomainAllowCreateParams) WithImport(importVar *bool) *DomainAllowCreateParams { o.SetImport(importVar) return o } // SetImport adds the import to the domain allow create params func (o *DomainAllowCreateParams) SetImport(importVar *bool) { o.Import = importVar } // WithObfuscate adds the obfuscate to the domain allow create params func (o *DomainAllowCreateParams) WithObfuscate(obfuscate *bool) *DomainAllowCreateParams { o.SetObfuscate(obfuscate) return o } // SetObfuscate adds the obfuscate to the domain allow create params func (o *DomainAllowCreateParams) SetObfuscate(obfuscate *bool) { o.Obfuscate = obfuscate } // WithPrivateComment adds the privateComment to the domain allow create params func (o *DomainAllowCreateParams) WithPrivateComment(privateComment *string) *DomainAllowCreateParams { o.SetPrivateComment(privateComment) return o } // SetPrivateComment adds the privateComment to the domain allow create params func (o *DomainAllowCreateParams) SetPrivateComment(privateComment *string) { o.PrivateComment = privateComment } // WithPublicComment adds the publicComment to the domain allow create params func (o *DomainAllowCreateParams) WithPublicComment(publicComment *string) *DomainAllowCreateParams { o.SetPublicComment(publicComment) return o } // SetPublicComment adds the publicComment to the domain allow create params func (o *DomainAllowCreateParams) SetPublicComment(publicComment *string) { o.PublicComment = publicComment } // WriteToRequest writes these params to a swagger request func (o *DomainAllowCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error if o.Domain != nil { // form param domain var frDomain string if o.Domain != nil { frDomain = *o.Domain } fDomain := frDomain if fDomain != "" { if err := r.SetFormParam("domain", fDomain); err != nil { return err } } } if o.Domains != nil { if o.Domains != nil { // form file param domains if err := r.SetFileParam("domains", o.Domains); err != nil { return err } } } if o.Import != nil { // query param import var qrImport bool if o.Import != nil { qrImport = *o.Import } qImport := swag.FormatBool(qrImport) if qImport != "" { if err := r.SetQueryParam("import", qImport); err != nil { return err } } } if o.Obfuscate != nil { // form param obfuscate var frObfuscate bool if o.Obfuscate != nil { frObfuscate = *o.Obfuscate } fObfuscate := swag.FormatBool(frObfuscate) if fObfuscate != "" { if err := r.SetFormParam("obfuscate", fObfuscate); err != nil { return err } } } if o.PrivateComment != nil { // form param private_comment var frPrivateComment string if o.PrivateComment != nil { frPrivateComment = *o.PrivateComment } fPrivateComment := frPrivateComment if fPrivateComment != "" { if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { return err } } } if o.PublicComment != nil { // form param public_comment var frPublicComment string if o.PublicComment != nil { frPublicComment = *o.PublicComment } fPublicComment := frPublicComment if fPublicComment != "" { if err := r.SetFormParam("public_comment", fPublicComment); err != nil { return err } } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }