// Code generated by go-swagger; DO NOT EDIT.

package ops

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// RbacGenerateAPIKeyReq rbac generate API key req
//
// swagger:model rbac.GenerateAPIKeyReq
type RbacGenerateAPIKeyReq struct {

	// comment
	// Required: true
	Comment *string `json:"comment"`

	// owner
	// Required: true
	Owner *string `json:"owner"`
}

// Validate validates this rbac generate API key req
func (m *RbacGenerateAPIKeyReq) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateComment(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateOwner(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *RbacGenerateAPIKeyReq) validateComment(formats strfmt.Registry) error {

	if err := validate.Required("comment", "body", m.Comment); err != nil {
		return err
	}

	return nil
}

func (m *RbacGenerateAPIKeyReq) validateOwner(formats strfmt.Registry) error {

	if err := validate.Required("owner", "body", m.Owner); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this rbac generate API key req based on context it is used
func (m *RbacGenerateAPIKeyReq) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *RbacGenerateAPIKeyReq) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *RbacGenerateAPIKeyReq) UnmarshalBinary(b []byte) error {
	var res RbacGenerateAPIKeyReq
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
