// Copyright The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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

package fake

import (
	context "context"

	v1alpha1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1"
	monitoringv1alpha1 "github.com/prometheus-operator/prometheus-operator/pkg/client/applyconfiguration/monitoring/v1alpha1"
	typedmonitoringv1alpha1 "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1alpha1"
	autoscalingv1 "k8s.io/api/autoscaling/v1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	gentype "k8s.io/client-go/gentype"
	testing "k8s.io/client-go/testing"
)

// fakePrometheusAgents implements PrometheusAgentInterface
type fakePrometheusAgents struct {
	*gentype.FakeClientWithListAndApply[*v1alpha1.PrometheusAgent, *v1alpha1.PrometheusAgentList, *monitoringv1alpha1.PrometheusAgentApplyConfiguration]
	Fake *FakeMonitoringV1alpha1
}

func newFakePrometheusAgents(fake *FakeMonitoringV1alpha1, namespace string) typedmonitoringv1alpha1.PrometheusAgentInterface {
	return &fakePrometheusAgents{
		gentype.NewFakeClientWithListAndApply[*v1alpha1.PrometheusAgent, *v1alpha1.PrometheusAgentList, *monitoringv1alpha1.PrometheusAgentApplyConfiguration](
			fake.Fake,
			namespace,
			v1alpha1.SchemeGroupVersion.WithResource("prometheusagents"),
			v1alpha1.SchemeGroupVersion.WithKind("PrometheusAgent"),
			func() *v1alpha1.PrometheusAgent { return &v1alpha1.PrometheusAgent{} },
			func() *v1alpha1.PrometheusAgentList { return &v1alpha1.PrometheusAgentList{} },
			func(dst, src *v1alpha1.PrometheusAgentList) { dst.ListMeta = src.ListMeta },
			func(list *v1alpha1.PrometheusAgentList) []*v1alpha1.PrometheusAgent {
				return gentype.ToPointerSlice(list.Items)
			},
			func(list *v1alpha1.PrometheusAgentList, items []*v1alpha1.PrometheusAgent) {
				list.Items = gentype.FromPointerSlice(items)
			},
		),
		fake,
	}
}

// GetScale takes name of the prometheusAgent, and returns the corresponding scale object, and an error if there is any.
func (c *fakePrometheusAgents) GetScale(ctx context.Context, prometheusAgentName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
	emptyResult := &autoscalingv1.Scale{}
	obj, err := c.Fake.
		Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", prometheusAgentName, options), emptyResult)

	if obj == nil {
		return emptyResult, err
	}
	return obj.(*autoscalingv1.Scale), err
}

// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *fakePrometheusAgents) UpdateScale(ctx context.Context, prometheusAgentName string, scale *autoscalingv1.Scale, opts v1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
	emptyResult := &autoscalingv1.Scale{}
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})

	if obj == nil {
		return emptyResult, err
	}
	return obj.(*autoscalingv1.Scale), err
}
