// Code generated by client-gen. DO NOT EDIT.

package v1alpha2

import (
	v1alpha2 "istio.io/client-go/pkg/apis/config/v1alpha2"
	"istio.io/client-go/pkg/clientset/versioned/scheme"
	rest "k8s.io/client-go/rest"
)

type ConfigV1alpha2Interface interface {
	RESTClient() rest.Interface
	AttributeManifestsGetter
	HTTPAPISpecsGetter
	HTTPAPISpecBindingsGetter
	HandlersGetter
	InstancesGetter
	QuotaSpecsGetter
	QuotaSpecBindingsGetter
	RulesGetter
}

// ConfigV1alpha2Client is used to interact with features provided by the config group.
type ConfigV1alpha2Client struct {
	restClient rest.Interface
}

func (c *ConfigV1alpha2Client) AttributeManifests(namespace string) AttributeManifestInterface {
	return newAttributeManifests(c, namespace)
}

func (c *ConfigV1alpha2Client) HTTPAPISpecs(namespace string) HTTPAPISpecInterface {
	return newHTTPAPISpecs(c, namespace)
}

func (c *ConfigV1alpha2Client) HTTPAPISpecBindings(namespace string) HTTPAPISpecBindingInterface {
	return newHTTPAPISpecBindings(c, namespace)
}

func (c *ConfigV1alpha2Client) Handlers(namespace string) HandlerInterface {
	return newHandlers(c, namespace)
}

func (c *ConfigV1alpha2Client) Instances(namespace string) InstanceInterface {
	return newInstances(c, namespace)
}

func (c *ConfigV1alpha2Client) QuotaSpecs(namespace string) QuotaSpecInterface {
	return newQuotaSpecs(c, namespace)
}

func (c *ConfigV1alpha2Client) QuotaSpecBindings(namespace string) QuotaSpecBindingInterface {
	return newQuotaSpecBindings(c, namespace)
}

func (c *ConfigV1alpha2Client) Rules(namespace string) RuleInterface {
	return newRules(c, namespace)
}

// NewForConfig creates a new ConfigV1alpha2Client for the given config.
func NewForConfig(c *rest.Config) (*ConfigV1alpha2Client, error) {
	config := *c
	if err := setConfigDefaults(&config); err != nil {
		return nil, err
	}
	client, err := rest.RESTClientFor(&config)
	if err != nil {
		return nil, err
	}
	return &ConfigV1alpha2Client{client}, nil
}

// NewForConfigOrDie creates a new ConfigV1alpha2Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha2Client {
	client, err := NewForConfig(c)
	if err != nil {
		panic(err)
	}
	return client
}

// New creates a new ConfigV1alpha2Client for the given RESTClient.
func New(c rest.Interface) *ConfigV1alpha2Client {
	return &ConfigV1alpha2Client{c}
}

func setConfigDefaults(config *rest.Config) error {
	gv := v1alpha2.SchemeGroupVersion
	config.GroupVersion = &gv
	config.APIPath = "/apis"
	config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()

	if config.UserAgent == "" {
		config.UserAgent = rest.DefaultKubernetesUserAgent()
	}

	return nil
}

// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *ConfigV1alpha2Client) RESTClient() rest.Interface {
	if c == nil {
		return nil
	}
	return c.restClient
}
