From 2dcbef9281d971aa78921f00bb6b8b3d7c048b6f Mon Sep 17 00:00:00 2001 From: "yuanyi.lp" Date: Fri, 31 Dec 2021 16:21:34 +0800 Subject: [PATCH 1/4] feature(ingress): add alb ingress support --- cmd/manager/main.go | 14 +- docs/examples/cloud-controller-manager.yml | 93 +- docs/examples/master.policy | 64 +- docs/getting-started.md | 5 +- docs/usage-alb.md | 954 +++++++++++ docs/zh/usage-alb.md | 949 +++++++++++ go.mod | 3 + pkg/apis/alibabacloud/v1/albconfig_types.go | 208 +++ pkg/apis/alibabacloud/v1/gateway_types.go | 64 - pkg/apis/alibabacloud/v1/ingress_types.go | 308 ---- .../alibabacloud/v1/zz_generated.deepcopy.go | 329 +--- pkg/controller/helper/event.go | 42 + pkg/controller/helper/k8s/pod_utils.go | 52 + pkg/controller/helper/k8s/queue.go | 188 +++ .../helper/k8s/reference_indexer.go | 42 + pkg/controller/helper/service.go | 200 +++ pkg/controller/ingress/alb_controller.go | 728 +++++++++ pkg/controller/ingress/event_handler.go | 71 + pkg/controller/ingress/ingress_controller.go | 80 +- .../reconcile/annotations/annotations.go | 184 +++ .../annotations/class_annotation_matcher.go | 40 + .../ingress/reconcile/annotations/parser.go | 426 +++++ .../ingress/reconcile/applier/alb.go | 190 +++ .../ingress/reconcile/applier/albconfig.go | 94 ++ .../ingress/reconcile/applier/listener.go | 231 +++ .../ingress/reconcile/applier/rule.go | 284 ++++ .../ingress/reconcile/applier/server.go | 311 ++++ .../ingress/reconcile/applier/server_group.go | 327 ++++ .../ingress/reconcile/applier/service.go | 250 +++ .../ingress/reconcile/backend/backend.go | 94 ++ .../reconcile/backend/endpoint_resolver.go | 366 +++++ .../albconfig_manager/cert_discovery.go | 234 +++ .../builder/albconfig_manager/finalizer.go | 50 + .../builder/albconfig_manager/group_loader.go | 206 +++ .../albconfig_manager/model_build_listener.go | 115 ++ .../model_build_listener_rules.go | 356 ++++ .../model_build_load_balancer.go | 119 ++ .../model_build_server_group.go | 186 +++ .../albconfig_manager/model_builder.go | 316 ++++ .../albconfig_manager/schema_builder.go | 38 + .../albconfig_manager/vswitch_discovery.go | 169 ++ .../service_manager/model_builder_service.go | 60 + .../ingress/reconcile/store/common.go | 463 ++++++ .../ingress/reconcile/store/store.go | 625 +++++++ .../ingress/reconcile/tracking/tracking.go | 71 + pkg/controller/register.go | 83 +- pkg/model/alb/alb.go | 279 ++++ pkg/model/alb/core/graph/resource_graph.go | 60 + .../alb/core/graph/typological_traversal.go | 49 + pkg/model/alb/core/resource.go | 46 + pkg/model/alb/core/stack.go | 116 ++ pkg/model/alb/core/stack_id.go | 16 + pkg/model/alb/core/token_types.go | 62 + pkg/model/alb/listener.go | 60 + pkg/model/alb/load_balancer.go | 67 + pkg/model/alb/rule.go | 51 + pkg/model/alb/server_group.go | 54 + pkg/model/alb/service_manager.go | 89 + pkg/model/alb/tag.go | 13 + pkg/provider/alibaba/alb/alb.go | 877 ++++++++++ pkg/provider/alibaba/alb/listener.go | 984 +++++++++++ pkg/provider/alibaba/alb/rule.go | 1441 +++++++++++++++++ pkg/provider/alibaba/alb/server.go | 705 ++++++++ pkg/provider/alibaba/alb/server_group.go | 451 ++++++ pkg/provider/alibaba/alb/tagging.go | 213 +++ pkg/provider/alibaba/alibabacloud.go | 9 + pkg/provider/alibaba/base/clientMgr.go | 60 +- pkg/provider/alibaba/cas/cas_provider.go | 30 + pkg/provider/alibaba/sls/sls_provider.go | 24 + pkg/provider/alibaba/vpc/vpc.go | 33 + pkg/provider/dryrun/alb.go | 118 ++ pkg/provider/dryrun/cas.go | 32 + pkg/provider/dryrun/dryruncloud.go | 12 + pkg/provider/dryrun/sls.go | 26 + pkg/provider/dryrun/vpc.go | 6 + pkg/provider/provider.go | 63 +- pkg/provider/vmock/albprd.go | 113 ++ pkg/provider/vmock/cas.go | 29 + pkg/provider/vmock/sls.go | 23 + pkg/provider/vmock/vpc.go | 4 + pkg/util/constant.go | 323 ++++ pkg/util/utils.go | 31 + 82 files changed, 16014 insertions(+), 837 deletions(-) create mode 100644 docs/usage-alb.md create mode 100644 docs/zh/usage-alb.md create mode 100644 pkg/apis/alibabacloud/v1/albconfig_types.go delete mode 100644 pkg/apis/alibabacloud/v1/gateway_types.go delete mode 100644 pkg/apis/alibabacloud/v1/ingress_types.go create mode 100644 pkg/controller/helper/k8s/pod_utils.go create mode 100644 pkg/controller/helper/k8s/queue.go create mode 100644 pkg/controller/helper/k8s/reference_indexer.go create mode 100644 pkg/controller/helper/service.go create mode 100644 pkg/controller/ingress/alb_controller.go create mode 100644 pkg/controller/ingress/event_handler.go create mode 100644 pkg/controller/ingress/reconcile/annotations/annotations.go create mode 100644 pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go create mode 100644 pkg/controller/ingress/reconcile/annotations/parser.go create mode 100644 pkg/controller/ingress/reconcile/applier/alb.go create mode 100644 pkg/controller/ingress/reconcile/applier/albconfig.go create mode 100644 pkg/controller/ingress/reconcile/applier/listener.go create mode 100644 pkg/controller/ingress/reconcile/applier/rule.go create mode 100644 pkg/controller/ingress/reconcile/applier/server.go create mode 100644 pkg/controller/ingress/reconcile/applier/server_group.go create mode 100644 pkg/controller/ingress/reconcile/applier/service.go create mode 100644 pkg/controller/ingress/reconcile/backend/backend.go create mode 100644 pkg/controller/ingress/reconcile/backend/endpoint_resolver.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/cert_discovery.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/finalizer.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/group_loader.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener_rules.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_load_balancer.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_server_group.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/model_builder.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/schema_builder.go create mode 100644 pkg/controller/ingress/reconcile/builder/albconfig_manager/vswitch_discovery.go create mode 100644 pkg/controller/ingress/reconcile/builder/service_manager/model_builder_service.go create mode 100644 pkg/controller/ingress/reconcile/store/common.go create mode 100644 pkg/controller/ingress/reconcile/store/store.go create mode 100644 pkg/controller/ingress/reconcile/tracking/tracking.go create mode 100644 pkg/model/alb/alb.go create mode 100644 pkg/model/alb/core/graph/resource_graph.go create mode 100644 pkg/model/alb/core/graph/typological_traversal.go create mode 100644 pkg/model/alb/core/resource.go create mode 100644 pkg/model/alb/core/stack.go create mode 100644 pkg/model/alb/core/stack_id.go create mode 100644 pkg/model/alb/core/token_types.go create mode 100644 pkg/model/alb/listener.go create mode 100644 pkg/model/alb/load_balancer.go create mode 100644 pkg/model/alb/rule.go create mode 100644 pkg/model/alb/server_group.go create mode 100644 pkg/model/alb/service_manager.go create mode 100644 pkg/model/alb/tag.go create mode 100644 pkg/provider/alibaba/alb/alb.go create mode 100644 pkg/provider/alibaba/alb/listener.go create mode 100644 pkg/provider/alibaba/alb/rule.go create mode 100644 pkg/provider/alibaba/alb/server.go create mode 100644 pkg/provider/alibaba/alb/server_group.go create mode 100644 pkg/provider/alibaba/alb/tagging.go create mode 100644 pkg/provider/alibaba/cas/cas_provider.go create mode 100644 pkg/provider/alibaba/sls/sls_provider.go create mode 100644 pkg/provider/dryrun/alb.go create mode 100644 pkg/provider/dryrun/cas.go create mode 100644 pkg/provider/dryrun/sls.go create mode 100644 pkg/provider/vmock/albprd.go create mode 100644 pkg/provider/vmock/cas.go create mode 100644 pkg/provider/vmock/sls.go create mode 100644 pkg/util/constant.go diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 3e82893d4..386040b33 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -3,6 +3,10 @@ package main import ( "flag" "fmt" + "net/http" + "os" + "runtime" + "github.com/spf13/pflag" apiext "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" utilerrors "k8s.io/apimachinery/pkg/util/errors" @@ -16,9 +20,6 @@ import ( "k8s.io/cloud-provider-alibaba-cloud/version" "k8s.io/klog" "k8s.io/klog/klogr" - "net/http" - "os" - "runtime" "sigs.k8s.io/controller-runtime/pkg/client/config" ctrl "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -80,6 +81,13 @@ func main() { } ctx := shared.NewSharedContext(cloud) + log.Info("start to register crds") + err = controller.RegisterCRD(cfg) + if err != nil { + log.Error(err, "register crd: %s", err.Error()) + os.Exit(1) + } + log.Info("Registering Components.") if err := controller.AddToManager(mgr, ctx, ctrlCfg.ControllerCFG.Controllers); err != nil { log.Error(err, "add controller: %s", err.Error()) diff --git a/docs/examples/cloud-controller-manager.yml b/docs/examples/cloud-controller-manager.yml index e352eabb5..129020011 100644 --- a/docs/examples/cloud-controller-manager.yml +++ b/docs/examples/cloud-controller-manager.yml @@ -10,7 +10,9 @@ rules: - services - secrets - endpoints + - configmaps - serviceaccounts + - pods verbs: - get - list @@ -33,6 +35,7 @@ rules: - "" resources: - services/status + - pods/status verbs: - update - patch @@ -61,6 +64,61 @@ rules: - update - create - delete + - apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - get + - update + - create + - delete + - apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch + - update + - create + - patch + - delete + - apiGroups: + - alibabacloud.com + resources: + - albconfigs + verbs: + - get + - list + - watch + - update + - create + - patch + - delete + - apiGroups: + - alibabacloud.com + resources: + - albconfigs/status + verbs: + - update + - patch + - apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update + - patch + - apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - get + - list + - watch --- apiVersion: v1 kind: ServiceAccount @@ -81,6 +139,20 @@ subjects: name: cloud-controller-manager namespace: kube-system --- +apiVersion: v1 +kind: ConfigMap +metadata: + name: cloud-config + namespace: kube-system +data: + cloud-config.conf: |- + { + "Global": { + "accessKeyID": "$your-AccessKeyID-base64", + "accessKeySecret": "$your-AccessKeySecret-base64" + } + } +--- apiVersion: apps/v1 kind: DaemonSet metadata: @@ -114,16 +186,15 @@ spec: node-role.kubernetes.io/master: "" containers: - command: - - /cloud-controller-manager + - /cloud-controller-manager - --kubeconfig=/etc/kubernetes/cloud-controller-manager.conf - - --address=127.0.0.1 - - --allow-untagged-cloud=true - - --leader-elect=true - - --cloud-provider=alicloud - - --use-service-account-credentials=true - --cloud-config=/etc/kubernetes/config/cloud-config.conf - - --configure-cloud-routes=false - - --allocate-node-cidrs=false + - --controllers=node,route,service,ingress + - --metrics-bind-addr=0 + - --route-reconciliation-period=3m + - --configure-cloud-routes=true + #- --cluster-cidr=172.16.0.0/16 + - --cluster-cidr=${CLUSTER_CIDR} image: registry.cn-hangzhou.aliyuncs.com/acs/cloud-controller-manager-amd64:${ImageVersion} livenessProbe: failureThreshold: 8 @@ -137,7 +208,11 @@ spec: name: cloud-controller-manager resources: requests: - cpu: 200m + cpu: 100m + memory: 200Mi + limits: + cpu: 1000m + memory: 2Gi volumeMounts: - mountPath: /etc/kubernetes/ name: k8s diff --git a/docs/examples/master.policy b/docs/examples/master.policy index a9267e97b..e393e2f2e 100644 --- a/docs/examples/master.policy +++ b/docs/examples/master.policy @@ -81,6 +81,68 @@ "*" ], "Effect": "Allow" - } + }, + { + "Action": [ + "alb:TagResources", + "alb:ListServerGroups", + "alb:ListServerGroupServers", + "alb:AddServersToServerGroup", + "alb:RemoveServersFromServerGroup", + "alb:ReplaceServersInServerGroup", + "alb:CreateLoadBalancer", + "alb:DeleteLoadBalancer", + "alb:UpdateLoadBalancerAttribute", + "alb:UpdateLoadBalancerEdition", + "alb:EnableLoadBalancerAccessLog", + "alb:DisableLoadBalancerAccessLog", + "alb:EnableDeletionProtection", + "alb:DisableDeletionProtection", + "alb:ListLoadBalancers", + "alb:GetLoadBalancerAttribute", + "alb:ListListeners", + "alb:CreateListener", + "alb:GetListenerAttribute", + "alb:UpdateListenerAttribute", + "alb:ListListenerCertificates", + "alb:AssociateAdditionalCertificatesWithListener", + "alb:DissociateAdditionalCertificatesFromListener", + "alb:DeleteListener", + "alb:CreateRule", + "alb:DeleteRule", + "alb:UpdateRuleAttribute", + "alb:CreateRules", + "alb:UpdateRulesAttribute", + "alb:DeleteRules", + "alb:ListRules", + "alb:CreateServerGroup", + "alb:DeleteServerGroup", + "alb:UpdateServerGroupAttribute", + "alb:DescribeZones" + ], + "Resource": "*", + "Effect": "Allow" + }, + { + "Action": "ram:CreateServiceLinkedRole", + "Resource": "*", + "Effect": "Allow", + "Condition": { + "StringEquals": { + "ram:ServiceName": [ + "alb.aliyuncs.com", + "logdelivery.alb.aliyuncs.com" + ] + } + } + }, + { + "Action": [ + "yundun-cert:DescribeSSLCertificateList", + "yundun-cert:DescribeSSLCertificatePublicKeyDetail" + ], + "Resource": "*", + "Effect": "Allow" + } ] } \ No newline at end of file diff --git a/docs/getting-started.md b/docs/getting-started.md index e4ffb65de..f75329812 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,6 +1,6 @@ ## Prerequisites -- Version: kubernetes version > 1.7.2 is required. +- Version: kubernetes version > 1.7.2 is required. If using alb ingress, kubernetes version > 1.19.0 is required - CloudNetwork: Only Alibaba Cloud VPC network is supported. @@ -188,3 +188,6 @@ $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-example-svc LoadBalancer 10.96.38.24 10.x.x.x 80:30536/TCP 38s ``` + +## Try With Simple ALB Ingress Example +run a sample ingress: [usage-alb.md](usage-alb.md) \ No newline at end of file diff --git a/docs/usage-alb.md b/docs/usage-alb.md new file mode 100644 index 000000000..ec4718ef0 --- /dev/null +++ b/docs/usage-alb.md @@ -0,0 +1,954 @@ +# Alibaba Cloud Provider + +# Application Load Balancer Ingress introduction + +Application Load Balancer (ALB) Ingresses are compatible with NGINX Ingresses, and provide improved traffic routing capabilities based on ALB instances. ALB Ingresses support complex routing, automatic certificate discovery, and the HTTP, HTTPS, and Quick UDP Internet Connection (QUIC) protocols. ALB Ingresses meet the requirements of cloud-native applications for ultra-high elasticity and balancing of heavy traffic loads at Layer 7. This topic describes how to use an ALB Ingress to expose Services. + +## Background information + +An Ingress provides a collection of rules that manage external access to Services in a cluster. You can configure forwarding rules to assign Services different externally-accessible URLs. However, NGINX Ingresses and Layer 4 Server Load Balancer (SLB) Ingresses cannot meet the requirements of cloud-native applications, such as complex routing, support for multiple application layer protocols (such as QUIC), and balancing of heavy traffic loads at Layer 7. + +## Configure Albconfig objects + +An Albconfig object is a CustomResourceDefinition (CRD) object that Container Service for Kubernetes (ACK) provides for the Application Load Balancer (ALB) Ingress controller. The ALB Ingress controller uses Albconfig objects to configure ALB instances and listeners. This topic describes how to create and modify an Albconfig object, and how to specify an Albconfig object for an Ingress. + +### Background information +The ALB Ingress controller retrieves the changes to Ingresses from the API server and dynamically generates Albconfig objects when Ingresses changes are detected. Then, the ALB Ingress controller performs the following operations in sequence: create ALB instances, configure listeners, create Ingress rules, and configure backend server groups. The Service, Ingress, and Albconfig objects interact with each other in the following ways: +- A Service is an abstraction of an application that is deployed on a set of replicated pods. +- An Ingress contains reverse proxy rules. It controls to which Services HTTP or HTTPS requests are routed. For example, an Ingress routes requests to different Services based on the hosts and URLs in the requests. +- An Albconfig is a CustomResourceDefinition (CRD) object that the ALB Ingress controller uses to configure ALB instances and listeners. An Albconfig corresponds to one ALB instance. +- An Albconfig object is used to configure an ALB instance. The ALB instance can be specified in forwarding rules of multiple Ingresses. Therefore, an Albconfig object can be associated with multiple Ingresses. + +### Create an Albconfig object + +When you create an Ingress, an Albconfig object named default is automatically created in the kube-system namespace. + +1. Use the following template to create an Ingress and an Albconfig object: + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + name: cafe-ingress + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + spec: + rules: + - http: + paths: + # Configure a context path. + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + # Configure a context path. + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 + ``` +2. Run the following command to query the automatically created Albconfig object: + ```bash + kubectl -n kube-system get albconfig + ``` + output: + ```bash + NAME AGE + default 87m + ``` + The following content shows the configurations of the default Albconfig object: + ```yaml + apiVersion: alibabacloud.com/v1 + kind: AlbConfig + metadata: + name: default # The name of the Albconfig object. + namespace: kube-system # The namespace to which the Albconfig object belongs. + spec: + config: + accessLogConfig: + logProject: "" + logStore: "" + addressAllocatedMode: Dynamic + addressType: Internet + billingConfig: + internetBandwidth: 0 + internetChargeType: "" + payType: PostPay + deletionProtectionEnabled: true + edition: Standard + forceOverride: false + zoneMappings: + - vSwitchId: vsw-wz92lvykqj1siwvif**** # A vSwitch that is specified for the Albconfig object. You must specify two vSwitches. + - vSwitchId: vsw-wz9mnucx78c7i6iog**** # A vSwitch that is specified for the Albconfig object. + status: + loadBalancer: + dnsname: alb-s2em8fr9debkg5****.cn-shenzhen.alb.aliyuncs.com + id: alb-s2em8fr9debkg5**** + ``` +### Change the name of an Albconfig object +To change the name of an Albconfig object, run the following command. The change is automatically applied after you save the modification. +```bash +kubectl -n kube-system edit albconfig default +... + spec: + config: + name: basic # The new name that you want to use. +... +``` +### Change the vSwitches that are specified for an Albconfig object +To change the vSwitches that are specified for an Albconfig object, run the following command. The change is automatically applied after you save the modification. +```bash +kubectl -n kube-system edit albconfig default +... + zoneMappings: + - vSwitchId: vsw-wz92lvykqj1siwvif**** + - vSwitchId: vsw-wz9mnucx78c7i6iog**** +... +``` +### Specify an Albconfig object for an Ingress +To specify an Albconfig object for an Ingress, use the annotation alb.ingress.kubernetes.io/albconfig.name. This allows you to use a specific ALB instance. +``` +Note If the specified Albconfig object does not exist in the kube-system namespace, the system automatically creates an Albconfig object named default in the kube-system namespace. +``` +```yaml +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: cafe-ingress-v1 + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/albconfig.name: basic + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" +spec: + rules: + - http: + paths: + # Configure a context path. + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + # Configure a context path. + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 +``` +### Delete an ALB instance +An Albconfig object is used to configure an ALB instance. Therefore, you can delete an ALB instance by deleting the corresponding Albconfig object. Before you can delete an Albconfig object, you must delete all Ingresses that are associated with the Albconfig object. +```bash +kubectl -n kube-system delete albconfig default +``` +Replace default with the name of the Albconfig object that you want to delete. + +## Expose Services by using an ALB Ingress + +This topic describes how to use an ALB Ingress to expose Services. + +### Background information + +An Ingress provides a collection of rules that manage external access to Services in a cluster. You can configure forwarding rules to assign Services different externally-accessible URLs. However, NGINX Ingresses and Layer 4 Server Load Balancer (SLB) Ingresses cannot meet the requirements of cloud-native applications, such as complex routing, support for multiple application layer protocols (such as QUIC), and balancing of heavy traffic loads at Layer 7. + +### Step 1: Deploy Services + +1. Create a cafe-service.yaml file and copy the following content to the file. The file is used to deploy two Deployments named coffee and tea and two Services named coffee and tea. + ```yaml + apiVersion: apps/v1 + kind: Deployment + metadata: + name: coffee + spec: + replicas: 2 + selector: + matchLabels: + app: coffee + template: + metadata: + labels: + app: coffee + spec: + containers: + - name: coffee + image: registry.cn-hangzhou.aliyuncs.com/acs-sample/nginxdemos:latest + ports: + - containerPort: 80 + --- + apiVersion: v1 + kind: Service + metadata: + name: coffee-svc + spec: + ports: + - port: 80 + targetPort: 80 + protocol: TCP + selector: + app: coffee + clusterIP: None + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: tea + spec: + replicas: 1 + selector: + matchLabels: + app: tea + template: + metadata: + labels: + app: tea + spec: + containers: + - name: tea + image: registry.cn-hangzhou.aliyuncs.com/acs-sample/nginxdemos:latest + ports: + - containerPort: 80 + --- + apiVersion: v1 + kind: Service + metadata: + name: tea-svc + labels: + spec: + ports: + - port: 80 + targetPort: 80 + protocol: TCP + selector: + app: tea + clusterIP: None + ``` +2. Run the following command to deploy the Deployments and Services: + ```bash + kubectl apply -f cafe-service.yaml + ``` + Expected output: + ```bash + deployment "coffee" created + service "coffee-svc" created + deployment "tea" created + service "tea-svc" created + ``` +3. Run the following command to query the status of the Services: + ```bash + kubectl get svc,deploy + ``` + Expected output: + ```bash + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE + coffee-svc NodePort 172.16.231.169 80:31124/TCP 6s + tea-svc NodePort 172.16.38.182 80:32174/TCP 5s + NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE + deploy/coffee 2 2 2 2 1m + deploy/tea 1 1 1 1 1m + ``` + +Step 2: Configure an Ingress +1. Create a cafe-ingress.yaml and copy the following content to the file: + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + name: cafe-ingress + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/name: ingress_test_base + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + spec: + rules: + - http: + paths: + #Configure context path. + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + #Configure context path. + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 + ``` + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
(Optional) alb.ingress.kubernetes.io/nameThe name of the ALB instance that you want to use.
(Optional) alb.ingress.kubernetes.io/address-typeThe type of IP address that the ALB instance uses to provide services. Valid values: +
    +
  • Internet: The ALB instance uses a public IP address. The domain name of the Ingress is resolved to the public IP address of the ALB instance. Therefore, the ALB instance is accessible over the Internet. This is the default value. +
  • +
  • Intranet: The ALB instance uses a private IP address. The domain name of the Ingress is resolved to the private IP address of the ALB instance. Therefore, the ALB instance is accessible only within the virtual private cloud (VPC) where the ALB instance is deployed. +
  • +
+
alb.ingress.kubernetes.io/vswitch-idsThe IDs of the vSwitches that are used by the ALB Ingress. You must specify at least two vSwitch IDs and the vSwitches must be deployed in different zones. For more information about the regions and zones that are supported by ALB Ingresses, see Supported regions and zones. +
+ +2. Run the following command to configure an externally-accessible domain name and a path for the coffee and tea Services separately: + ```bash + kubectl apply -f cafe-ingress.yaml + ``` + Expected output: + ```bash + ingress "cafe-ingress" created + ``` +3. Run the following command to query the IP address of the ALB instance: + ```bash + kubectl get ing + ``` + Expected output: + ``` + NAME CLASS HOSTS ADDRESS PORTS AGE + cafe-ingress * alb-m551oo2zn63yov****.cn-hangzhou.alb.aliyuncs.com 80 50s + ``` + +### Step 3: Access the Services +- After you obtain the IP address of the ALB instance, Access the coffee Service by using a CLI. + ```bash + curl http://alb-m551oo2zn63yov****.cn-hangzhou.alb.aliyuncs.com/coffee + ``` +- After you obtain the IP address of the ALB instance, Access the tea Service by using a CLI. + ```bash + curl http://alb-m551oo2zn63yov****.cn-hangzhou.alb.aliyuncs.com/tea + ``` +## Advanced ALB Ingress configurations + +An Ingress is an API object that you can use to provide Layer 7 load balancing to manage external access to Services in a serverless Kubernetes (ASK) cluster. This topic describes how to use Application Load Balancer (ALB) Ingresses to forward requests to backend server groups based on domain names and URL paths, redirect HTTP requests to HTTPS, and implement canary releases. + +### Forward requests based on domain names +Perform the following steps to create a simple Ingress with or without a domain name to forward requests. +- Create a simple Ingress with a domain name. + 1. Use the following template to create a Deployment, a Service, and an Ingress. Requests to the domain name of the Ingress are forwarded to the Service. + ``` + apiVersion: v1 + kind: Service + metadata: + name: demo-service + namespace: default + spec: + ports: + - name: port1 + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: demo + sessionAffinity: None + type: ClusterIP + + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: demo + namespace: default + spec: + replicas: 1 + selector: + matchLabels: + app: demo + template: + metadata: + labels: + app: demo + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo + ports: + - containerPort: 8080 + protocol: TCP + --- + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo + namespace: default + spec: + rules: + - host: demo.domain.ingress.top # The domain name of the Ingress. + http: + paths: + - backend: + serviceName: demo-service + servicePort: 80 + path: /hello + pathType: ImplementationSpecific + ``` + 2. Run the following command to access the application by using the specified domain name. + + Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. + ```bash + curl -H "host: demo.domain.ingress.top"
/hello + ``` + Expected output: + ```bash + {"hello":"coffee"} + ``` + +- Create a simple Ingress without a domain name. + 1. Use the following template to create an Ingress: + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo + namespace: default + spec: + rules: + - host: "" + http: + paths: + - backend: + serviceName: demo-service + servicePort: 80 + path: /hello + pathType: ImplementationSpecific + ``` + 2. Run the following command to access the application without using a domain name. + + Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. + ```bash + curl
/hello + ``` + Expected output: + ```bash + {"hello":"coffee"} + ``` + +### Forward requests based on URL paths + +ALB Ingresses support request forwarding based on URL paths. You can use the pathType parameter to configure different URL match policies. The valid values of pathType are Exact, ImplementationSpecific, and Prefix. + +The following steps show how to configure different URL match policies. +- Exact:exactly matches the URL path with case sensitivity. + + 1. Use the following template to create an Ingress: + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path + namespace: default + spec: + rules: + - http: + paths: + - path: /hello + backend: + serviceName: demo-service + servicePort: 80 + pathType: Exact + ``` + 2. Run the following command to access the application. + + Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. + ```bash + curl
/hello + ``` + Expected output: + ```bash + {"hello":"coffee"} + ``` +- ImplementationSpecific: the default match policy. For ALB Ingresses, the ImplementationSpecific policy has the same effect as the Exact policy. However, the controllers of Ingresses with the ImplementationSpecific policy and the controllers Ingresses with the Exact policy are implemented in different ways. + + 1. Use the following template to create an Ingress: + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path + namespace: default + spec: + rules: + - http: + paths: + - path: /hello + backend: + serviceName: demo-service + servicePort: 80 + pathType: ImplementationSpecific + ``` + 2. Run the following command to access the application. + + Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. + ```bash + curl
/hello + ``` + Expected output: + ```bash + {"hello":"coffee"} + ``` +- Prefix: matches based on a URL path prefix separated by forward slashes (/). The match is case-sensitive and performed on each element of the path. + + 1. Use the following template to create an Ingress: + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path-prefix + namespace: default + spec: + rules: + - http: + paths: + - path: / + backend: + serviceName: demo-service + servicePort: 80 + pathType: Prefix + ``` + 2. Run the following command to access the application. + + Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. + ```bash + curl
/hello + ``` + Expected output: + ```bash + {"hello":"coffee"} + ``` + +### Configure health checks + +You can configure health checks for ALB Ingresses by using the following annotations. + +The following YAML template provides an example on how to create an Ingress that has health check enabled: +```yaml +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: cafe-ingress + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + alb.ingress.kubernetes.io/healthcheck-enabled: "true" + alb.ingress.kubernetes.io/healthcheck-path: "/" + alb.ingress.kubernetes.io/healthcheck-protocol: "HTTP" + alb.ingress.kubernetes.io/healthcheck-method: "HEAD" + alb.ingress.kubernetes.io/healthcheck-httpcode: "http_2xx" + alb.ingress.kubernetes.io/healthcheck-timeout-seconds: "5" + alb.ingress.kubernetes.io/healthcheck-interval-seconds: "2" + alb.ingress.kubernetes.io/healthy-threshold-count: "3" + alb.ingress.kubernetes.io/unhealthy-threshold-count: "3" +spec: + rules: + - http: + paths: + # Configure a context path. + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + # Configure a context path. + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 +``` +The following table describes the parameters in the YAML template. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
alb.ingress.kubernetes.io/healthcheck-enabledOptional. Specifies whether to enable health check. Default value: true. +
alb.ingress.kubernetes.io/healthcheck-pathOptional. The path at which health checks are performed. Default value: /. +
    +
  • Enter the URL of the web page on which you want to perform health checks. We recommend that you enter the URL of a static web page. The URL must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), percent signs (%), question marks (?), number signs (#), and ampersands (&). The URL can also contain the following special characters: _ ; ~ ! ( ) * [ ] @ $ ^ : ' , +. The URL must start with a forward slash (/). +
  • +
  • By default, to perform health checks, the ALB instance sends HTTP HEAD requests to the default application homepage configured on the backend Elastic Compute Service (ECS) instance. The ALB instance sends the requests to the private IP address of the ECS instance. If you do not want to use the default application homepage for health checks, you must specify a path. +
  • +
+
alb.ingress.kubernetes.io/healthcheck-protocolOptional. The protocol used by health checks. +
    +
  • HTTP: The ALB instance sends HEAD or GET requests to a backend server to simulate access from a browser and check whether the backend server is healthy. This is the default protocol. +
  • +
  • TCP: The ALB instance sends TCP SYN packets to a backend server to check whether the port of the backend server is available to receive requests. +
  • +
  • GRPC: The ALB instance sends POST or GET requests to a backend server to check whether the backend server is healthy. +
  • +
+
alb.ingress.kubernetes.io/healthcheck-methodOptional. The request method used by health checks. +
    +
  • HEAD: By default, HTTP health checks send HEAD requests to a backend server. This is the default method. Make sure that your backend server supports HEAD requests. If your backend server does not support HEAD requests or HEAD requests are disabled, health checks may fail. In this case, you can use GET requests to perform health checks. +
  • +
  • POST: By default, gRPC health checks use the POST method. Make sure that your backend servers support POST requests. If your backend server does not support POST requests or POST requests are disabled, health checks may fail. In this case, you can use GET requests to perform health checks. +
  • +
  • GET: If the length of a response packet exceeds 8 KB, the response is truncated. However, the health check result is not affected. +
  • +
+
alb.ingress.kubernetes.io/healthcheck-httpcodeSpecify the status codes that are returned when health check results are normal. +
    +
  • When the health check protocol is set to HTTP, the valid values are http_2xx, http_3xx, http_4xx, and http_5xx. The default value for HTTP health checks is http_2xx. +
  • +
  • When the health check protocol is set to GRPC, valid values are 0 to 99. Value ranges are supported. You can enter at most 20 value ranges. Separate multiple value ranges with commas (,). +
  • +
+
alb.ingress.kubernetes.io/healthcheck-timeout-secondsSpecifies the timeout period of a health check. If a backend server does not respond within the specified timeout period, the server fails the health check. Valid values: 1 to 300. Default value: 5. Unit: seconds. +
alb.ingress.kubernetes.io/healthcheck-interval-secondsThe interval at which health checks are performed. Unit: seconds. Valid values: 1 to 50. Default value: 2. Unit: seconds. +
alb.ingress.kubernetes.io/healthy-threshold-countSpecifies the number of times that an unhealthy backend server must consecutively pass health checks before the server is considered healthy. Valid values: 2 to 10. Default value: 3. +
alb.ingress.kubernetes.io/unhealthy-threshold-countSpecifies the number of times that a healthy backend server must consecutively fail health checks before the server is considered unhealthy. Valid values: 2 to 10. Default value: 3. +
+ + +### Configure automatic certificate discovery + +The ALB Ingress controller supports automatic certificate discovery. You must first create a certificate in the SSL Certificates console. Then, specify the domain name of the certificate in the Transport Layer Security (TLS) configurations of the Ingress. This way, the ALB Ingress controller can automatically match and discover the certificate based on the TLS configurations of the Ingress. + +1. Configure automatic certificate discovery + ```bash + openssl genrsa -out albtop-key.pem 4096 + openssl req -subj "/CN=demo.alb.ingress.top" -sha256 -new -key albtop-key.pem -out albtop.csr + echo subjectAltName = DNS:demo.alb.ingress.top > extfile.cnf + openssl x509 -req -days 3650 -sha256 -in albtop.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out albtop-cert.pem -extfile extfile.cnf + ``` +2. Upload the certificate to the SSL Certificates console. For more information, see Upload certificates. +3. Add the following setting to the YAML template of the Ingress to specify the domain name in the created certificate: + ```yaml + tls: + - hosts: + - demo.alb.ingress.top + ``` + The following code block is an example: + ```yaml + --- + apiVersion: v1 + kind: Service + metadata: + name: demo-service-https + namespace: default + spec: + ports: + - name: port1 + port: 443 + protocol: TCP + targetPort: 8080 + selector: + app: demo-cafe + sessionAffinity: None + type: ClusterIP + + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: demo-cafe + namespace: default + spec: + replicas: 1 + selector: + matchLabels: + app: demo-cafe + template: + metadata: + labels: + app: demo-cafe + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo-cafe + ports: + - containerPort: 8080 + protocol: TCP + --- + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + kubernetes.io/ingress.class: alb + name: demo-https + namespace: default + spec: + tls: + - hosts: + - demo.alb.ingress.top + rules: + - host: demo.alb.ingress.top + http: + paths: + - backend: + serviceName: demo-service-https + servicePort: 443 + path: / + pathType: Prefix + ``` +4. Run the following command to query the certificate: + ```bash + curl https://demo.alb.ingress.top/tea + ``` + Expected output: + ```bash + {"hello":"tee"} + ``` + +### Redirect HTTP requests to HTTPS + +To redirect HTTP requests to HTTPS, you can add the alb.ingress.kubernetes.io/ssl-redirect: "true" annotation to the ALB Ingress configurations. This way, HTTP requests are redirected to HTTPS port 443. + +The following code block is an example: +```yaml +--- +apiVersion: v1 +kind: Service +metadata: + name: demo-service-ssl + namespace: default +spec: + ports: + - name: port1 + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: demo-ssl + sessionAffinity: None + type: ClusterIP + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: demo-ssl + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: demo-ssl + template: + metadata: + labels: + app: demo-ssl + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo-ssl + ports: + - containerPort: 8080 + protocol: TCP +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhasriop,vsw-k1amdv9ax94gr5iwamuwu" + alb.ingress.kubernetes.io/ssl-redirect: "true" + name: demo-ssl + namespace: default +spec: + tls: + - hosts: + - ssl.alb.ingress.top + rules: + - host: ssl.alb.ingress.top + http: + paths: + - backend: + serviceName: demo-service-ssl + servicePort: 80 + path: / + pathType: Prefix +``` +### Use annotations to implement canary releases + +ALB can handle complex traffic routing scenarios and support canary releases based on request headers, cookies, and weights. You can implement canary releases by adding annotations to Ingress configurations. To enable canary releases, you must add the nginx.ingress.kubernetes.io/canary: "true" annotation. This section describes how to use different annotations to implement canary releases. +``` +Note Canary releases that use different rules take effect in the following order: header-based > cookie-based > weight-based. +``` + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescriptionReference
alb.ingress.kubernetes.io/canary-by-header and alb.ingress.kubernetes.io/canary-by-header-valueTraffic splitting based on the value of the request header. This parameter must be used in combination with alb.ingress.kubernetes.io/canary-by-header. +
    +
  • If the header and header value of a request match the rule, the request is routed to the new application version. +
  • +
  • Requests whose header values do not match the rule are routed based on rules other than the request header values. +
  • +
+
If a request has location: hz specified, the request is routed to the new application version. Otherwise, the request is routed based on other rules other than the request header. +
+ +
+ +
+
apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  annotations:
+    kubernetes.io/ingress.class: alb
+    alb.ingress.kubernetes.io/albconfig.order: "1"
+    alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****"
+    alb.ingress.kubernetes.io/canary: "true"
+    alb.ingress.kubernetes.io/canary-by-header: "location"
+    alb.ingress.kubernetes.io/canary-by-header-value: "hz"
+ +
+
alb.ingress.kubernetes.io/canary-by-cookieTraffic splitting based on cookies: +
    +
  • If you set cookie to always, requests that match the rule are routed to the new application version. +
  • +
  • If you set cookie to never, requests that match the rule are routed to the old application version. +
  • +
+
Note: +
Cookie-based canary release does not support custom settings. The cookie value must be always or never. +
Requests with the demo=always cookie are routed to the new application version. +
+ +
+ +
+
apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  annotations:
+    kubernetes.io/ingress.class: alb
+    alb.ingress.kubernetes.io/albconfig.order: "2"
+    alb.ingress.kubernetes.io/address-type: internet
+    alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****"
+    alb.ingress.kubernetes.io/canary: "true"
+    alb.ingress.kubernetes.io/canary-by-cookie: "demo"
+ +
+
alb.ingress.kubernetes.io/canary-weightTraffic splitting based on weights. The weight is a percentage value that ranges from 0 to 100. + The following template specifies that 50% of the traffic is routed to the new application version. +
+ +
+ +
+
apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  annotations:
+    kubernetes.io/ingress.class: alb
+    alb.ingress.kubernetes.io/albconfig.order: "3"
+    alb.ingress.kubernetes.io/address-type: internet
+    alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****"
+    alb.ingress.kubernetes.io/canary: "true"
+    alb.ingress.kubernetes.io/canary-weight: "50"
+ +
+
\ No newline at end of file diff --git a/docs/zh/usage-alb.md b/docs/zh/usage-alb.md new file mode 100644 index 000000000..3440526db --- /dev/null +++ b/docs/zh/usage-alb.md @@ -0,0 +1,949 @@ +# Cloud Provider 帮助文档(中文版) + +# 通过应用型负载均衡(Application Load Balancer)Ingress 访问服务 + +ALB Ingress基于阿里云应用型负载均衡ALB(Application Load Balancer) 实现的Ingress服务,适用于有明显波峰波谷的业务场景。本文介绍如何在ACK集群中使用ALB Ingress访问服务。 +详细信息请参考官方文档:[通过ALB Ingress访问服务](https://help.aliyun.com/document_detail/314614.html) + +## 背景信息 + +Ingress是允许访问集群内Service的规则集合,您可以通过配置转发规则,实现不同URL访问集群内不同的Service。但传统的Nginx Ingress或者四层SLB Ingress,已无法满足云原生应用服务对复杂业务路由、多种应用层协议(例如:QUIC等)、大规模七层流量能力的需求。 + +## 应用型负载均衡相关信息 + +- 应用型负载均衡介绍参见[什么是应用型负载均衡ALB](https://help.aliyun.com/document_detail/197202.html) +- 应用型负载均衡版本功能对比和使用限制参见[版本功能对比和使用限制](https://help.aliyun.com/document_detail/197204.html?spm=5176.20310575.help.dexternal.13e31eb9CcVMMQ) +- 应用型负载均衡支持的地域与可用区参见[支持的地域与可用区](https://help.aliyun.com/document_detail/258300.html) + +## 配置Albconfig + +Albconfig是由ALB Ingress Controller提供的CRD资源,ALB Ingress Controller使用Albconfig来配置ALB实例和监听。本节介绍如何创建、修改Albconfig以及开启日志服务等操作。 + +### 背景信息 +ALB Ingress Controller通过API Server获取Ingress资源的变化,动态地生成Albconfig,然后依次创建ALB实例、监听、路由转发规则以及后端服务器组。Kubernetes中Service、Ingress与Albconfig有着以下关系: + +- Service是后端真实服务的抽象,一个Service可以代表多个相同的后端服务。 +- Ingress是反向代理规则,用来规定HTTP/HTTPS请求应该被转发到哪个Service上。例如:根据请求中不同的Host和URL路径,让请求转发到不同的Service上。 +- Albconfig是在ALB Ingress Controller提供的CRD资源,使用ALBConfig CRD来配置ALB实例和监听。一个Albconfig对应一个ALB实例。 +- 一个Albconfig对应一个ALB实例,如果一个ALB实例配置多个转发规则,那么一个Albconfig则对应多个Ingress,所以Albconfig与Ingress是一对多的对应关系。 + +### 创建Albconfig + +创建Ingress时,会默认在kube-system命名空间下创建名称为default的Albconfig,无需您手动创建。 + +1. 部署以下模板,创建Ingress和Albconfig。 + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + name: cafe-ingress + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + spec: + rules: + - http: + paths: + # 配置Context Path + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + # 配置Context Path + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 + ``` +2. 执行以下命令,查看Albconfig名称。 + ```bash + kubectl -n kube-system get albconfig + ``` + 预期输出: + ```bash + NAME AGE + default 87m + ``` + Albconfig默认配置的内容如下: + ```yaml + apiVersion: alibabacloud.com/v1 + kind: AlbConfig + metadata: + name: default #Albconfig名称。 + namespace: kube-system #Albconfig所属命名空间。 + spec: + config: + accessLogConfig: + logProject: "" + logStore: "" + addressAllocatedMode: Dynamic + addressType: Internet + billingConfig: + internetBandwidth: 0 + internetChargeType: "" + payType: PostPay + deletionProtectionEnabled: true + edition: Standard + forceOverride: false + zoneMappings: + - vSwitchId: vsw-wz92lvykqj1siwvif**** #Albconfig的vSwitch,Albconfig需要配置两个vSwitch。 + - vSwitchId: vsw-wz9mnucx78c7i6iog**** #Albconfig的vSwitch。 + status: + loadBalancer: + dnsname: alb-s2em8fr9debkg5****.cn-shenzhen.alb.aliyuncs.com + id: alb-s2em8fr9debkg5**** + ``` +### 修改Albconfig的名称 +如果您需要修改Albconfig的名称,可以执行以下命令。保存之后,新名称自动生效。 +```bash +kubectl -n kube-system edit albconfig default +... + spec: + config: + name: basic #输入修改后的名称。 +... +``` +### 修改Albconfig的vSwitch配置 +如果您需要修改Albconfig的vSwitch配置。保存之后,新配置自动生效。 +```bash +kubectl -n kube-system edit albconfig default +... + zoneMappings: + - vSwitchId: vsw-wz92lvykqj1siwvif**** + - vSwitchId: vsw-wz9mnucx78c7i6iog**** +... +``` +### 开启日志服务访问日志 +如果您希望ALB Ingress能够收集访问日志Access Log,则只需要在AlbConfig中指定logProject和logStore。 +```yaml +apiVersion: alibabacloud.com/v1 +kind: AlbConfig +metadata: + name: default + namespace: kube-system +spec: + config: + accessLogConfig: + logProject: "k8s-log-xz92lvykqj1siwvif****" + logStore: "alb_xxx" + ... +``` +``` +说明: logStore命名需要以alb_开头,若指定logStore不存在,系统则会自动创建。保存命令之后,可以在日志服务控制台,单击目标Logstore,查看收集的访问日志。 +``` +### 删除ALB实例 +一个ALB实例对应一个Albconfig, 因此可以通过删除Albconfig实现删除ALB实例,但前提是先需要删除Albconfig关联的所有Ingress。 +```bash +kubectl -n kube-system delete albconfig default +``` +default可以替换为您实际需要删除的Albconfig。 + +## 通过ALB Ingress访问服务 + +本节介绍如何在ACK集群中使用ALB Ingress访问服务。 + +### 注意事项 + +如果您使用的是Flannel网络插件,则ALB Ingress后端Service服务仅支持NodePort和LoadBalancer类型。 + +### 步骤一:部署服务 + +1. 创建并拷贝以下内容到cafe-service.yaml文件中,用于部署两个名称分别为coffee和tea的Deployment,以及两个名称分别为coffee和tea的Service。 + ```yaml + apiVersion: apps/v1 + kind: Deployment + metadata: + name: coffee + spec: + replicas: 2 + selector: + matchLabels: + app: coffee + template: + metadata: + labels: + app: coffee + spec: + containers: + - name: coffee + image: registry.cn-hangzhou.aliyuncs.com/acs-sample/nginxdemos:latest + ports: + - containerPort: 80 + --- + apiVersion: v1 + kind: Service + metadata: + name: coffee-svc + spec: + ports: + - port: 80 + targetPort: 80 + protocol: TCP + selector: + app: coffee + type: NodePort + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: tea + spec: + replicas: 1 + selector: + matchLabels: + app: tea + template: + metadata: + labels: + app: tea + spec: + containers: + - name: tea + image: registry.cn-hangzhou.aliyuncs.com/acs-sample/nginxdemos:latest + ports: + - containerPort: 80 + --- + apiVersion: v1 + kind: Service + metadata: + name: tea-svc + labels: + spec: + ports: + - port: 80 + targetPort: 80 + protocol: TCP + selector: + app: tea + type: NodePort + ``` +2. 执行以下命令,部署两个Deployment和两个Service。 + ```bash + kubectl apply -f cafe-service.yaml + ``` + 预期输出: + ```bash + deployment "coffee" created + service "coffee-svc" created + deployment "tea" created + service "tea-svc" created + ``` +3. 执行以下命令,查看服务状态。 + ```bash + kubectl get svc,deploy + ``` + 预期输出: + ```bash + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE + coffee-svc NodePort 172.16.231.169 80:31124/TCP 6s + tea-svc NodePort 172.16.38.182 80:32174/TCP 5s + NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE + deploy/coffee 2 2 2 2 1m + deploy/tea 1 1 1 1 1m + ``` + +### 步骤二:配置Ingress + +1. 创建并拷贝以下内容到cafe-ingress.yaml文件中。 + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + name: cafe-ingress + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/name: ingress_test_base + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + spec: + rules: + - http: + paths: + # 配置Context Path。 + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + # 配置Context Path。 + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 + ``` + 相关参数解释如下表所示: + + + + + + + + + + + + + + + + + + + + + +
参数说明
(可选)alb.ingress.kubernetes.io/name表示ALB实例名称。
(可选)alb.ingress.kubernetes.io/address-type表示负载均衡的地址类型。取值如下: +
    +
  • Internet(默认值):负载均衡具有公网IP地址,DNS域名被解析到公网IP,因此可以在公网环境访问。
  • +
  • Intranet:负载均衡只有私网IP地址,DNS域名被解析到私网IP,因此只能被负载均衡所在VPC的内网环境访问。
  • +
+
(必选)alb.ingress.kubernetes.io/vswitch-ids用于设置ALB Ingress交换机ID,您需要至少指定两个不同可用区交换机ID。关于ALB Ingress支持的地域与可用区,请参见支持的地域与可用区。 +
+ +2. 执行以下命令,配置coffee和tea服务对外暴露的域名和path路径。 + ```bash + kubectl apply -f cafe-ingress.yaml + ``` + 预期输出: + ```bash + ingress "cafe-ingress" created + ``` +3. 执行以下命令获取ALB实例IP地址。 + ```bash + kubectl get ing + ``` + 预期输出: + ``` + NAME CLASS HOSTS ADDRESS PORTS AGE + cafe-ingress * alb-m551oo2zn63yov****.cn-hangzhou.alb.aliyuncs.com 80 50s + ``` + +### 步骤三:访问服务 +- 利用获取的ALB实例IP地址访问coffee服务: + ```bash + curl http://alb-m551oo2zn63yov****.cn-hangzhou.alb.aliyuncs.com/coffee + ``` +- 利用获取的ALB实例IP地址访问tea服务: + ```bash + curl http://alb-m551oo2zn63yov****.cn-hangzhou.alb.aliyuncs.com/tea + ``` + +## ALB Ingress服务高级用法 + +在Kubernetes集群中,ALB Ingress对集群服务(Service)中外部可访问的API对象进行管理,提供七层负载均衡能力。本文介绍如何使用ALB Ingress将来自不同域名或URL路径的请求转发给不同的后端服务器组、将HTTP访问重定向至HTTPS及实现灰度发布等功能。 + +### 基于域名转发请求 +通过以下命令创建一个简单的Ingress,根据指定的正常域名或空域名转发请求。 +- 基于正常域名转发请求的示例如下: + 1. 部署以下模板,分别创建Service、Deployment和Ingress,将访问请求通过Ingress的域名转发至Service。 + ```yaml + apiVersion: v1 + kind: Service + metadata: + name: demo-service + namespace: default + spec: + ports: + - name: port1 + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: demo + sessionAffinity: None + type: NodePort + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: demo + namespace: default + spec: + replicas: 1 + selector: + matchLabels: + app: demo + template: + metadata: + labels: + app: demo + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo + ports: + - containerPort: 8080 + protocol: TCP + --- + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo + namespace: default + spec: + rules: + - host: demo.domain.ingress.top + http: + paths: + - backend: + serviceName: demo-service + servicePort: 80 + path: /hello + pathType: ImplementationSpecific + ``` + 2. 执行以下命令,通过指定的正常域名访问服务。 + + 替换ADDRESS为ALB实例对应的域名地址,可通过kubectl get ing获取。 + ```bash + curl -H "host: demo.domain.ingress.top"
/hello + ``` + 预期输出 + ```bash + {"hello":"coffee"} + ``` + +- 基于空域名转发请求的示例如下: + 1. 部署以下模板,创建Ingress。 + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo + namespace: default + spec: + rules: + - host: "" + http: + paths: + - backend: + serviceName: demo-service + servicePort: 80 + path: /hello + pathType: ImplementationSpecific + ``` + 2. 执行以下命令,通过空域名访问服务。 + + 替换ADDRESS为ALB实例对应的域名地址,可通过kubectl get ing获取。 + ```bash + curl
/hello + ``` + 预期输出: + ```bash + {"hello":"coffee"} + ``` + +### 基于URL路径转发请求 + +ALB Ingress支持按照URL转发请求,可以通过pathType字段设置不同的URL匹配策略。pathType支持Exact、ImplementationSpecific和Prefix三种匹配方式。 + +三种匹配方式的示例如下: +- Exact:以区分大小写的方式精确匹配URL路径。 + 1. 部署以下模板,创建Ingress。 + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path + namespace: default + spec: + rules: + - http: + paths: + - path: /hello + backend: + serviceName: demo-service + servicePort: 80 + pathType: Exact + ``` + 2. 执行以下命令,访问服务。 + + 替换ADDRESS为ALB实例对应的域名地址,可通过kubectl get ing获取。 + ```bash + curl
/hello + ``` + 预期输出: + ```bash + {"hello":"coffee"} + ``` +- ImplementationSpecific:缺省。在ALB Ingress中与Exact做相同处理,但两者Ingress Controller的实现方式不一样。 + 1. 部署以下模板,创建Ingress。 + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path + namespace: default + spec: + rules: + - http: + paths: + - path: /hello + backend: + serviceName: demo-service + servicePort: 80 + pathType: ImplementationSpecific + ``` + 2. 执行以下命令,访问服务。 + + 替换ADDRESS为ALB实例对应的域名地址,可通过kubectl get ing获取。 + ```bash + curl
/hello + ``` + 预期输出: + ```bash + {"hello":"coffee"} + ``` +- Prefix:以/分隔的URL路径进行前缀匹配。匹配区分大小写,并且对路径中的元素逐个完成匹配。 + 1. 部署以下模板,创建Ingress。 + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path-prefix + namespace: default + spec: + rules: + - http: + paths: + - path: / + backend: + serviceName: demo-service + servicePort: 80 + pathType: Prefix + ``` + 2. 执行以下命令,访问服务。 + + 替换ADDRESS为ALB实例对应的域名地址,可通过kubectl get ing获取。 + ```bash + curl
/hello + ``` + 预期输出: + ```bash + {"hello":"coffee"} + ``` + +### 配置健康检查 + +ALB Ingress支持配置健康检查,可以通过设置以下注解实现。 + +配置健康检查的YAML示例如下所示: + +```yaml +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: cafe-ingress + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + alb.ingress.kubernetes.io/healthcheck-enabled: "true" + alb.ingress.kubernetes.io/healthcheck-path: "/" + alb.ingress.kubernetes.io/healthcheck-protocol: "HTTP" + alb.ingress.kubernetes.io/healthcheck-method: "HEAD" + alb.ingress.kubernetes.io/healthcheck-httpcode: "http_2xx" + alb.ingress.kubernetes.io/healthcheck-timeout-seconds: "5" + alb.ingress.kubernetes.io/healthcheck-interval-seconds: "2" + alb.ingress.kubernetes.io/healthy-threshold-count: "3" + alb.ingress.kubernetes.io/unhealthy-threshold-count: "3" +spec: + rules: + - http: + paths: + # 配置Context Path。 + - path: /tea + backend: + serviceName: tea-svc + servicePort: 80 + # 配置Context Path。 + - path: /coffee + backend: + serviceName: coffee-svc + servicePort: 80 +``` + +相关参数解释如下表所示。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
参数说明
alb.ingress.kubernetes.io/healthcheck-enabled(可选)表示是否开启健康检查。默认开启(true)。 +
alb.ingress.kubernetes.io/healthcheck-path(可选)表示健康检查路径。默认/。 +
    +
  • 输入健康检查页面的URL,建议对静态页面进行检查。长度限制为1~80个字符,支持使用字母、数字和短划线(-)、正斜线(/)、半角句号(.)、百分号(%)、半角问号(?)、井号(#)和and(&)以及扩展字符集_;~!()*[]@$^:',+。URL必须以正斜线(/)开头。
  • +
  • HTTP健康检查默认由负载均衡系统通过后端ECS内网IP地址向该服务器应用配置的默认首页发起HTTP Head请求。如果您用来进行健康检查的页面并不是应用服务器的默认首页,需要指定具体的检查路径。
  • +
+
alb.ingress.kubernetes.io/healthcheck-protocol(可选)表示健康检查协议。 +
    +
  • HTTP(默认):通过发送HEAD或GET请求模拟浏览器的访问行为来检查服务器应用是否健康。 +
  • +
  • TCP:通过发送SYN握手报文来检测服务器端口是否存活。 +
  • +
  • GRPC:通过发送POST或GET请求来检查服务器应用是否健康。 +
  • +
+
alb.ingress.kubernetes.io/healthcheck-method(可选)选择一种健康检查方法。 +
    +
  • HEAD(默认):HTTP监听健康检查默认采用HEAD方法。请确保您的后端服务器支持HEAD请求。如果您的后端应用服务器不支持HEAD方法或HEAD方法被禁用,则可能会出现健康检查失败,此时可以使用GET方法来进行健康检查。 +
  • +
  • POST:GRPC监听健康检查默认采用POST方法。请确保您的后端服务器支持POST请求。如果您的后端应用服务器不支持POST方法或POST方法被禁用,则可能会出现健康检查失败,此时可以使用GET方法来进行健康检查。 +
  • +
  • GET:如果响应报文长度超过8 KB,会被截断,但不会影响健康检查结果的判定。 +
  • +
+
alb.ingress.kubernetes.io/healthcheck-httpcode设置健康检查正常的状态码。 +
    +
  • 当健康检查协议为HTTP协议时,可以选择http_2xx(默认)、http_3xxhttp_4xxhttp_5xx。 +
  • +
  • 当健康检查协议为GRPC协议时,状态码范围为0~99。支持范围输入,最多支持20个范围值,多个范围值使用半角逗号(,)隔开。 +
  • +
+
alb.ingress.kubernetes.io/healthcheck-timeout-seconds表示接收健康检查的响应需要等待的时间。如果后端ECS在指定的时间内没有正确响应,则判定为健康检查失败。时间范围为1~300秒,默认值为5秒。
alb.ingress.kubernetes.io/healthcheck-interval-seconds健康检查的时间间隔。取值范围1~50秒,默认为2秒。
alb.ingress.kubernetes.io/healthy-threshold-count表示健康检查连续成功所设置的次数后会将后端服务器的健康检查状态由失败判定为成功。取值范围2~10,默认为3次。
alb.ingress.kubernetes.io/unhealthy-threshold-count表示健康检查连续失败所设置的次数后会将后端服务器的健康检查状态由成功判定为失败。取值范围2~10,默认为3次。
+ +### 配置自动发现HTTPS证书功能 + +ALB Ingress Controller提供证书自动发现功能。您需要首先在SSL证书控制台创建证书,然后ALB Ingress Controller会根据Ingress中TLS配置的域名自动匹配发现证书。 + +1. 执行以下命令,通过openssl创建证书。 + ```bash + openssl genrsa -out albtop-key.pem 4096 + openssl req -subj "/CN=demo.alb.ingress.top" -sha256 -new -key albtop-key.pem -out albtop.csr + echo subjectAltName = DNS:demo.alb.ingress.top > extfile.cnf + openssl x509 -req -days 3650 -sha256 -in albtop.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out albtop-cert.pem -extfile extfile.cnf + ``` +2. 在SSL证书控制台上传证书。具体操作,请参见上传证书。 +3. 在Ingress的YAML中添加以下命令,配置该证书对应的域名。 + ```yaml + tls: + - hosts: + - demo.alb.ingress.top + ``` + 示例如下: + ```yaml + --- + apiVersion: v1 + kind: Service + metadata: + name: demo-service-https + namespace: default + spec: + ports: + - name: port1 + port: 443 + protocol: TCP + targetPort: 8080 + selector: + app: demo-cafe + sessionAffinity: None + type: NodePort + + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: demo-cafe + namespace: default + spec: + replicas: 1 + selector: + matchLabels: + app: demo-cafe + template: + metadata: + labels: + app: demo-cafe + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo-cafe + ports: + - containerPort: 8080 + protocol: TCP + --- + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + kubernetes.io/ingress.class: alb + name: demo-https + namespace: default + spec: + #配置证书对应的域名。 + tls: + - hosts: + - demo.alb.ingress.top + rules: + - host: demo.alb.ingress.top + http: + paths: + - backend: + serviceName: demo-service-https + servicePort: 443 + path: / + pathType: Prefix + ``` +4. 执行以下命令,查看证书。 + ```bash + curl https://demo.alb.ingress.top/tea + ``` + 预期输出: + ```bash + {"hello":"tee"} + ``` + +### 配置HTTP重定向至HTTPS + +ALB Ingress通过设置注解alb.ingress.kubernetes.io/ssl-redirect: "true",可以将HTTP请求重定向到HTTPS 443端口。 + +配置示例如下: + +```yaml +--- +apiVersion: v1 +kind: Service +metadata: + name: demo-service-ssl + namespace: default +spec: + ports: + - name: port1 + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: demo-ssl + sessionAffinity: None + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: demo-ssl + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: demo-ssl + template: + metadata: + labels: + app: demo-ssl + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo-ssl + ports: + - containerPort: 8080 + protocol: TCP +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****" + alb.ingress.kubernetes.io/ssl-redirect: "true" + name: demo-ssl + namespace: default +spec: + tls: + - hosts: + - ssl.alb.ingress.top + rules: + - host: ssl.alb.ingress.top + http: + paths: + - backend: + serviceName: demo-service-ssl + servicePort: 80 + path: / + pathType: Prefix +``` + +### 通过注解实现灰度发布 + +ALB提供复杂路由处理能力,支持基于Header、Cookie以及权重的灰度发布功能。灰度发布功能可以通过设置注解来实现,为了启用灰度发布功能,需要设置注解alb.ingress.kubernetes.io/canary: "true",通过不同注解可以实现不同的灰度发布功能。 +``` +说明: 灰度优先级顺序:基于Header>基于Cookie>基于权重(从高到低)。 +``` + + + + + + + + + + + + + + + + + + + + + + + + + +
参数说明示例
alb.ingress.kubernetes.io/canary-by-headeralb.ingress.kubernetes.io/canary-by-header-value匹配的Request Header的值,该规则允许您自定义Request Header的值,但必须与alb.ingress.kubernetes.io/canary-by-header一起使用。 +
    +
  • 当请求中的headerheader-value与设置的值匹配时,请求流量会被分配到灰度服务入口。 +
  • +
  • 对于其他header值,将会忽略header,并通过灰度优先级将请求流量分配到其他规则设置的灰度服务。 +
  • +
+
当请求Header为location: hz时将访问灰度服务;其它Header将根据灰度权重将流量分配给灰度服务。 +
+ +
+ +
+
apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  annotations:
+    kubernetes.io/ingress.class: alb
+    alb.ingress.kubernetes.io/albconfig.order: "1"
+    alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****"
+    alb.ingress.kubernetes.io/canary: "true"
+    alb.ingress.kubernetes.io/canary-by-header: "location"
+    alb.ingress.kubernetes.io/canary-by-header-value: "hz"
+ +
+
alb.ingress.kubernetes.io/canary-by-cookie基于Cookie的流量切分: +
    +
  • 当配置的cookie值为always时,请求流量将被分配到灰度服务入口。 +
  • +
  • 当配置的cookie值为never时,请求流量将不会分配到灰度服务入口。 +
  • +
+
+
+
说明 基于Cookie的灰度不支持设置自定义,只有alwaysnever。 +
+
+
请求的Cookie为demo=always时将访问灰度服务。 +
+ +
+ +
+
apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  annotations:
+    kubernetes.io/ingress.class: alb
+    alb.ingress.kubernetes.io/albconfig.order: "2"
+    alb.ingress.kubernetes.io/address-type: internet
+    alb.ingress.kubernetes.io/vswitch-ids: "vsw-k1akdsmts6njkvhas****,vsw-k1amdv9ax94gr5iwa****"
+    alb.ingress.kubernetes.io/canary: "true"
+    alb.ingress.kubernetes.io/canary-by-cookie: "demo"
+ +
+
alb.ingress.kubernetes.io/canary-weight设置请求到指定服务的百分比(值为0~100的整数)。配置灰度服务的权重为50%。 +
+ +
+ +
+
apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  annotations:
+    kubernetes.io/ingress.class: alb
+    alb.ingress.kubernetes.io/albconfig.order: "3"
+    alb.ingress.kubernetes.io/address-type: internet
+    alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****"
+    alb.ingress.kubernetes.io/canary: "true"
+    alb.ingress.kubernetes.io/canary-weight: "50"
+ +
+
+ + + diff --git a/go.mod b/go.mod index 02dbb116c..0ec324d2b 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,11 @@ go 1.16 require ( github.com/aliyun/alibaba-cloud-sdk-go v1.61.1240 + github.com/eapache/channels v1.1.0 github.com/ghodss/yaml v1.0.0 github.com/go-cmd/cmd v1.2.1 github.com/go-logr/logr v0.4.0 + github.com/google/go-cmp v0.5.5 github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb github.com/onsi/ginkgo v1.16.4 github.com/onsi/gomega v1.15.0 @@ -28,6 +30,7 @@ require ( k8s.io/klog v1.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/kubernetes v1.22.3 + k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a sigs.k8s.io/controller-runtime v0.10.3 ) diff --git a/pkg/apis/alibabacloud/v1/albconfig_types.go b/pkg/apis/alibabacloud/v1/albconfig_types.go new file mode 100644 index 000000000..a8f9d4a57 --- /dev/null +++ b/pkg/apis/alibabacloud/v1/albconfig_types.go @@ -0,0 +1,208 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +func init() { + SchemeBuilder.Register(&AlbConfig{}, &AlbConfigList{}) +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AlbConfig is a collection of rules that allow inbound connections to reach the +// endpoints defined by a backend. An AlbConfig can be configured to give services +// externally-reachable urls, load balance traffic, terminate SSL, offer name +// based virtual hosting etc. +type AlbConfig struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec is the desired state of the Gateway. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +optional + Spec AlbConfigSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // Status is the current state of the Gateway. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +optional + Status IngressStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// LoadBalancerStatus represents the status of a load-balancer. +type LoadBalancerStatus struct { + DNSName string `json:"dnsname,omitempty" protobuf:"bytes,1,opt,name=dnsname"` + Id string `json:"id,omitempty" protobuf:"bytes,2,opt,name=id"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AlbConfigList is a collection of AlbConfig. +type AlbConfigList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of Gateway. + Items []AlbConfig `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// AlbConfigSpec describes the AlbConfig the user wishes to exist. +type AlbConfigSpec struct { + LoadBalancer *LoadBalancerSpec `json:"config" protobuf:"bytes,1,rep,name=config"` + Listeners []*ListenerSpec `json:"listeners" protobuf:"bytes,2,rep,name=listeners"` +} + +// IngressStatus describe the current state of the AckIngress. +type IngressStatus struct { + // LoadBalancer contains the current status of the load-balancer. + // +optional + LoadBalancer LoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"` +} + +// LoadBalancer is a nested struct in alb response +type LoadBalancerSpec struct { + Id string `json:"id" protobuf:"bytes,1,opt,name=id"` + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + AddressAllocatedMode string `json:"addressAllocatedMode" protobuf:"bytes,2,opt,name=addressAllocatedMode"` + AddressType string `json:"addressType" protobuf:"bytes,3,opt,name=addressType"` + ResourceGroupId string `json:"resourceGroupId" protobuf:"bytes,4,opt,name=resourceGroupId"` + Edition string `json:"edition" protobuf:"bytes,5,opt,name=edition"` + ZoneMappings []ZoneMapping `json:"zoneMappings" protobuf:"bytes,6,rep,name=zoneMappings"` + AccessLogConfig AccessLogConfig `json:"accessLogConfig" protobuf:"bytes,7,opt,name=accessLogConfig"` + DeletionProtectionEnabled *bool `json:"deletionProtectionEnabled" protobuf:"bytes,8,opt,name=deletionProtectionEnabled"` + BillingConfig BillingConfig `json:"billingConfig" protobuf:"bytes,9,opt,name=billingConfig"` + ForceOverride *bool `json:"forceOverride" protobuf:"bytes,8,opt,name=forceOverride"` + ModificationProtectionConfig ModificationProtectionConfig `json:"modificationProtectionConfig" protobuf:"bytes,10,opt,name=modificationProtectionConfig"` +} + +// ZoneMapping is a nested struct in alb response +type ZoneMapping struct { + VSwitchId string `json:"vSwitchId" protobuf:"bytes,1,opt,name=vSwitchId"` + ZoneId string `json:"zoneId" protobuf:"bytes,2,opt,name=zoneId"` +} + +type AccessLogConfig struct { + LogStore string `json:"logStore" protobuf:"bytes,1,opt,name=logStore"` + LogProject string `json:"logProject" protobuf:"bytes,2,opt,name=logProject"` +} +type DeletionProtectionConfig struct { + Enabled bool `json:"enabled" protobuf:"bytes,1,opt,name=enabled"` + EnabledTime string `json:"enabledTime" protobuf:"bytes,2,opt,name=enabledTime"` +} +type BillingConfig struct { + InternetBandwidth int `json:"internetBandwidth" protobuf:"bytes,1,opt,name=internetBandwidth"` + InternetChargeType string `json:"internetChargeType" protobuf:"bytes,2,opt,name=internetChargeType"` + PayType string `json:"payType" protobuf:"bytes,3,opt,name=payType"` +} +type ModificationProtectionConfig struct { + Reason string `json:"reason" protobuf:"bytes,1,opt,name=reason"` + Status string `json:"status" protobuf:"bytes,2,opt,name=status"` +} + +type Certificate struct { + IsDefault bool `json:"IsDefault" protobuf:"bytes,1,opt,name=IsDefault"` + CertificateId string `json:"CertificateId" protobuf:"bytes,2,opt,name=CertificateId"` +} + +type QuicConfig struct { + QuicUpgradeEnabled bool `json:"quicUpgradeEnabled" protobuf:"bytes,1,opt,name=quicUpgradeEnabled"` + QuicListenerId string `json:"quicListenerId" protobuf:"bytes,2,opt,name=quicListenerId"` +} + +type XForwardedForConfig struct { + XForwardedForClientCertSubjectDNAlias string `json:"XForwardedForClientCertSubjectDNAlias" protobuf:"bytes,1,opt,name=XForwardedForClientCertSubjectDNAlias"` + XForwardedForClientCertSubjectDNEnabled bool `json:"XForwardedForClientCertSubjectDNEnabled" protobuf:"bytes,2,opt,name=XForwardedForClientCertSubjectDNEnabled"` + XForwardedForProtoEnabled bool `json:"XForwardedForProtoEnabled" protobuf:"bytes,3,opt,name=XForwardedForProtoEnabled"` + XForwardedForClientCertIssuerDNEnabled bool `json:"XForwardedForClientCertIssuerDNEnabled" protobuf:"bytes,4,opt,name=XForwardedForClientCertIssuerDNEnabled"` + XForwardedForSLBIdEnabled bool `json:"XForwardedForSLBIdEnabled" protobuf:"bytes,5,opt,name=XForwardedForSLBIdEnabled"` + XForwardedForClientSrcPortEnabled bool `json:"XForwardedForClientSrcPortEnabled" protobuf:"bytes,6,opt,name=XForwardedForClientSrcPortEnabled"` + XForwardedForClientCertFingerprintEnabled bool `json:"XForwardedForClientCertFingerprintEnabled" protobuf:"bytes,7,opt,name=XForwardedForClientCertFingerprintEnabled"` + XForwardedForEnabled bool `json:"XForwardedForEnabled" protobuf:"bytes,8,opt,name=XForwardedForEnabled"` + XForwardedForSLBPortEnabled bool `json:"XForwardedForSLBPortEnabled" protobuf:"bytes,9,opt,name=XForwardedForSLBPortEnabled"` + XForwardedForClientCertClientVerifyAlias string `json:"XForwardedForClientCertClientVerifyAlias" protobuf:"bytes,10,opt,name=XForwardedForClientCertClientVerifyAlias"` + XForwardedForClientCertIssuerDNAlias string `json:"XForwardedForClientCertIssuerDNAlias" protobuf:"bytes,11,opt,name=XForwardedForClientCertIssuerDNAlias"` + XForwardedForClientCertFingerprintAlias string `json:"XForwardedForClientCertFingerprintAlias" protobuf:"bytes,12,opt,name=XForwardedForClientCertFingerprintAlias"` + XForwardedForClientCertClientVerifyEnabled bool `json:"XForwardedForClientCertClientVerifyEnabled" protobuf:"bytes,13,opt,name=XForwardedForClientCertClientVerifyEnabled"` +} + +type AccessLogTracingConfig struct { + TracingSample int `json:"tracingSample" protobuf:"bytes,1,opt,name=tracingSample"` + TracingType string `json:"tracingType" protobuf:"bytes,2,opt,name=tracingType"` + TracingEnabled bool `json:"tracingEnabled" protobuf:"bytes,3,opt,name=tracingEnabled"` +} + +type LogConfig struct { + AccessLogRecordCustomizedHeadersEnabled bool `json:"accessLogRecordCustomizedHeadersEnabled" protobuf:"bytes,1,opt,name=accessLogRecordCustomizedHeadersEnabled"` + AccessLogTracingConfig AccessLogTracingConfig `json:"accessLogTracingConfig" protobuf:"bytes,2,opt,name=accessLogTracingConfig"` +} + +type ListenerSpec struct { + GzipEnabled *bool `json:"gzipEnabled" protobuf:"bytes,1,opt,name=gzipEnabled"` + QuicConfig QuicConfig `json:"quicConfig" protobuf:"bytes,2,opt,name=quicConfig"` + Http2Enabled *bool `json:"http2Enabled" protobuf:"bytes,3,opt,name=http2Enabled"` + DefaultActions []Action `json:"defaultActions" protobuf:"bytes,4,opt,name=defaultActions"` + Port intstr.IntOrString `json:"port" protobuf:"bytes,5,opt,name=port"` + CaCertificates []Certificate `json:"caCertificates" protobuf:"bytes,6,opt,name=caCertificates"` + XForwardedForConfig XForwardedForConfig `json:"xForwardedForConfig" protobuf:"bytes,7,opt,name=xForwardedForConfig"` + Protocol string `json:"protocol" protobuf:"bytes,8,opt,name=protocol"` + SecurityPolicyId string `json:"securityPolicyId" protobuf:"bytes,9,opt,name=securityPolicyId"` + IdleTimeout int `json:"idleTimeout" protobuf:"bytes,10,opt,name=idleTimeout"` + LoadBalancerId string `json:"loadBalancerId" protobuf:"bytes,11,opt,name=loadBalancerId"` + Certificates []Certificate `json:"certificates" protobuf:"bytes,12,opt,name=certificates"` + Description string `json:"description" protobuf:"bytes,13,opt,name=description"` + CaEnabled bool `json:"caEnabled" protobuf:"bytes,14,opt,name=caEnabled"` + LogConfig LogConfig `json:"logConfig" protobuf:"bytes,15,opt,name=logConfig"` + RequestTimeout int `json:"requestTimeout" protobuf:"bytes,16,opt,name=requestTimeout"` +} +type Action struct { + Type string `json:"actionType" protobuf:"bytes,1,opt,name=actionType"` + + FixedResponseConfig *FixedResponseActionConfig `json:"fixedResponseConfig,omitempty" protobuf:"bytes,2,opt,name=fixedResponseConfig"` + + RedirectConfig *RedirectActionConfig `json:"redirectConfig,omitempty" protobuf:"bytes,3,opt,name=redirectConfig"` + + ForwardConfig *ForwardActionConfig `json:"forwardConfig,omitempty" protobuf:"bytes,4,opt,name=forwardConfig"` +} + +type TargetGroupTuple struct { + TargetGroupARN string `json:"targetGroupARN" protobuf:"bytes,1,opt,name=targetGroupARN"` + + ServiceName string `json:"serviceName" protobuf:"bytes,2,opt,name=serviceName"` + + ServicePort intstr.IntOrString `json:"servicePort" protobuf:"bytes,3,opt,name=servicePort"` + + Weight int `json:"weight,omitempty" protobuf:"bytes,4,opt,name=weight"` +} + +type ForwardActionConfig struct { + TargetGroups []TargetGroupTuple `json:"targetGroups" protobuf:"bytes,1,opt,name=targetGroups"` +} +type FixedResponseActionConfig struct { + ContentType string `json:"contentType,omitempty" protobuf:"bytes,1,opt,name=contentType"` + + MessageBody string `json:"messageBody,omitempty" protobuf:"bytes,2,opt,name=messageBody"` + + StatusCode string `json:"statusCode" protobuf:"bytes,3,opt,name=statusCode"` +} + +type RedirectActionConfig struct { + Host string `json:"host,omitempty" protobuf:"bytes,1,opt,name=host"` + + Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"` + + Port string `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"` + + Protocol string `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol"` + + Query string `json:"query,omitempty" protobuf:"bytes,5,opt,name=query"` + + StatusCode string `json:"statusCode" protobuf:"bytes,6,opt,name=statusCode"` +} diff --git a/pkg/apis/alibabacloud/v1/gateway_types.go b/pkg/apis/alibabacloud/v1/gateway_types.go deleted file mode 100644 index b2c6d507a..000000000 --- a/pkg/apis/alibabacloud/v1/gateway_types.go +++ /dev/null @@ -1,64 +0,0 @@ -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func init() { - SchemeBuilder.Register(&Gateway{}, &GatewayList{}) -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Gateway is a collection of rules that allow inbound connections to reach the -// endpoints defined by a backend. An Gateway can be configured to give services -// externally-reachable urls, load balance traffic, terminate SSL, offer name -// based virtual hosting etc. -type Gateway struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec is the desired state of the Gateway. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Spec GatewaySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Status is the current state of the Gateway. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Status IngressStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GatewayList is a collection of Gateway. -type GatewayList struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of Gateway. - Items []Gateway `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// GatewaySpec describes the Gateway the user wishes to exist. -type GatewaySpec struct { - // IngressClassName is the name of the IngressClass cluster resource. The - // associated IngressClass defines which controller will implement the - // resource. This replaces the deprecated `kubernetes.io/ingress.class` - // annotation. For backwards compatibility, when that annotation is set, it - // must be given precedence over this field. The controller may emit a - // warning if the field and annotation have different values. - // Implementations of this API should ignore Ingresses without a class - // specified. An IngressClass resource may be marked as default, which can - // be used to set a default value for this field. For more information, - // refer to the IngressClass documentation. - // +optional - IngressClassName *string `json:"ingressClassName,omitempty" protobuf:"bytes,4,opt,name=ingressClassName"` -} diff --git a/pkg/apis/alibabacloud/v1/ingress_types.go b/pkg/apis/alibabacloud/v1/ingress_types.go deleted file mode 100644 index 739487176..000000000 --- a/pkg/apis/alibabacloud/v1/ingress_types.go +++ /dev/null @@ -1,308 +0,0 @@ -package v1 - -import ( - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -func init() { - SchemeBuilder.Register(&AckIngress{}, &AckIngressList{}) -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// AckIngress is a collection of rules that allow inbound connections to reach the -// endpoints defined by a backend. An AckIngress can be configured to give services -// externally-reachable urls, load balance traffic, terminate SSL, offer name -// based virtual hosting etc. -type AckIngress struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec is the desired state of the AckIngress. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Spec IngressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Status is the current state of the AckIngress. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Status IngressStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// AckIngressList is a collection of AckIngress. -type AckIngressList struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of AckIngress. - Items []AckIngress `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// IngressSpec describes the AckIngress the user wishes to exist. -type IngressSpec struct { - // IngressClassName is the name of the IngressClass cluster resource. The - // associated IngressClass defines which controller will implement the - // resource. This replaces the deprecated `kubernetes.io/ingress.class` - // annotation. For backwards compatibility, when that annotation is set, it - // must be given precedence over this field. The controller may emit a - // warning if the field and annotation have different values. - // Implementations of this API should ignore Ingresses without a class - // specified. An IngressClass resource may be marked as default, which can - // be used to set a default value for this field. For more information, - // refer to the IngressClass documentation. - // +optional - IngressClassName *string `json:"ingressClassName,omitempty" protobuf:"bytes,4,opt,name=ingressClassName"` - - // A default backend capable of servicing requests that don't match any - // rule. At least one of 'backend' or 'rules' must be specified. This field - // is optional to allow the loadbalancer controller or defaulting logic to - // specify a global default. - // +optional - Backend *IngressBackend `json:"backend,omitempty" protobuf:"bytes,1,opt,name=backend"` - - // TLS configuration. Currently the AckIngress only supports a single TLS - // port, 443. If multiple members of this list specify different hosts, they - // will be multiplexed on the same port according to the hostname specified - // through the SNI TLS extension, if the ingress controller fulfilling the - // ingress supports SNI. - // +optional - TLS []IngressTLS `json:"tls,omitempty" protobuf:"bytes,2,rep,name=tls"` - - // A list of host rules used to configure the AckIngress. If unspecified, or - // no rule matches, all traffic is sent to the default backend. - // +optional - Rules []IngressRule `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"` - // TODO: Add the ability to specify load-balancer IP through claims -} - -// IngressTLS describes the transport layer security associated with an AckIngress. -type IngressTLS struct { - // Hosts are a list of hosts included in the TLS certificate. The values in - // this list must match the name/s used in the tlsSecret. Defaults to the - // wildcard host setting for the loadbalancer controller fulfilling this - // AckIngress, if left unspecified. - // +optional - Hosts []string `json:"hosts,omitempty" protobuf:"bytes,1,rep,name=hosts"` - // SecretName is the name of the secret used to terminate TLS traffic on - // port 443. Field is left optional to allow TLS routing based on SNI - // hostname alone. If the SNI host in a listener conflicts with the "Host" - // header field used by an IngressRule, the SNI host is used for termination - // and value of the Host header is used for routing. - // +optional - SecretName string `json:"secretName,omitempty" protobuf:"bytes,2,opt,name=secretName"` - // TODO: Consider specifying different modes of termination, protocols etc. -} - -// IngressStatus describe the current state of the AckIngress. -type IngressStatus struct { - // LoadBalancer contains the current status of the load-balancer. - // +optional - LoadBalancer v1.LoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"` -} - -// IngressRule represents the rules mapping the paths under a specified host to -// the related backend services. Incoming requests are first evaluated for a host -// match, then routed to the backend associated with the matching IngressRuleValue. -type IngressRule struct { - // Host is the fully qualified domain name of a network host, as defined by RFC 3986. - // Note the following deviations from the "host" part of the - // URI as defined in RFC 3986: - // 1. IPs are not allowed. Currently an IngressRuleValue can only apply to - // the IP in the Spec of the parent AckIngress. - // 2. The `:` delimiter is not respected because ports are not allowed. - // Currently the port of an AckIngress is implicitly :80 for http and - // :443 for https. - // Both these may change in the future. - // Incoming requests are matched against the host before the - // IngressRuleValue. If the host is unspecified, the AckIngress routes all - // traffic based on the specified IngressRuleValue. - // - // Host can be "precise" which is a domain name without the terminating dot of - // a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name - // prefixed with a single wildcard label (e.g. "*.foo.com"). - // The wildcard character '*' must appear by itself as the first DNS label and - // matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*"). - // Requests will be matched against the Host field in the following way: - // 1. If Host is precise, the request matches this rule if the http host header is equal to Host. - // 2. If Host is a wildcard, then the request matches this rule if the http host header - // is to equal to the suffix (removing the first label) of the wildcard rule. - // +optional - Host string `json:"host,omitempty" protobuf:"bytes,1,opt,name=host"` - // IngressRuleValue represents a rule to route requests for this IngressRule. - // If unspecified, the rule defaults to a http catch-all. Whether that sends - // just traffic matching the host to the default backend or all traffic to the - // default backend, is left to the controller fulfilling the AckIngress. Http is - // currently the only supported IngressRuleValue. - // +optional - IngressRuleValue `json:",inline,omitempty" protobuf:"bytes,2,opt,name=ingressRuleValue"` -} - -// IngressRuleValue represents a rule to apply against incoming requests. If the -// rule is satisfied, the request is routed to the specified backend. Currently -// mixing different types of rules in a single AckIngress is disallowed, so exactly -// one of the following must be set. -type IngressRuleValue struct { - //TODO: - // 1. Consider renaming this resource and the associated rules so they - // aren't tied to AckIngress. They can be used to route intra-cluster traffic. - // 2. Consider adding fields for ingress-type specific global options - // usable by a loadbalancer, like http keep-alive. - - // +optional - HTTP *HTTPIngressRuleValue `json:"http,omitempty" protobuf:"bytes,1,opt,name=http"` -} - -// HTTPIngressRuleValue is a list of http selectors pointing to backends. -// In the example: http:///? -> backend where -// where parts of the url correspond to RFC 3986, this resource will be used -// to match against everything after the last '/' and before the first '?' -// or '#'. -type HTTPIngressRuleValue struct { - // A collection of paths that map requests to backends. - Paths []HTTPIngressPath `json:"paths" protobuf:"bytes,1,rep,name=paths"` - // TODO: Consider adding fields for ingress-type specific global - // options usable by a loadbalancer, like http keep-alive. -} - -// PathType represents the type of path referred to by a HTTPIngressPath. -type PathType string - -const ( - // PathTypeExact matches the URL path exactly and with case sensitivity. - PathTypeExact = PathType("Exact") - - // PathTypePrefix matches based on a URL path prefix split by '/'. Matching - // is case sensitive and done on a path element by element basis. A path - // element refers to the list of labels in the path split by the '/' - // separator. A request is a match for path p if every p is an element-wise - // prefix of p of the request path. Note that if the last element of the - // path is a substring of the last element in request path, it is not a - // match (e.g. /foo/bar matches /foo/bar/baz, but does not match - // /foo/barbaz). If multiple matching paths exist in an AckIngress spec, the - // longest matching path is given priority. - // Examples: - // - /foo/bar does not match requests to /foo/barbaz - // - /foo/bar matches request to /foo/bar and /foo/bar/baz - // - /foo and /foo/ both match requests to /foo and /foo/. If both paths are - // present in an AckIngress spec, the longest matching path (/foo/) is given - // priority. - PathTypePrefix = PathType("Prefix") - - // PathTypeImplementationSpecific matching is up to the IngressClass. - // Implementations can treat this as a separate PathType or treat it - // identically to Prefix or Exact path types. - PathTypeImplementationSpecific = PathType("ImplementationSpecific") -) - -// HTTPIngressPath associates a path with a backend. Incoming urls matching the -// path are forwarded to the backend. -type HTTPIngressPath struct { - // Path is matched against the path of an incoming request. Currently it can - // contain characters disallowed from the conventional "path" part of a URL - // as defined by RFC 3986. Paths must begin with a '/'. When unspecified, - // all paths from incoming requests are matched. - // +optional - Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` - - // PathType determines the interpretation of the Path matching. PathType can - // be one of the following values: - // * Exact: Matches the URL path exactly. - // * Prefix: Matches based on a URL path prefix split by '/'. Matching is - // done on a path element by element basis. A path element refers is the - // list of labels in the path split by the '/' separator. A request is a - // match for path p if every p is an element-wise prefix of p of the - // request path. Note that if the last element of the path is a substring - // of the last element in request path, it is not a match (e.g. /foo/bar - // matches /foo/bar/baz, but does not match /foo/barbaz). - // * ImplementationSpecific: Interpretation of the Path matching is up to - // the IngressClass. Implementations can treat this as a separate PathType - // or treat it identically to Prefix or Exact path types. - // Implementations are required to support all path types. - // Defaults to ImplementationSpecific. - PathType *PathType `json:"pathType,omitempty" protobuf:"bytes,3,opt,name=pathType"` - - // Backend defines the referenced service endpoint to which the traffic - // will be forwarded to. - Backend IngressBackend `json:"backend" protobuf:"bytes,2,opt,name=backend"` -} - -// IngressBackend describes all endpoints for a given service and port. -type IngressBackend struct { - // Specifies the name of the referenced service. - // +optional - ServiceName string `json:"serviceName,omitempty" protobuf:"bytes,1,opt,name=serviceName"` - - // Specifies the port of the referenced service. - // +optional - ServicePort intstr.IntOrString `json:"servicePort,omitempty" protobuf:"bytes,2,opt,name=servicePort"` - - // Resource is an ObjectRef to another Kubernetes resource in the namespace - // of the AckIngress object. If resource is specified, serviceName and servicePort - // must not be specified. - // +optional - Resource *v1.TypedLocalObjectReference `json:"resource,omitempty" protobuf:"bytes,3,opt,name=resource"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// IngressClass represents the class of the AckIngress, referenced by the AckIngress -// Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be -// used to indicate that an IngressClass should be considered default. When a -// single IngressClass resource has this annotation set to true, new AckIngress -// resources without a class specified will be assigned this default class. -type IngressClass struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec is the desired state of the IngressClass. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Spec IngressClassSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` -} - -// IngressClassSpec provides information about the class of an AckIngress. -type IngressClassSpec struct { - // Controller refers to the name of the controller that should handle this - // class. This allows for different "flavors" that are controlled by the - // same controller. For example, you may have different Parameters for the - // same implementing controller. This should be specified as a - // domain-prefixed path no more than 250 characters in length, e.g. - // "acme.io/ingress-controller". This field is immutable. - Controller string `json:"controller,omitempty" protobuf:"bytes,1,opt,name=controller"` - - // Parameters is a link to a custom resource containing additional - // configuration for the controller. This is optional if the controller does - // not require extra parameters. - // +optional - Parameters *v1.TypedLocalObjectReference `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// IngressClassList is a collection of IngressClasses. -type IngressClassList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of IngressClasses. - // +listType=set - Items []IngressClass `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/pkg/apis/alibabacloud/v1/zz_generated.deepcopy.go b/pkg/apis/alibabacloud/v1/zz_generated.deepcopy.go index cf87e51ad..c98ac79ff 100644 --- a/pkg/apis/alibabacloud/v1/zz_generated.deepcopy.go +++ b/pkg/apis/alibabacloud/v1/zz_generated.deepcopy.go @@ -6,12 +6,11 @@ package v1 import ( - corev1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AckIngress) DeepCopyInto(out *AckIngress) { +func (in *AlbConfig) DeepCopyInto(out *AlbConfig) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -19,18 +18,18 @@ func (in *AckIngress) DeepCopyInto(out *AckIngress) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AckIngress. -func (in *AckIngress) DeepCopy() *AckIngress { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlbConfig. +func (in *AlbConfig) DeepCopy() *AlbConfig { if in == nil { return nil } - out := new(AckIngress) + out := new(AlbConfig) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AckIngress) DeepCopyObject() runtime.Object { +func (in *AlbConfig) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -38,31 +37,31 @@ func (in *AckIngress) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AckIngressList) DeepCopyInto(out *AckIngressList) { +func (in *AlbConfigList) DeepCopyInto(out *AlbConfigList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]AckIngress, len(*in)) + *out = make([]AlbConfig, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AckIngressList. -func (in *AckIngressList) DeepCopy() *AckIngressList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlbConfigList. +func (in *AlbConfigList) DeepCopy() *AlbConfigList { if in == nil { return nil } - out := new(AckIngressList) + out := new(AlbConfigList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AckIngressList) DeepCopyObject() runtime.Object { +func (in *AlbConfigList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -70,305 +69,49 @@ func (in *AckIngressList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Gateway) DeepCopyInto(out *Gateway) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gateway. -func (in *Gateway) DeepCopy() *Gateway { - if in == nil { - return nil - } - out := new(Gateway) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Gateway) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayList) DeepCopyInto(out *GatewayList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Gateway, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayList. -func (in *GatewayList) DeepCopy() *GatewayList { - if in == nil { - return nil - } - out := new(GatewayList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GatewayList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} +func (in *AlbConfigSpec) DeepCopyInto(out *AlbConfigSpec) { + out.LoadBalancer = &LoadBalancerSpec{} + (in.LoadBalancer).DeepCopyInto(out.LoadBalancer) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { - *out = *in - if in.IngressClassName != nil { - in, out := &in.IngressClassName, &out.IngressClassName - *out = new(string) - **out = **in - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec. -func (in *GatewaySpec) DeepCopy() *GatewaySpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerSpec. +func (in *LoadBalancerSpec) DeepCopy() *LoadBalancerSpec { if in == nil { return nil } - out := new(GatewaySpec) + out := new(LoadBalancerSpec) in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPIngressPath) DeepCopyInto(out *HTTPIngressPath) { - *out = *in - if in.PathType != nil { - in, out := &in.PathType, &out.PathType - *out = new(PathType) - **out = **in - } - in.Backend.DeepCopyInto(&out.Backend) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPIngressPath. -func (in *HTTPIngressPath) DeepCopy() *HTTPIngressPath { +func (in *LoadBalancerSpec) DeepCopyInto(out *LoadBalancerSpec) { if in == nil { - return nil + return } - out := new(HTTPIngressPath) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPIngressRuleValue) DeepCopyInto(out *HTTPIngressRuleValue) { *out = *in - if in.Paths != nil { - in, out := &in.Paths, &out.Paths - *out = make([]HTTPIngressPath, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPIngressRuleValue. -func (in *HTTPIngressRuleValue) DeepCopy() *HTTPIngressRuleValue { - if in == nil { - return nil - } - out := new(HTTPIngressRuleValue) - in.DeepCopyInto(out) - return out -} -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressBackend) DeepCopyInto(out *IngressBackend) { - *out = *in - out.ServicePort = in.ServicePort - if in.Resource != nil { - in, out := &in.Resource, &out.Resource - *out = new(corev1.TypedLocalObjectReference) - (*in).DeepCopyInto(*out) - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressBackend. -func (in *IngressBackend) DeepCopy() *IngressBackend { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlbConfigSpec. +func (in *AlbConfigSpec) DeepCopy() *AlbConfigSpec { if in == nil { return nil } - out := new(IngressBackend) + out := new(AlbConfigSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressClass) DeepCopyInto(out *IngressClass) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressClass. -func (in *IngressClass) DeepCopy() *IngressClass { - if in == nil { - return nil - } - out := new(IngressClass) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IngressClass) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressClassList) DeepCopyInto(out *IngressClassList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]IngressClass, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressClassList. -func (in *IngressClassList) DeepCopy() *IngressClassList { - if in == nil { - return nil - } - out := new(IngressClassList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IngressClassList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressClassSpec) DeepCopyInto(out *IngressClassSpec) { - *out = *in - if in.Parameters != nil { - in, out := &in.Parameters, &out.Parameters - *out = new(corev1.TypedLocalObjectReference) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressClassSpec. -func (in *IngressClassSpec) DeepCopy() *IngressClassSpec { - if in == nil { - return nil - } - out := new(IngressClassSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressRule) DeepCopyInto(out *IngressRule) { - *out = *in - in.IngressRuleValue.DeepCopyInto(&out.IngressRuleValue) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRule. -func (in *IngressRule) DeepCopy() *IngressRule { - if in == nil { - return nil - } - out := new(IngressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressRuleValue) DeepCopyInto(out *IngressRuleValue) { - *out = *in - if in.HTTP != nil { - in, out := &in.HTTP, &out.HTTP - *out = new(HTTPIngressRuleValue) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRuleValue. -func (in *IngressRuleValue) DeepCopy() *IngressRuleValue { - if in == nil { - return nil - } - out := new(IngressRuleValue) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressSpec) DeepCopyInto(out *IngressSpec) { +func (in *IngressStatus) DeepCopyInto(out *IngressStatus) { *out = *in - if in.IngressClassName != nil { - in, out := &in.IngressClassName, &out.IngressClassName - *out = new(string) - **out = **in - } - if in.Backend != nil { - in, out := &in.Backend, &out.Backend - *out = new(IngressBackend) - (*in).DeepCopyInto(*out) - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = make([]IngressTLS, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]IngressRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressSpec. -func (in *IngressSpec) DeepCopy() *IngressSpec { - if in == nil { - return nil - } - out := new(IngressSpec) - in.DeepCopyInto(out) - return out + in.LoadBalancer.DeepCopyInto(&out.LoadBalancer) } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressStatus) DeepCopyInto(out *IngressStatus) { +func (in *LoadBalancerStatus) DeepCopyInto(out *LoadBalancerStatus) { *out = *in - in.LoadBalancer.DeepCopyInto(&out.LoadBalancer) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressStatus. @@ -380,23 +123,3 @@ func (in *IngressStatus) DeepCopy() *IngressStatus { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressTLS) DeepCopyInto(out *IngressTLS) { - *out = *in - if in.Hosts != nil { - in, out := &in.Hosts, &out.Hosts - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressTLS. -func (in *IngressTLS) DeepCopy() *IngressTLS { - if in == nil { - return nil - } - out := new(IngressTLS) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/controller/helper/event.go b/pkg/controller/helper/event.go index a2ba152dd..8c2fe9d3c 100644 --- a/pkg/controller/helper/event.go +++ b/pkg/controller/helper/event.go @@ -51,3 +51,45 @@ func GetLogMessage(err error) string { } return message } + +const ( + // Ingress events + IngressEventReasonFailedAddFinalizer = "FailedAddFinalizer" + IngressEventReasonFailedRemoveFinalizer = "FailedRemoveFinalizer" + IngressEventReasonFailedUpdateStatus = "FailedUpdateStatus" + IngressEventReasonFailedBuildModel = "FailedBuildModel" + IngressEventReasonFailedApplyModel = "FailedApplyModel" + IngressEventReasonSuccessfullyReconciled = "SuccessfullyReconciled" +) + +// EventType type of event associated with an informer +type EventType string + +const ( + // CreateEvent event associated with new objects in an informer + CreateEvent EventType = "CREATE" + // UpdateEvent event associated with an object update in an informer + UpdateEvent EventType = "UPDATE" + // DeleteEvent event associated when an object is removed from an informer + IngressDeleteEvent EventType = "DELETE" + // ConfigurationEvent event associated when a controller configuration object is created or updated + ConfigurationEvent EventType = "CONFIGURATION" + + // NodeEvent event associated when a controller configuration object is created or updated + NodeEvent EventType = "NODE" + + // ServiceEvent event associated when a controller configuration object is created or updated + ServiceEvent EventType = "SERVICE" + + // EndPointEvent event associated when a controller configuration object is created or updated + EndPointEvent EventType = "ENDPOINT" + + // IngressEvent event associated when a controller configuration object is created or updated + IngressEvent EventType = "Ingress" +) + +// Event holds the context of an event. +type Event struct { + Type EventType + Obj interface{} +} diff --git a/pkg/controller/helper/k8s/pod_utils.go b/pkg/controller/helper/k8s/pod_utils.go new file mode 100644 index 000000000..e3f155b9f --- /dev/null +++ b/pkg/controller/helper/k8s/pod_utils.go @@ -0,0 +1,52 @@ +package k8s + +import ( + "fmt" + + corev1 "k8s.io/api/core/v1" +) + +// Prefix for TargetHealth pod condition type. +const TargetHealthPodConditionTypePrefix = "target-health.alb.k8s.alicloud" + +// BuildTargetHealthPodConditionType constructs the condition type for TargetHealth pod condition. +func BuildReadinessGatePodConditionType() corev1.PodConditionType { + return corev1.PodConditionType(fmt.Sprintf("%s", TargetHealthPodConditionTypePrefix)) +} + +func IsPodHasReadinessGate(pod *corev1.Pod) bool { + conditionType := BuildReadinessGatePodConditionType() + for _, rg := range pod.Spec.ReadinessGates { + if rg.ConditionType == conditionType { + return true + } + } + return false +} + +// IsPodContainersReady returns whether pod is containersReady. +func IsPodContainersReady(pod *corev1.Pod) bool { + containersReadyCond := GetPodCondition(pod, corev1.ContainersReady) + return containersReadyCond != nil && containersReadyCond.Status == corev1.ConditionTrue +} + +// GetPodCondition will get pointer to Pod's existing condition. +// returns nil if no matching condition found. +func GetPodCondition(pod *corev1.Pod, conditionType corev1.PodConditionType) *corev1.PodCondition { + for i := range pod.Status.Conditions { + if pod.Status.Conditions[i].Type == conditionType { + return &pod.Status.Conditions[i] + } + } + return nil +} + +// UpdatePodCondition will update Pod to contain specified condition. +func UpdatePodCondition(pod *corev1.Pod, condition corev1.PodCondition) { + existingCond := GetPodCondition(pod, condition.Type) + if existingCond != nil { + *existingCond = condition + return + } + pod.Status.Conditions = append(pod.Status.Conditions, condition) +} diff --git a/pkg/controller/helper/k8s/queue.go b/pkg/controller/helper/k8s/queue.go new file mode 100644 index 000000000..df6e4f0b8 --- /dev/null +++ b/pkg/controller/helper/k8s/queue.go @@ -0,0 +1,188 @@ +package k8s + +import ( + "fmt" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + + "k8s.io/klog/v2" + + "golang.org/x/time/rate" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" +) + +var ( + keyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc +) + +// Queue manages a time work queue through an independent worker that invokes the +// given sync function for every work item inserted. +// The queue uses an internal timestamp that allows the removal of certain elements +// which timestamp is older than the last successful get operation. +type Queue struct { + // queue is the work queue the worker polls + queue workqueue.RateLimitingInterface + // sync is called for each item in the queue + sync func(interface{}) error + // workerDone is closed when the worker exits + workerDone chan bool + // fn makes a key for an API object + fn func(obj interface{}) (interface{}, error) + // lastSync is the Unix epoch time of the last execution of 'sync' + lastSync int64 +} + +// Element represents one item of the queue +type Element struct { + Key interface{} + Event helper.Event + IsSkippable bool +} + +// String returns the general purpose string representation +func (n Element) String() string { + namespaceAndName, _ := cache.MetaNamespaceKeyFunc(n.Key) + return namespaceAndName +} + +// Run starts processing elements in the queue +func (t *Queue) Run(maxConcurrentReconciles int, period time.Duration, stopCh <-chan struct{}) { + for i := 0; i < maxConcurrentReconciles; i++ { + go wait.Until(t.worker, period, stopCh) + } + +} + +// EnqueueTask enqueues ns/name of the given api object in the task queue. +func (t *Queue) EnqueueTask(obj interface{}) { + t.enqueue(obj, false) +} + +// EnqueueSkippableTask enqueues ns/name of the given api object in +// the task queue that can be skipped +func (t *Queue) EnqueueSkippableTask(obj interface{}) { + t.enqueue(obj, true) +} + +// enqueue enqueues ns/name of the given api object in the task queue. +func (t *Queue) enqueue(obj interface{}, skippable bool) { + if t.IsShuttingDown() { + klog.ErrorS(nil, "queue has been shutdown, failed to enqueue", "key", obj) + return + } + + klog.V(3).InfoS("queuing", "item", obj) + e := obj.(helper.Event) + key, err := t.fn(e.Obj) + if err != nil { + klog.ErrorS(err, "creating object key", "item", obj) + return + } + t.queue.Add(Element{ + Key: key, + Event: obj.(helper.Event), + }) +} + +func (t *Queue) defaultKeyFunc(obj interface{}) (interface{}, error) { + key, err := keyFunc(obj) + if err != nil { + return "", fmt.Errorf("could not get key for object %+v: %v", obj, err) + } + + return key, nil +} + +// worker processes work in the queue through sync. +func (t *Queue) worker() { + for { + key, quit := t.queue.Get() + if quit { + if !isClosed(t.workerDone) { + close(t.workerDone) + } + return + } + ts := time.Now().UnixNano() + + item := key.(Element) + klog.V(3).InfoS("syncing", "key", item.Key) + if err := t.sync(key); err != nil { + klog.ErrorS(err, "requeuing", "key", item.Key) + t.queue.AddRateLimited(Element{ + Key: item.Key, + Event: item.Event, + }) + } else { + t.queue.Forget(key) + t.lastSync = ts + } + + t.queue.Done(key) + } +} + +func isClosed(ch <-chan bool) bool { + select { + case <-ch: + return true + default: + } + + return false +} + +// Shutdown shuts down the work queue and waits for the worker to ACK +func (t *Queue) Shutdown() { + t.queue.ShutDown() + <-t.workerDone +} + +// IsShuttingDown returns if the method Shutdown was invoked +func (t *Queue) IsShuttingDown() bool { + return t.queue.ShuttingDown() +} + +// NewTaskQueue creates a new task queue with the given sync function. +// The sync function is called for every element inserted into the queue. +func NewTaskQueue(syncFn func(interface{}) error) *Queue { + return NewCustomTaskQueue(syncFn, nil) +} + +// NewCustomTaskQueue ... +func NewCustomTaskQueue(syncFn func(interface{}) error, fn func(interface{}) (interface{}, error)) *Queue { + q := &Queue{ + queue: workqueue.NewRateLimitingQueue(workqueue.NewMaxOfRateLimiter( + workqueue.NewItemExponentialFailureRateLimiter(500*time.Millisecond, 1000*time.Second), + // 10 qps, 100 bucket size. This is only for retry speed and its only the overall factor (not per item) + &workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(10), 100)}, + )), + sync: syncFn, + workerDone: make(chan bool), + fn: fn, + } + + if fn == nil { + q.fn = q.defaultKeyFunc + } + + return q +} + +// GetDummyObject returns a valid object that can be used in the Queue +func GetDummyObject(name string) *metav1.ObjectMeta { + return &metav1.ObjectMeta{ + Name: name, + } +} +func GetServiceDummyObject(name, namespace string) *metav1.ObjectMeta { + return &metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + } +} diff --git a/pkg/controller/helper/k8s/reference_indexer.go b/pkg/controller/helper/k8s/reference_indexer.go new file mode 100644 index 000000000..b05d61a6f --- /dev/null +++ b/pkg/controller/helper/k8s/reference_indexer.go @@ -0,0 +1,42 @@ +package k8s + +import ( + "context" + + networking "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/util/sets" +) + +type ReferenceIndexer interface { + BuildServiceRefIndexes(ctx context.Context, ing *networking.Ingress) []string +} + +func NewDefaultReferenceIndexer() *defaultReferenceIndexer { + return &defaultReferenceIndexer{} +} + +var _ ReferenceIndexer = &defaultReferenceIndexer{} + +type defaultReferenceIndexer struct { +} + +func (i *defaultReferenceIndexer) BuildServiceRefIndexes(ctx context.Context, ing *networking.Ingress) []string { + var backends []networking.IngressBackend + if ing.Spec.DefaultBackend != nil { + backends = append(backends, *ing.Spec.DefaultBackend) + } + for _, rule := range ing.Spec.Rules { + if rule.HTTP == nil { + continue + } + for _, path := range rule.HTTP.Paths { + backends = append(backends, path.Backend) + } + } + + serviceNames := sets.NewString() + for _, backend := range backends { + serviceNames.Insert(backend.Service.Name) + } + return serviceNames.List() +} diff --git a/pkg/controller/helper/service.go b/pkg/controller/helper/service.go new file mode 100644 index 000000000..007cab93f --- /dev/null +++ b/pkg/controller/helper/service.go @@ -0,0 +1,200 @@ +package helper + +import ( + "context" + "fmt" + "os" + "strings" + + "k8s.io/apimachinery/pkg/types" + + ctrlCfg "k8s.io/cloud-provider-alibaba-cloud/pkg/config" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + "k8s.io/klog" + "sigs.k8s.io/controller-runtime/pkg/client" + + v1 "k8s.io/api/core/v1" +) + +type TrafficPolicy string + +const ( + LocalTrafficPolicy = TrafficPolicy("Local") + ClusterTrafficPolicy = TrafficPolicy("Cluster") + ENITrafficPolicy = TrafficPolicy("ENI") +) + +func GetService(k8sClient client.Client, svcKey types.NamespacedName) (*v1.Service, error) { + svc := &v1.Service{} + err := k8sClient.Get(context.Background(), svcKey, svc) + if err != nil { + return nil, err + } + + return svc, nil +} + +func GetServiceTrafficPolicy(svc *v1.Service) (TrafficPolicy, error) { + if isENIBackendType(svc) { + return ENITrafficPolicy, nil + } + if isClusterIPService(svc) { + return "", fmt.Errorf("cluster service type just support eni mode for alb ingress") + } + if isLocalModeService(svc) { + return LocalTrafficPolicy, nil + } + return ClusterTrafficPolicy, nil +} + +func isENIBackendType(svc *v1.Service) bool { + if svc.Annotations[annotations.BackendType] != "" { + return svc.Annotations[annotations.BackendType] == alb.ENIBackendType + } + + if os.Getenv("SERVICE_FORCE_BACKEND_ENI") != "" { + return os.Getenv("SERVICE_FORCE_BACKEND_ENI") == "true" + } + + return strings.EqualFold(ctrlCfg.CloudCFG.Global.ServiceBackendType, alb.ENIBackendType) +} + +type Func func([]interface{}) error + +func isLocalModeService(svc *v1.Service) bool { + return svc.Spec.ExternalTrafficPolicy == v1.ServiceExternalTrafficPolicyTypeLocal +} + +func isClusterIPService(svc *v1.Service) bool { + return svc.Spec.Type == v1.ServiceTypeClusterIP +} + +func NodeFromProviderID(providerID string) (string, string, error) { + if strings.HasPrefix(providerID, "alicloud://") { + k8sName := strings.Split(providerID, "://") + if len(k8sName) < 2 { + return "", "", fmt.Errorf("alicloud: unable to split instanceid and region from providerID, error unexpected providerID=%s", providerID) + } else { + providerID = k8sName[1] + } + } + + name := strings.Split(providerID, ".") + if len(name) < 2 { + return "", "", fmt.Errorf("alicloud: unable to split instanceid and region from providerID, error unexpected providerID=%s", providerID) + } + return name[0], name[1], nil +} + +func GetNodes(svc *v1.Service, client client.Client) ([]v1.Node, error) { + nodeList := v1.NodeList{} + err := client.List(context.Background(), &nodeList) + if err != nil { + return nil, fmt.Errorf("get nodes error: %v", err) + } + + // 1. filter by label + items := nodeList.Items + if a, ok := svc.Annotations[annotations.BackendLabel]; ok { + items, err = filterOutByLabel(nodeList.Items, a) + if err != nil { + return nil, fmt.Errorf("filter nodes by label error: %s", err.Error()) + } + } + + var nodes []v1.Node + for _, n := range items { + if needExcludeFromLB(svc, &n) { + continue + } + nodes = append(nodes, n) + } + + return nodes, nil +} + +func needExcludeFromLB(svc *v1.Service, node *v1.Node) bool { + // need to keep the node who has exclude label in order to be compatible with vk node + // It's safe because these nodes will be filtered in build backends func + + // exclude node which has exclude balancer label + if _, exclude := node.Labels[util.LabelNodeExcludeApplicationLoadBalancer]; exclude { + return true + } + + if isMasterNode(node) { + klog.Infof("[%s] node %s is master node, skip adding it to lb", util.Key(svc), node.Name) + return true + } + + // filter unscheduled node + if node.Spec.Unschedulable { + if v, ok := svc.Annotations[annotations.RemoveUnscheduled]; ok { + if v == string(alb.OnFlag) { + klog.Infof("[%s] node %s is unscheduled, skip adding to lb", util.Key(svc), node.Name) + return true + } + } + } + + // ignore vk node condition check. + // Even if the vk node is NotReady, it still can be added to lb. Because the eci pod that actually joins the lb, not a vk node + if label, ok := node.Labels["type"]; ok && label == util.LabelNodeTypeVK { + return false + } + + // If we have no info, don't accept + if len(node.Status.Conditions) == 0 { + return true + } + + for _, cond := range node.Status.Conditions { + // We consider the node for load balancing only when its NodeReady + // condition status is ConditionTrue + if cond.Type == v1.NodeReady && + cond.Status != v1.ConditionTrue { + klog.Infof("[%s] node %v with %v condition "+ + "status %v", util.Key(svc), node.Name, cond.Type, cond.Status) + return true + } + } + + return false +} + +func filterOutByLabel(nodes []v1.Node, labels string) ([]v1.Node, error) { + if labels == "" { + return nodes, nil + } + var result []v1.Node + lbl := strings.Split(labels, ",") + var records []string + for _, node := range nodes { + found := true + for _, v := range lbl { + l := strings.Split(v, "=") + if len(l) < 2 { + return []v1.Node{}, fmt.Errorf("parse backend label: %s, [k1=v1,k2=v2]", v) + } + if nv, exist := node.Labels[l[0]]; !exist || nv != l[1] { + found = false + break + } + } + if found { + result = append(result, node) + records = append(records, node.Name) + } + } + klog.V(4).Infof("accept nodes backend labels[%s], %v", labels, records) + return result, nil +} + +func isMasterNode(node *v1.Node) bool { + if _, isMaster := node.Labels[util.LabelNodeRoleMaster]; isMaster { + return true + } + return false +} diff --git a/pkg/controller/ingress/alb_controller.go b/pkg/controller/ingress/alb_controller.go new file mode 100644 index 000000000..88f3a135a --- /dev/null +++ b/pkg/controller/ingress/alb_controller.go @@ -0,0 +1,728 @@ +package ingress + +import ( + "context" + "encoding/json" + "fmt" + "strings" + "sync" + "time" + + "k8s.io/apimachinery/pkg/util/version" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store" + + sdkutils "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" + "github.com/eapache/channels" + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + networking "k8s.io/api/networking/v1" + "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/record" + v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/context/shared" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper/k8s" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/applier" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/backend" + albconfigmanager "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/builder/albconfig_manager" + servicemanager "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/builder/service_manager" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +const ( + defaultMaxConcurrentReconciles = 3 + albIngressControllerName = "alb-ingress-controller" +) + +func NewAlbConfigReconciler(mgr manager.Manager, ctx *shared.SharedContext) (*albconfigReconciler, error) { + config := Configuration{} + logger := ctrl.Log.WithName("controllers").WithName(albIngressControllerName) + + client, err := kubernetes.NewForConfig(mgr.GetConfig()) + if err != nil { + return nil, err + } + // Check cluster version + serverVersion, err := client.Discovery().ServerVersion() + if err != nil { + return nil, fmt.Errorf("get server version: %s", err.Error()) + } + + runningVersion, err := version.ParseGeneric(serverVersion.String()) + if err != nil { + return nil, fmt.Errorf("unexpected error parsing running Kubernetes version, %s", err.Error()) + } + + leastVersion, _ := version.ParseGeneric("v1.19.0") + if !runningVersion.AtLeast(leastVersion) { + logger.Info("kubernetes version should great then v1.19.0 to use ingress v1", "server version", serverVersion.GitVersion) + } + + n := &albconfigReconciler{ + cloud: ctx.Provider(), + k8sClient: mgr.GetClient(), + groupLoader: albconfigmanager.NewDefaultGroupLoader(mgr.GetClient(), annotations.NewSuffixAnnotationParser(annotations.DefaultAnnotationsPrefix)), + referenceIndexer: k8s.NewDefaultReferenceIndexer(), + eventRecorder: mgr.GetEventRecorderFor("ingress"), + stackMarshaller: NewDefaultStackMarshaller(), + logger: logger, + updateCh: channels.NewRingChannel(1024), + albconfigBuilder: albconfigmanager.NewDefaultAlbConfigManagerBuilder(mgr.GetClient(), ctx.Provider(), logger), + + serverApplier: applier.NewServiceManagerApplier( + mgr.GetClient(), + ctx.Provider(), + logger), + stopLock: &sync.Mutex{}, + groupFinalizerManager: albconfigmanager.NewDefaultFinalizerManager(helper.NewDefaultFinalizerManager(mgr.GetClient())), + k8sFinalizerManager: helper.NewDefaultFinalizerManager(mgr.GetClient()), + + maxConcurrentReconciles: defaultMaxConcurrentReconciles, + } + n.store = store.New( + config.Namespace, + config.ResyncPeriod, + client, + n.updateCh, + config.DisableCatchAll) + n.serverBuilder = servicemanager.NewDefaultServiceStackBuilder(backend.NewBackendManager(n.store, mgr.GetClient(), ctx.Provider(), logger)) + n.albconfigApplier = applier.NewAlbConfigManagerApplier(n.store, mgr.GetClient(), ctx.Provider(), util.IngressTagKeyPrefix, logger) + n.syncQueue = k8s.NewTaskQueue(n.syncIngress) + n.syncServersQueue = k8s.NewTaskQueue(n.syncServers) + go n.Start() + return n, nil +} + +// Configuration contains all the settings required by an Ingress controller +type Configuration struct { + Client clientset.Interface + ResyncPeriod time.Duration + ConfigMapName string + DefaultService string + Namespace string + DisableCatchAll bool +} + +type albconfigReconciler struct { + cloud prvd.Provider + k8sClient client.Client + groupLoader albconfigmanager.GroupLoader + referenceIndexer k8s.ReferenceIndexer + eventRecorder record.EventRecorder + stackMarshaller StackMarshaller + logger logr.Logger + store store.Storer + albconfigBuilder albconfigmanager.Builder + albconfigApplier applier.AlbConfigManagerApplier + serverBuilder servicemanager.Builder + serverApplier applier.ServiceManagerApplier + isShuttingDown bool + stopCh chan struct{} + updateCh *channels.RingChannel + acEventChan chan event.GenericEvent + // ngxErrCh is used to detect errors with the NGINX processes + ngxErrCh chan error + stopLock *sync.Mutex + groupFinalizerManager albconfigmanager.FinalizerManager + k8sFinalizerManager helper.FinalizerManager + syncQueue *k8s.Queue + syncServersQueue *k8s.Queue + maxConcurrentReconciles int +} + +func (g *albconfigReconciler) setupWatches(_ context.Context, c controller.Controller) error { + g.acEventChan = make(chan event.GenericEvent) + acEventHandler := NewEnqueueRequestsForAlbconfigEvent(g.k8sClient, g.eventRecorder, g.logger) + if err := c.Watch(&source.Channel{Source: g.acEventChan}, acEventHandler); err != nil { + return err + } + + if err := c.Watch(&source.Kind{Type: &v1.AlbConfig{}}, acEventHandler); err != nil { + return err + } + + return nil +} + +func (g *albconfigReconciler) SetupWithManager(ctx context.Context, mgr manager.Manager) error { + c, err := controller.New(albIngressControllerName, mgr, controller.Options{ + MaxConcurrentReconciles: g.maxConcurrentReconciles, + Reconciler: g, + }) + if err != nil { + return err + } + + if err := g.setupWatches(ctx, c); err != nil { + return err + } + + return nil +} + +func (g *albconfigReconciler) syncIngress(obj interface{}) error { + g.logger.Info("start syncIngress") + traceID := sdkutils.GetUUID() + ctx := context.WithValue(context.Background(), util.TraceID, traceID) + e := obj.(k8s.Element) + evt := e.Event + ings := g.store.ListIngresses() + + if len(ings) == 0 { + g.logger.Info("ingress length: 0, skip") + return nil + } + if evt.Type == helper.EndPointEvent || evt.Type == helper.NodeEvent || evt.Type == helper.ServiceEvent { + g.syncServersQueue.EnqueueSkippableTask(evt) + return nil + } + for _, ing := range ings { + g.logger.Info("start ingress: %s", ing.Name) + var ( + groupIDNew *albconfigmanager.GroupID + ) + groupIDNew, _ = g.groupLoader.LoadGroupID(ctx, &ing.Ingress) + var groupInChan = func(groupID *albconfigmanager.GroupID) { + albconfig := &v1.AlbConfig{} + if err := g.k8sClient.Get(ctx, types.NamespacedName{ + Namespace: groupID.Namespace, + Name: groupID.Name, + }, albconfig); err != nil { + if errors.IsNotFound(err) { + err = g.k8sClient.Create(ctx, g.makeAlbConfig(ctx, groupID.Name, &ing.Ingress), &client.CreateOptions{}) + if err != nil { + g.logger.Error(err, "Create albconfig failed", "albconfig", ing) + return + } + return + } + g.logger.Error(err, "get albconfig failed", "albconfig", ing) + return + } + lss := make([]*v1.ListenerSpec, 0) + ingListByPort := make(map[int32]albconfigmanager.Protocol, 0) + ingGroup, _ := g.groupLoader.Load(ctx, *groupID, ings) + if ingGroup.Members != nil && len(ingGroup.Members) > 0 { + for _, ingm := range ingGroup.Members { + portAndProtocol, _ := albconfigmanager.ComputeIngressListenPorts(ingm) + for port, pro := range portAndProtocol { + ingListByPort[port] = pro + } + } + } + for k, v := range ingListByPort { + ls := &v1.ListenerSpec{ + Port: intstr.FromInt(int(k)), + Protocol: string(v), + } + lss = append(lss, ls) + } + albconfig.Spec.Listeners = lss + err := g.k8sClient.Update(ctx, albconfig, &client.UpdateOptions{}) + if err != nil { + g.logger.Error(err, "Update albconfig") + return + } + g.acEventChan <- event.GenericEvent{ + Object: albconfig, + } + } + + groupInChan(groupIDNew) + + } + + return nil +} + +func (g *albconfigReconciler) syncServers(obj interface{}) error { + traceID := sdkutils.GetUUID() + ctx := context.WithValue(context.Background(), util.TraceID, traceID) + + e := obj.(k8s.Element) + evt := e.Event + + startTime := time.Now() + g.logger.Info("start syncServers", + "request", e.Key, + "traceID", traceID, + "startTime", startTime) + defer func() { + g.logger.Info("finish syncServers", + "request", e.Key, + "traceID", traceID, + "elapsedTime", time.Since(startTime).Milliseconds()) + }() + + ings := g.store.ListIngresses() + if len(ings) == 0 { + g.logger.Info("service not used by ingress, skip", "key", e.Key) + return nil + } + request := reconcile.Request{} + svc := evt.Obj.(*corev1.Service) + request.Namespace = svc.Namespace + request.Name = svc.Name + + servicePortToIngressNames := g.getServicePortToIngressNames(request, ings) + if len(servicePortToIngressNames) > 0 { + svcStackContext, err := g.buildServiceStackContext(ctx, request, servicePortToIngressNames) + if err != nil { + return err + } + + if err = g.buildAndApplyServers(ctx, svcStackContext); err != nil { + return err + } + } + + return nil +} + +func (g *albconfigReconciler) getServicePortToIngressNames(request reconcile.Request, ingList []*store.Ingress) map[int32][]string { + + var servicePortToIngressNames = make(map[int32]map[string]struct{}) + + var processIngressBackend = func(b networking.IngressBackend, ingName string) { + servicePort := b.Service.Port.Number + if _, ok := servicePortToIngressNames[servicePort]; !ok { + servicePortToIngressNames[servicePort] = make(map[string]struct{}, 0) + } + servicePortToIngressNames[servicePort][ingName] = struct{}{} + } + + for _, ing := range ingList { + if ing.Spec.DefaultBackend != nil { + if ing.Spec.DefaultBackend.Service.Name == request.Name { + processIngressBackend(*ing.Spec.DefaultBackend, ing.Name) + } + } + + for _, rule := range ing.Spec.Rules { + if rule.HTTP == nil { + continue + } + for _, path := range rule.HTTP.Paths { + if path.Backend.Service.Name == request.Name { + g.logger.Info("processIngressBackend", "ServiceName", path.Backend.Service.Name, request.Name) + processIngressBackend(path.Backend, ing.Name) + } + } + } + } + + var servicePortToIngressNameList = make(map[int32][]string) + for servicePort, ingressNames := range servicePortToIngressNames { + for ingressName := range ingressNames { + servicePortToIngressNameList[servicePort] = append(servicePortToIngressNameList[servicePort], ingressName) + } + } + + return servicePortToIngressNameList +} + +func (g *albconfigReconciler) buildServiceStackContext(ctx context.Context, request reconcile.Request, serverPortToIngressNames map[int32][]string) (*albmodel.ServiceStackContext, error) { + var svcStackContext = &albmodel.ServiceStackContext{ + ClusterID: g.cloud.ClusterID(), + ServiceNamespace: request.Namespace, + ServiceName: request.Name, + ServicePortToIngressNames: serverPortToIngressNames, + } + + svc := &corev1.Service{} + if err := g.k8sClient.Get(ctx, request.NamespacedName, svc); err != nil { + // if not found service, need to delete + if errors.IsNotFound(err) { + g.logger.Info("service not found", "ServiceNotFound", request.NamespacedName.Namespace+"/"+request.NamespacedName.Name) + svcStackContext.IsServiceNotFound = true + } else { + return nil, err + } + } else { + svcStackContext.Service = svc + } + + return svcStackContext, nil +} + +func (s *albconfigReconciler) buildAndApplyServers(ctx context.Context, svcStackCtx *albmodel.ServiceStackContext) error { + traceID := ctx.Value(util.TraceID) + + buildStartTime := time.Now() + s.logger.Info("start build and apply stack", + "service", svcStackCtx.ServiceNamespace+"/"+svcStackCtx.ServiceName, + "traceID", traceID, + "startTime", buildStartTime) + + serverStack, err := s.serverBuilder.Build(ctx, svcStackCtx) + if err != nil { + return fmt.Errorf("build service stack model error: %v", err) + } + + serviceStackJson, err := json.Marshal(serverStack) + if err != nil { + return err + } + + s.logger.Info("successfully built service stack", + "service", svcStackCtx.ServiceNamespace+"/"+svcStackCtx.ServiceName, + "traceID", traceID, + "stack", string(serviceStackJson), + "buildElapsedTime", time.Since(buildStartTime).Milliseconds()) + + applyStartTime := time.Now() + err = s.serverApplier.Apply(ctx, s.cloud, serverStack) + if err != nil { + return err + } + + if serverStack.ContainsPotentialReadyEndpoints { + return fmt.Errorf("retry potential ready endpoints") + } + s.logger.Info("successfully applied service stack", + "service", svcStackCtx.ServiceNamespace+"/"+svcStackCtx.ServiceName, + "traceID", traceID, + "applyElapsedTime", time.Since(applyStartTime).Milliseconds()) + + return nil +} + +func (g *albconfigReconciler) makeAlbConfig(ctx context.Context, groupName string, ing *networking.Ingress) *v1.AlbConfig { + id, _ := annotations.GetStringAnnotation(annotations.LoadBalancerId, ing) + overrideListener := false + if override, err := annotations.GetStringAnnotation(annotations.OverrideListener, ing); err == nil { + if override == "true" { + overrideListener = true + } + } + + name, _ := annotations.GetStringAnnotation(annotations.LoadBalancerName, ing) + addressType, err := annotations.GetStringAnnotation(annotations.AddressType, ing) + if err != nil { + addressType = util.LoadBalancerAddressTypeInternet + } + addressAllocatedMode, err := annotations.GetStringAnnotation(annotations.AddressAllocatedMode, ing) + if err != nil { + addressAllocatedMode = util.LoadBalancerAddressAllocatedModeDynamic + } + chargeType, err := annotations.GetStringAnnotation(annotations.ChargeType, ing) + if err != nil { + chargeType = util.LoadBalancerPayTypePostPay + } + loadBalancerEdition, err := annotations.GetStringAnnotation(annotations.LoadBalancerEdition, ing) + if err != nil { + loadBalancerEdition = util.LoadBalancerEditionStandard + } + vswitchIds, _ := annotations.GetStringAnnotation(annotations.VswitchIds, ing) + var al albmodel.AccessLog + if accessLog, err := annotations.GetStringAnnotation(annotations.AccessLog, ing); err == nil { + if err := json.Unmarshal([]byte(accessLog), &al); err != nil { + g.logger.Error(err, "Unmarshal: %s", annotations.AccessLog) + } + } + + albconfig := &v1.AlbConfig{} + albconfig.Name = groupName + albconfig.Namespace = albconfigmanager.ALBConfigNamespace + deletionProtectionEnabled := true + albconfig.Spec.LoadBalancer = &v1.LoadBalancerSpec{ + Id: id, + ForceOverride: &overrideListener, + Name: name, + AddressAllocatedMode: addressAllocatedMode, + AddressType: addressType, + DeletionProtectionEnabled: &deletionProtectionEnabled, + BillingConfig: v1.BillingConfig{ + PayType: chargeType, + }, + Edition: loadBalancerEdition, + AccessLogConfig: v1.AccessLogConfig{ + LogStore: al.LogStore, + LogProject: al.LogProject, + }, + } + vSwitchIdss := strings.Split(vswitchIds, ",") + zoneMappings := make([]v1.ZoneMapping, 0) + for _, vSwitchId := range vSwitchIdss { + zoneMappings = append(zoneMappings, v1.ZoneMapping{ + VSwitchId: vSwitchId, + }) + } + albconfig.Spec.LoadBalancer.ZoneMappings = zoneMappings + portAndProtocol, _ := albconfigmanager.ComputeIngressListenPorts(ing) + lss := make([]*v1.ListenerSpec, 0) + for port, pro := range portAndProtocol { + ls := &v1.ListenerSpec{ + Port: intstr.FromInt(int(port)), + Protocol: string(pro), + } + lss = append(lss, ls) + } + albconfig.Spec.Listeners = lss + + return albconfig +} + +func (g *albconfigReconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) { + traceID := sdkutils.GetUUID() + ctx = context.WithValue(ctx, util.TraceID, traceID) + + var err error + startTime := time.Now() + g.logger.Info("start reconcile", + "request", req.String(), + "traceID", traceID, + "startTime", startTime) + defer func() { + if err != nil { + g.logger.Error(err, "finish reconcile", + "request", req.String(), + "traceID", traceID, + "elapsedTime", time.Since(startTime).Milliseconds()) + return + } + g.logger.Info("finish reconcile", + "request", req.String(), + "traceID", traceID, + "elapsedTime", time.Since(startTime).Milliseconds()) + }() + + err = g.reconcile(ctx, req) + return reconcile.Result{}, err +} + +func (g *albconfigReconciler) reconcile(ctx context.Context, request reconcile.Request) error { + albconfig := &v1.AlbConfig{} + if err := g.k8sClient.Get(ctx, request.NamespacedName, albconfig); err != nil { + return client.IgnoreNotFound(err) + } + ings := g.store.ListIngresses() + ingGroup, err := g.groupLoader.Load(ctx, albconfigmanager.GroupID(request.NamespacedName), ings) + if err != nil { + return err + } + + if !albconfig.DeletionTimestamp.IsZero() { + if err := g.cleanupAlbLoadBalancerResources(ctx, albconfig, ingGroup); err != nil { + return err + } + } else { + if err := g.reconcileAlbLoadBalancerResources(ctx, albconfig, ingGroup); err != nil { + return err + } + } + + if len(ingGroup.InactiveMembers) != 0 { + if err := g.groupFinalizerManager.RemoveGroupFinalizer(ctx, ingGroup.InactiveMembers); err != nil { + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeWarning, helper.IngressEventReasonFailedRemoveFinalizer, helper.GetLogMessage(err)) + return err + } + } + + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeNormal, helper.IngressEventReasonSuccessfullyReconciled, "Successfully reconciled") + + return nil +} + +func (g *albconfigReconciler) cleanupAlbLoadBalancerResources(ctx context.Context, albconfig *v1.AlbConfig, ingGroup *albconfigmanager.Group) error { + acFinalizer := albconfigmanager.GetIngressFinalizer() + if helper.HasFinalizer(albconfig, acFinalizer) { + _, _, err := g.buildAndApply(ctx, albconfig, ingGroup) + if err != nil { + return err + } + if err := g.k8sFinalizerManager.RemoveFinalizers(ctx, albconfig, acFinalizer); err != nil { + g.eventRecorder.Event(albconfig, corev1.EventTypeWarning, helper.IngressEventReasonFailedRemoveFinalizer, fmt.Sprintf("Failed remove finalizer due to %v", err)) + return err + } + if len(ingGroup.Members) != 0 { + if err := g.groupFinalizerManager.RemoveGroupFinalizer(ctx, ingGroup.Members); err != nil { + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeWarning, helper.IngressEventReasonFailedRemoveFinalizer, fmt.Sprintf("Failed remove finalizer due to %v", err)) + return err + } + } + } + return nil +} + +func (g *albconfigReconciler) reconcileAlbLoadBalancerResources(ctx context.Context, albconfig *v1.AlbConfig, ingGroup *albconfigmanager.Group) error { + acFinalizer := albconfigmanager.GetIngressFinalizer() + if err := g.k8sFinalizerManager.AddFinalizers(ctx, albconfig, acFinalizer); err != nil { + g.eventRecorder.Event(albconfig, corev1.EventTypeWarning, helper.IngressEventReasonFailedRemoveFinalizer, helper.GetLogMessage(err)) + return err + } + if err := g.groupFinalizerManager.AddGroupFinalizer(ctx, ingGroup.Members); err != nil { + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeWarning, helper.IngressEventReasonFailedAddFinalizer, fmt.Sprintf("Failed add finalizer due to %v", err)) + return err + } + + _, lb, err := g.buildAndApply(ctx, albconfig, ingGroup) + if err != nil { + return err + } + if lb.Status == nil || lb.Status.DNSName == "" { + return nil + } + for _, ing := range ingGroup.Members { + if ing.Status.LoadBalancer.Ingress != nil && len(ing.Status.LoadBalancer.Ingress) > 0 && ing.Status.LoadBalancer.Ingress[0].Hostname == lb.Status.DNSName { + continue + } + lbi := corev1.LoadBalancerIngress{ + Hostname: lb.Status.DNSName, + } + ing.Status.LoadBalancer.Ingress = []corev1.LoadBalancerIngress{lbi} + err = g.k8sClient.Status().Update(ctx, ing, &client.UpdateOptions{}) + if err != nil { + g.logger.Error(err, "Ingress Status Update %s, error: %s", ing.Name) + continue + } + } + if albconfig.Status.LoadBalancer.DNSName == lb.Status.DNSName { + return nil + } + albconfig.Status.LoadBalancer.Id = lb.Status.LoadBalancerID + albconfig.Status.LoadBalancer.DNSName = lb.Status.DNSName + + err = g.k8sClient.Status().Update(ctx, albconfig, &client.UpdateOptions{}) + if err != nil { + g.logger.Error(err, "LB Status Update %s, error: %s", albconfig.Name) + return err + } + return nil +} + +func (g *albconfigReconciler) buildAndApply(ctx context.Context, albconfig *v1.AlbConfig, ingGroup *albconfigmanager.Group) (core.Manager, *albmodel.AlbLoadBalancer, error) { + traceID := ctx.Value(util.TraceID) + + buildStartTime := time.Now() + g.logger.Info("start build and apply stack", + "albconfig", util.NamespacedName(albconfig).String(), + "traceID", traceID, + "startTime", buildStartTime) + + stack, lb, err := g.albconfigBuilder.Build(ctx, albconfig, ingGroup) + if err != nil { + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeWarning, helper.IngressEventReasonFailedBuildModel, helper.GetLogMessage(err)) + return nil, nil, err + } + + stackJSON, err := g.stackMarshaller.Marshal(stack) + if err != nil { + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeWarning, helper.IngressEventReasonFailedBuildModel, helper.GetLogMessage(err)) + return nil, nil, err + } + + g.logger.Info("successfully built albconfig stack", + "albconfig", util.NamespacedName(albconfig).String(), + "traceID", &traceID, + "stack", stackJSON, + "buildElapsedTime", time.Since(buildStartTime).Milliseconds()) + + applyStartTime := time.Now() + if err := g.albconfigApplier.Apply(ctx, stack); err != nil { + g.recordIngressGroupEvent(ctx, ingGroup, corev1.EventTypeWarning, helper.IngressEventReasonFailedApplyModel, helper.GetLogMessage(err)) + return nil, nil, err + } + g.logger.Info("successfully applied albconfig stack", + "albconfig", util.NamespacedName(albconfig).String(), + "traceID", traceID, + "applyElapsedTime", time.Since(applyStartTime).Milliseconds()) + + return stack, lb, nil +} + +func (g *albconfigReconciler) recordIngressGroupEvent(_ context.Context, ingGroup *albconfigmanager.Group, eventType string, reason string, message string) { + for _, member := range ingGroup.Members { + g.eventRecorder.Event(member, eventType, reason, message) + } +} + +// Start starts a new ALB master process running in the foreground. +func (n *albconfigReconciler) Start() { + n.logger.Info("Starting ALB Ingress controller") + n.store.Run(n.stopCh) + go n.syncQueue.Run(1, time.Second, n.stopCh) + go n.syncServersQueue.Run(3, time.Second, n.stopCh) + for { + select { + case err := <-n.ngxErrCh: + if n.isShuttingDown { + return + } + n.logger.Error(err, "ErrCh received") + + case event := <-n.updateCh.Out(): + if n.isShuttingDown { + break + } + + if evt, ok := event.(helper.Event); ok { + n.logger.Info("Event received", "type", evt.Type, "object", evt.Obj) + + n.syncQueue.EnqueueSkippableTask(evt) + } else { + n.logger.Info("Unexpected event type received %T", event) + } + case <-n.stopCh: + return + } + } +} + +// Stop gracefully stops the alb master process. +func (n *albconfigReconciler) Stop() error { + n.isShuttingDown = true + + n.stopLock.Lock() + defer n.stopLock.Unlock() + + if n.syncQueue.IsShuttingDown() { + return fmt.Errorf("shutdown already in progress") + } + n.logger.Info("Shutting down controller queues") + close(n.stopCh) + go n.syncQueue.Shutdown() + + return nil +} + +type StackMarshaller interface { + Marshal(stack core.Manager) (string, error) +} + +func NewDefaultStackMarshaller() *defaultStackMarshaller { + return &defaultStackMarshaller{} +} + +var _ StackMarshaller = &defaultStackMarshaller{} + +type defaultStackMarshaller struct{} + +func (m *defaultStackMarshaller) Marshal(stack core.Manager) (string, error) { + builder := albconfigmanager.NewStackSchemaBuilder(stack.StackID()) + if err := stack.TopologicalTraversal(builder); err != nil { + return "", err + } + stackSchema := builder.Build() + payload, err := json.Marshal(stackSchema) + if err != nil { + return "", err + } + return string(payload), nil +} diff --git a/pkg/controller/ingress/event_handler.go b/pkg/controller/ingress/event_handler.go new file mode 100644 index 000000000..388953f86 --- /dev/null +++ b/pkg/controller/ingress/event_handler.go @@ -0,0 +1,71 @@ +package ingress + +import ( + "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/client-go/tools/record" + "k8s.io/client-go/util/workqueue" + v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + + "github.com/go-logr/logr" +) + +func NewEnqueueRequestsForAlbconfigEvent(k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger) *enqueueRequestsForAlbconfigEvent { + return &enqueueRequestsForAlbconfigEvent{ + k8sClient: k8sClient, + eventRecorder: eventRecorder, + logger: logger, + } +} + +var _ handler.EventHandler = (*enqueueRequestsForAlbconfigEvent)(nil) + +type enqueueRequestsForAlbconfigEvent struct { + ingressEventChan chan<- event.GenericEvent + k8sClient client.Client + eventRecorder record.EventRecorder + logger logr.Logger +} + +func (h *enqueueRequestsForAlbconfigEvent) Create(e event.CreateEvent, queue workqueue.RateLimitingInterface) { + albconfig, ok := e.Object.(*v1.AlbConfig) + if ok { + h.logger.Info("controller: albconfig Create event", "albconfig", util.NamespacedName(albconfig).String()) + h.enqueueAlbconfig(queue, albconfig) + } +} + +func (h *enqueueRequestsForAlbconfigEvent) Update(e event.UpdateEvent, queue workqueue.RateLimitingInterface) { + albconfigOld := e.ObjectOld.(*v1.AlbConfig) + albconfigNew := e.ObjectNew.(*v1.AlbConfig) + + if equality.Semantic.DeepEqual(albconfigOld.Annotations, albconfigNew.Annotations) && + equality.Semantic.DeepEqual(albconfigOld.Spec, albconfigNew.Spec) && + equality.Semantic.DeepEqual(albconfigOld.DeletionTimestamp.IsZero(), albconfigNew.DeletionTimestamp.IsZero()) { + return + } + + h.logger.Info("controller: albconfig Update event", "albconfig", util.NamespacedName(albconfigNew).String()) + h.enqueueAlbconfig(queue, albconfigNew) +} + +func (h *enqueueRequestsForAlbconfigEvent) Delete(e event.DeleteEvent, queue workqueue.RateLimitingInterface) { +} + +func (h *enqueueRequestsForAlbconfigEvent) Generic(e event.GenericEvent, queue workqueue.RateLimitingInterface) { + albconfig, ok := e.Object.(*v1.AlbConfig) + if ok { + h.logger.Info("controller: albconfig Generic event", "albconfig", util.NamespacedName(albconfig).String()) + h.enqueueAlbconfig(queue, albconfig) + } +} + +func (h *enqueueRequestsForAlbconfigEvent) enqueueAlbconfig(queue workqueue.RateLimitingInterface, albconfig *v1.AlbConfig) { + queue.Add(reconcile.Request{ + NamespacedName: util.NamespacedName(albconfig), + }) +} diff --git a/pkg/controller/ingress/ingress_controller.go b/pkg/controller/ingress/ingress_controller.go index 9527662ed..917c18095 100644 --- a/pkg/controller/ingress/ingress_controller.go +++ b/pkg/controller/ingress/ingress_controller.go @@ -2,89 +2,15 @@ package ingress import ( "context" - log "github.com/sirupsen/logrus" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/tools/record" - v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/context/shared" - "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/manager" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - "sigs.k8s.io/controller-runtime/pkg/source" ) func Add(mgr manager.Manager, ctx *shared.SharedContext) error { - return add(mgr, newReconciler(mgr, ctx)) -} - -// newReconciler returns a new reconcile.Reconciler -func newReconciler(mgr manager.Manager, ctx *shared.SharedContext) reconcile.Reconciler { - recon := &ReconcileIngress{ - cloud: ctx.Provider(), - client: mgr.GetClient(), - scheme: mgr.GetScheme(), - record: mgr.GetEventRecorderFor("Node"), - } - return recon -} - -// add adds a new Controller to mgr with r as the reconcile.Reconciler -func add(mgr manager.Manager, r reconcile.Reconciler) error { - // Create a new controller - c, err := controller.New( - "ingress-controller", mgr, - controller.Options{ - Reconciler: r, - MaxConcurrentReconciles: 1, - }, - ) + albconfigReconciler, err := NewAlbConfigReconciler(mgr, ctx) if err != nil { return err } - - // Watch for changes to primary resource AutoRepair - return c.Watch( - &source.Kind{ - Type: &v1.AckIngress{}, - }, - &handler.EnqueueRequestForObject{}, - ) -} - -// ReconcileIngress implements reconcile.Reconciler -var _ reconcile.Reconciler = &ReconcileIngress{} - -// ReconcileIngress reconciles a AutoRepair object -type ReconcileIngress struct { - cloud prvd.Provider - client client.Client - scheme *runtime.Scheme - - //record event recorder - record record.EventRecorder -} - -func (r *ReconcileIngress) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { - rlog := log.WithFields(log.Fields{"AckIngress": request.NamespacedName}) - rlog.Infof("ackingress watched: %s", request.NamespacedName) - nodepool := &v1.AckIngress{} - err := r.client.Get(context.TODO(), request.NamespacedName, nodepool) - if err != nil { - if errors.IsNotFound(err) { - rlog.Infof("Ingress not found, skip") - // Request object not found, could have been deleted - // after reconcile request. - // Owned objects are automatically garbage collected. - // For additional cleanup logic use finalizers. - // Return and don't requeue - return reconcile.Result{}, nil - } - return reconcile.Result{}, err - } - - return reconcile.Result{}, nil + return albconfigReconciler.SetupWithManager(context.Background(), mgr) } diff --git a/pkg/controller/ingress/reconcile/annotations/annotations.go b/pkg/controller/ingress/reconcile/annotations/annotations.go new file mode 100644 index 000000000..e408eac46 --- /dev/null +++ b/pkg/controller/ingress/reconcile/annotations/annotations.go @@ -0,0 +1,184 @@ +package annotations + +import ( + "fmt" + "strings" + + corev1 "k8s.io/api/core/v1" + "k8s.io/klog" +) + +// prefix +const ( + // DefaultAnnotationsPrefix defines the common prefix used in the nginx ingress controller + DefaultAnnotationsPrefix = "alb.ingress.kubernetes.io" + + // AnnotationLegacyPrefix legacy prefix of service annotation + AnnotationLegacyPrefix = "service.beta.kubernetes.io/alicloud" + // AnnotationPrefix prefix of service annotation + AnnotationPrefix = "service.beta.kubernetes.io/alibaba-cloud" +) + +const ( + TAGKEY = "kubernetes.do.not.delete" + ACKKEY = "ack.aliyun.com" + PostPay = "PostPay" +) +const ( + INGRESS_ALB_ANNOTATIONS = "alb.ingress.kubernetes.io/lb" + // config the rule conditions + INGRESS_ALB_CONDITIONS_ANNOTATIONS = "alb.ingress.kubernetes.io/conditions.%s" + // config the rule actions + INGRESS_ALB_ACTIONS_ANNOTATIONS = "alb.ingress.kubernetes.io/actions.%s" + // config the certificate id + INGRESS_ALB_CERTIFICATE_ANNOTATIONS = "alb.ingress.kubernetes.io/certificate-id" +) + +// load balancer annotations +const ( + // AnnotationLoadBalancerPrefix loadbalancer prefix + AnnotationLoadBalancerPrefix = "alb.ingress.kubernetes.io/" + + // Load Balancer Attribute + AddressType = AnnotationLoadBalancerPrefix + "address-type" // AddressType loadbalancer address type + VswitchIds = AnnotationLoadBalancerPrefix + "vswitch-ids" // VswitchId loadbalancer vswitch id + SLBNetworkType = AnnotationLoadBalancerPrefix + "slb-network-type" // SLBNetworkType loadbalancer network type + ChargeType = AnnotationLoadBalancerPrefix + "charge-type" // ChargeType lb charge type + LoadBalancerId = AnnotationLoadBalancerPrefix + "id" // LoadBalancerId lb id + OverrideListener = AnnotationLoadBalancerPrefix + "force-override-listeners" // OverrideListener force override listeners + LoadBalancerName = AnnotationLoadBalancerPrefix + "name" // LoadBalancerName slb name + MasterZoneID = AnnotationLoadBalancerPrefix + "master-zoneid" // MasterZoneID master zone id + SlaveZoneID = AnnotationLoadBalancerPrefix + "slave-zoneid" // SlaveZoneID slave zone id + Bandwidth = AnnotationLoadBalancerPrefix + "bandwidth" // Bandwidth bandwidth + AdditionalTags = AnnotationLoadBalancerPrefix + "additional-resource-tags" // AdditionalTags For example: "Key1=Val1,Key2=Val2,KeyNoVal1=,KeyNoVal2",same with aws + Spec = AnnotationLoadBalancerPrefix + "spec" // Spec slb spec + Scheduler = AnnotationLoadBalancerPrefix + "scheduler" // Scheduler slb scheduler + IPVersion = AnnotationLoadBalancerPrefix + "ip-version" // IPVersion ip version + ResourceGroupId = AnnotationLoadBalancerPrefix + "resource-group-id" // ResourceGroupId resource group id + DeleteProtection = AnnotationLoadBalancerPrefix + "delete-protection" // DeleteProtection delete protection + ModificationProtection = AnnotationLoadBalancerPrefix + "modification-protection" // ModificationProtection modification type + ExternalIPType = AnnotationLoadBalancerPrefix + "external-ip-type" // ExternalIPType external ip type + AddressAllocatedMode = AnnotationLoadBalancerPrefix + "address-allocated-mode" + LoadBalancerEdition = AnnotationLoadBalancerPrefix + "edition" + HTTPS = AnnotationLoadBalancerPrefix + "backend-protocol" + ListenPorts = AnnotationLoadBalancerPrefix + "listen-ports" + AccessLog = AnnotationLoadBalancerPrefix + "access-log" + // Listener Attribute + AclStatus = AnnotationLoadBalancerPrefix + "acl-status" // AclStatus enable or disable acl on all listener + AclID = AnnotationLoadBalancerPrefix + "acl-id" // AclID acl id + AclType = AnnotationLoadBalancerPrefix + "acl-type" // AclType acl type, black or white + ProtocolPort = AnnotationLoadBalancerPrefix + "protocol-port" // ProtocolPort protocol port + ForwardPort = AnnotationLoadBalancerPrefix + "forward-port" // ForwardPort loadbalancer forward port + CertID = AnnotationLoadBalancerPrefix + "cert-id" // CertID cert id + HealthCheckEnabled = AnnotationLoadBalancerPrefix + "healthcheck-enabled" // HealthCheckFlag health check flag + HealthCheckPath = AnnotationLoadBalancerPrefix + "healthcheck-path" // HealthCheckType health check type + HealthCheckPort = AnnotationLoadBalancerPrefix + "healthcheck-port" // HealthCheckURI health check uri + HealthCheckProtocol = AnnotationLoadBalancerPrefix + "healthcheck-protocol" // HealthCheckConnectPort health check connect port + HealthCheckMethod = AnnotationLoadBalancerPrefix + "healthcheck-method" // HealthyThreshold health check healthy thresh hold + HealthCheckInterval = AnnotationLoadBalancerPrefix + "healthcheck-interval-seconds" // HealthCheckInterval health check interval + HealthCheckTimeout = AnnotationLoadBalancerPrefix + "healthcheck-timeout-seconds" // HealthCheckTimeout health check timeout + HealthThreshold = AnnotationLoadBalancerPrefix + "healthy-threshold-count" // HealthCheckDomain health check domain + UnHealthThreshold = AnnotationLoadBalancerPrefix + "unhealthy-threshold-count" // HealthCheckHTTPCode health check http code + HealthCheckHTTPCode = AnnotationLoadBalancerPrefix + "healthcheck-httpcode" + SessionStick = AnnotationLoadBalancerPrefix + "sticky-session" // SessionStick sticky session + SessionStickType = AnnotationLoadBalancerPrefix + "sticky-session-type" // SessionStickType session sticky type + CookieTimeout = AnnotationLoadBalancerPrefix + "cookie-timeout" // CookieTimeout cookie timeout + Cookie = AnnotationLoadBalancerPrefix + "cookie" // Cookie lb cookie + PersistenceTimeout = AnnotationLoadBalancerPrefix + "persistence-timeout" // PersistenceTimeout persistence timeout + ConnectionDrain = AnnotationLoadBalancerPrefix + "connection-drain" // ConnectionDrain connection drain + ConnectionDrainTimeout = AnnotationLoadBalancerPrefix + "connection-drain-timeout" // ConnectionDrainTimeout connection drain timeout + PortVGroup = AnnotationLoadBalancerPrefix + "port-vgroup" // VGroupIDs binding user managed vGroup ids to ports + + // VServerBackend Attribute + BackendLabel = AnnotationLoadBalancerPrefix + "backend-label" // BackendLabel backend labels + BackendType = "service.beta.kubernetes.io/backend-type" // BackendType backend type + RemoveUnscheduled = AnnotationLoadBalancerPrefix + "remove-unscheduled-backend" // RemoveUnscheduled remove unscheduled node from backends + VGroupWeight = AnnotationLoadBalancerPrefix + "vgroup-weight" // VGroupWeight total weight of a vGroup +) + +const ( + AnnotationNginxPrefix = "nginx.ingress.kubernetes.io/" + NginxCanary = AnnotationNginxPrefix + "canary" + NginxCanaryByHeader = AnnotationNginxPrefix + "canary-by-header" + NginxCanaryByHeaderValue = AnnotationNginxPrefix + "canary-by-header-value" + NginxCanaryByCookie = AnnotationNginxPrefix + "canary-by-cookie" + NginxCanaryWeight = AnnotationNginxPrefix + "canary-weight" + NginxSslRedirect = AnnotationNginxPrefix + "ssl-redirect" + + AnnotationAlbPrefix = "alb.ingress.kubernetes.io/" + AlbCanary = AnnotationAlbPrefix + "canary" + AlbCanaryByHeader = AnnotationAlbPrefix + "canary-by-header" + AlbCanaryByHeaderValue = AnnotationAlbPrefix + "canary-by-header-value" + AlbCanaryByCookie = AnnotationAlbPrefix + "canary-by-cookie" + AlbCanaryWeight = AnnotationAlbPrefix + "canary-weight" + AlbSslRedirect = AnnotationAlbPrefix + "ssl-redirect" +) +const ( + // ServiceAnnotationPrivateZonePrefix private zone prefix + ServiceAnnotationPrivateZonePrefix = "private-zone-" + // ServiceAnnotationLoadBalancerPrivateZoneName private zone name + PrivateZoneName = ServiceAnnotationPrivateZonePrefix + "name" + + // ServiceAnnotationLoadBalancerPrivateZoneId private zone id + PrivateZoneId = ServiceAnnotationPrivateZonePrefix + "id" + + // ServiceAnnotationLoadBalancerPrivateZoneRecordName private zone record name + PrivateZoneRecordName = ServiceAnnotationPrivateZonePrefix + "record-name" + + // ServiceAnnotationLoadBalancerPrivateZoneRecordTTL private zone record ttl + PrivateZoneRecordTTL = ServiceAnnotationPrivateZonePrefix + "record-ttl" +) + +func NewAnnotationRequest(svc *corev1.Service) *AnnotationRequest { + return &AnnotationRequest{svc} +} + +func (n *AnnotationRequest) Get(k string) string { + if n.Svc == nil { + klog.Infof("extract annotation %s from empty service", k) + return "" + } + + if n.Svc.Annotations == nil { + return "" + } + + key := composite(AnnotationPrefix, k) + v, ok := n.Svc.Annotations[key] + if ok { + return v + } + + lkey := composite(AnnotationLegacyPrefix, k) + v, ok = n.Svc.Annotations[lkey] + if ok { + return v + } + + return "" +} + +func (n *AnnotationRequest) GetRaw(k string) string { + return n.Svc.Annotations[k] +} + +func (n *AnnotationRequest) GetDefaultLoadBalancerName() string { + //GCE requires that the name of a load balancer starts with a lower case letter. + ret := "a" + string(n.Svc.UID) + ret = strings.Replace(ret, "-", "", -1) + //AWS requires that the name of a load balancer is shorter than 32 bytes. + if len(ret) > 32 { + ret = ret[:32] + } + return ret +} + +func composite(p, k string) string { + return fmt.Sprintf("%s-%s", p, k) +} + +func Annotation(k string) string { + return composite(AnnotationPrefix, k) +} + +type AnnotationRequest struct{ Svc *corev1.Service } diff --git a/pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go b/pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go new file mode 100644 index 000000000..cacd37e5b --- /dev/null +++ b/pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go @@ -0,0 +1,40 @@ +package annotations + +import ( + networking "k8s.io/api/networking/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" +) + +type ClassAnnotationMatcher interface { + Matches(ingClassAnnotation string) bool +} + +func NewDefaultClassAnnotationMatcher(ingressClass string) *defaultClassAnnotationMatcher { + return &defaultClassAnnotationMatcher{ + ingressClass: ingressClass, + } +} + +var _ ClassAnnotationMatcher = &defaultClassAnnotationMatcher{} + +type defaultClassAnnotationMatcher struct { + ingressClass string +} + +func (m *defaultClassAnnotationMatcher) Matches(ingClassAnnotation string) bool { + if m.ingressClass == "" && ingClassAnnotation == util.IngressClassALB { + return true + } + return ingClassAnnotation == m.ingressClass +} + +func IsIngressAlbClass(ing networking.Ingress) bool { + classAnnotationMatcher := NewDefaultClassAnnotationMatcher(util.IngressClassALB) + + if ingClassAnnotation, exists := ing.Annotations[util.IngressClass]; exists { + if matchesIngressClass := classAnnotationMatcher.Matches(ingClassAnnotation); matchesIngressClass { + return true + } + } + return false +} diff --git a/pkg/controller/ingress/reconcile/annotations/parser.go b/pkg/controller/ingress/reconcile/annotations/parser.go new file mode 100644 index 000000000..84778aaaf --- /dev/null +++ b/pkg/controller/ingress/reconcile/annotations/parser.go @@ -0,0 +1,426 @@ +package annotations + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + "strings" + + "github.com/pkg/errors" + networking "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/util/sets" +) + +type ParseOptions struct { + exact bool + alternativePrefixes []string +} + +type ParseOption func(opts *ParseOptions) + +func WithExact() ParseOption { + return func(opts *ParseOptions) { + opts.exact = true + } +} + +func WithAlternativePrefixes(prefixes ...string) ParseOption { + return func(opts *ParseOptions) { + opts.alternativePrefixes = append(opts.alternativePrefixes, prefixes...) + } +} + +type Parser interface { + ParseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) bool + + ParseBoolAnnotation(annotation string, value *bool, annotations map[string]string, opts ...ParseOption) (bool, error) + + ParseInt64Annotation(annotation string, value *int64, annotations map[string]string, opts ...ParseOption) (bool, error) + + ParseStringSliceAnnotation(annotation string, value *[]string, annotations map[string]string, opts ...ParseOption) bool + + ParseJSONAnnotation(annotation string, value interface{}, annotations map[string]string, opts ...ParseOption) (bool, error) + + ParseStringMapAnnotation(annotation string, value *map[string]string, annotations map[string]string, opts ...ParseOption) (bool, error) +} + +func NewSuffixAnnotationParser(annotationPrefix string) *suffixAnnotationParser { + return &suffixAnnotationParser{ + annotationPrefix: annotationPrefix, + } +} + +var _ Parser = (*suffixAnnotationParser)(nil) + +type suffixAnnotationParser struct { + annotationPrefix string +} + +func (p *suffixAnnotationParser) ParseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) bool { + ret, _ := p.parseStringAnnotation(annotation, value, annotations, opts...) + return ret +} + +func (p *suffixAnnotationParser) ParseBoolAnnotation(annotation string, value *bool, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + val, err := strconv.ParseBool(raw) + if err != nil { + return true, errors.Wrapf(err, "failed to parse bool annotation, %v: %v", matchedKey, raw) + } + *value = val + return true, nil +} + +func (p *suffixAnnotationParser) ParseInt64Annotation(annotation string, value *int64, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + i, err := strconv.ParseInt(raw, 10, 64) + if err != nil { + return true, errors.Wrapf(err, "failed to parse int64 annotation, %v: %v", matchedKey, raw) + } + *value = i + return true, nil +} + +func (p *suffixAnnotationParser) ParseStringSliceAnnotation(annotation string, value *[]string, annotations map[string]string, opts ...ParseOption) bool { + raw := "" + if exists, _ := p.parseStringAnnotation(annotation, &raw, annotations, opts...); !exists { + return false + } + *value = splitCommaSeparatedString(raw) + return true +} + +func (p *suffixAnnotationParser) ParseJSONAnnotation(annotation string, value interface{}, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + if err := json.Unmarshal([]byte(raw), value); err != nil { + return true, errors.Wrapf(err, "failed to parse json annotation, %v: %v", matchedKey, raw) + } + return true, nil +} + +func (p *suffixAnnotationParser) ParseStringMapAnnotation(annotation string, value *map[string]string, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + rawKVPairs := splitCommaSeparatedString(raw) + keyValues := make(map[string]string) + for _, kvPair := range rawKVPairs { + parts := strings.SplitN(kvPair, "=", 2) + if len(parts) != 2 { + return false, errors.Errorf("failed to parse stringMap annotation, %v: %v", matchedKey, raw) + } + key := parts[0] + value := parts[1] + if len(key) == 0 { + return false, errors.Errorf("failed to parse stringMap annotation, %v: %v", matchedKey, raw) + } + keyValues[key] = value + } + if value != nil { + *value = keyValues + } + return true, nil +} + +func (p *suffixAnnotationParser) parseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) (bool, string) { + keys := p.buildAnnotationKeys(annotation, opts...) + for _, key := range keys { + if raw, ok := annotations[key]; ok { + *value = raw + return true, key + } + } + return false, "" +} + +// buildAnnotationKey returns list of full annotation keys based on suffix and parse options +func (p *suffixAnnotationParser) buildAnnotationKeys(suffix string, opts ...ParseOption) []string { + keys := []string{} + parseOpts := ParseOptions{} + for _, opt := range opts { + opt(&parseOpts) + } + if parseOpts.exact { + keys = append(keys, suffix) + } else { + keys = append(keys, fmt.Sprintf("%v/%v", p.annotationPrefix, suffix)) + for _, pfx := range parseOpts.alternativePrefixes { + keys = append(keys, fmt.Sprintf("%v/%v", pfx, suffix)) + } + } + return keys +} + +func splitCommaSeparatedString(commaSeparatedString string) []string { + var result []string + parts := strings.Split(commaSeparatedString, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if len(part) == 0 { + continue + } + result = append(result, part) + } + return result +} + +var ( + // AnnotationsPrefix is the mutable attribute that the controller explicitly refers to + AnnotationsPrefix = DefaultAnnotationsPrefix +) + +// IngressAnnotation has a method to parse annotations located in Ingress +type IngressAnnotation interface { + Parse(ing *networking.Ingress) (interface{}, error) +} + +type ingAnnotations map[string]string + +func (a ingAnnotations) parseBool(name string) (bool, error) { + val, ok := a[name] + if ok { + b, err := strconv.ParseBool(val) + if err != nil { + return false, NewInvalidAnnotationContent(name, val) + } + return b, nil + } + return false, ErrMissingAnnotations +} + +func (a ingAnnotations) parseString(name string) (string, error) { + val, ok := a[name] + if ok { + s := normalizeString(val) + if len(s) == 0 { + return "", NewInvalidAnnotationContent(name, val) + } + + return s, nil + } + return "", ErrMissingAnnotations +} + +func (a ingAnnotations) parseInt(name string) (int, error) { + val, ok := a[name] + if ok { + i, err := strconv.Atoi(val) + if err != nil { + return 0, NewInvalidAnnotationContent(name, val) + } + return i, nil + } + return 0, ErrMissingAnnotations +} + +func checkAnnotation(name string, ing *networking.Ingress) error { + if ing == nil || len(ing.GetAnnotations()) == 0 { + return ErrMissingAnnotations + } + if name == "" { + return ErrInvalidAnnotationName + } + + return nil +} + +// GetBoolAnnotation extracts a boolean from an Ingress annotation +func GetBoolAnnotation(name string, ing *networking.Ingress) (bool, error) { + v := GetAnnotationWith(name) + err := checkAnnotation(v, ing) + if err != nil { + return false, err + } + return ingAnnotations(ing.GetAnnotations()).parseBool(v) +} + +// GetStringAnnotation extracts a string from an Ingress annotation +func GetStringAnnotation(name string, ing *networking.Ingress) (string, error) { + v := GetAnnotationWith(name) + err := checkAnnotation(v, ing) + if err != nil { + return "", err + } + + return ingAnnotations(ing.GetAnnotations()).parseString(v) +} + +// GetStringAnnotationMutil extracts a string from an Ingress annotation +func GetStringAnnotationMutil(name, name1 string, ing *networking.Ingress) string { + if val, ok := ing.Annotations[name]; ok { + return val + } + if val, ok := ing.Annotations[name1]; ok { + return val + } + return "" +} + +// GetIntAnnotation extracts an int from an Ingress annotation +func GetIntAnnotation(name string, ing *networking.Ingress) (int, error) { + v := GetAnnotationWith(name) + err := checkAnnotation(v, ing) + if err != nil { + return 0, err + } + return ingAnnotations(ing.GetAnnotations()).parseInt(v) +} + +// GetAnnotationWith returns the ingress annotations +func GetAnnotationWith(ann string) string { + return fmt.Sprintf("%v", ann) +} + +func normalizeString(input string) string { + trimmedContent := []string{} + for _, line := range strings.Split(input, "\n") { + trimmedContent = append(trimmedContent, strings.TrimSpace(line)) + } + + return strings.Join(trimmedContent, "\n") +} + +var configmapAnnotations = sets.NewString( + "auth-proxy-set-header", + "fastcgi-params-configmap", +) + +// AnnotationsReferencesConfigmap checks if at least one annotation in the Ingress rule +// references a configmap. +func AnnotationsReferencesConfigmap(ing *networking.Ingress) bool { + if ing == nil || len(ing.GetAnnotations()) == 0 { + return false + } + + for name := range ing.GetAnnotations() { + if configmapAnnotations.Has(name) { + return true + } + } + + return false +} + +// StringToURL parses the provided string into URL and returns error +// message in case of failure +func StringToURL(input string) (*url.URL, error) { + parsedURL, err := url.Parse(input) + if err != nil { + return nil, fmt.Errorf("%v is not a valid URL: %v", input, err) + } + + if parsedURL.Scheme == "" { + return nil, fmt.Errorf("url scheme is empty") + } else if parsedURL.Host == "" { + return nil, fmt.Errorf("url host is empty") + } else if strings.Contains(parsedURL.Host, "..") { + return nil, fmt.Errorf("invalid url host") + } + + return parsedURL, nil +} + +var ( + // ErrMissingAnnotations the ingress rule does not contain annotations + // This is an error only when annotations are being parsed + ErrMissingAnnotations = errors.New("ingress rule without annotations") + + // ErrInvalidAnnotationName the ingress rule does contains an invalid + // annotation name + ErrInvalidAnnotationName = errors.New("invalid annotation name") +) + +// NewInvalidAnnotationConfiguration returns a new InvalidConfiguration error for use when +// annotations are not correctly configured +func NewInvalidAnnotationConfiguration(name string, reason string) error { + return InvalidConfiguration{ + Name: fmt.Sprintf("the annotation %v does not contain a valid configuration: %v", name, reason), + } +} + +// NewInvalidAnnotationContent returns a new InvalidContent error +func NewInvalidAnnotationContent(name string, val interface{}) error { + return InvalidContent{ + Name: fmt.Sprintf("the annotation %v does not contain a valid value (%v)", name, val), + } +} + +// NewLocationDenied returns a new LocationDenied error +func NewLocationDenied(reason string) error { + return LocationDenied{ + Reason: errors.Errorf("Location denied, reason: %v", reason), + } +} + +// InvalidConfiguration Error +type InvalidConfiguration struct { + Name string +} + +func (e InvalidConfiguration) Error() string { + return e.Name +} + +// InvalidContent error +type InvalidContent struct { + Name string +} + +func (e InvalidContent) Error() string { + return e.Name +} + +// LocationDenied error +type LocationDenied struct { + Reason error +} + +func (e LocationDenied) Error() string { + return e.Reason.Error() +} + +// IsLocationDenied checks if the err is an error which +// indicates a location should return HTTP code 503 +func IsLocationDenied(e error) bool { + _, ok := e.(LocationDenied) + return ok +} + +// IsMissingAnnotations checks if the err is an error which +// indicates the ingress does not contain annotations +func IsMissingAnnotations(e error) bool { + return e == ErrMissingAnnotations +} + +// IsInvalidContent checks if the err is an error which +// indicates an annotations value is not valid +func IsInvalidContent(e error) bool { + _, ok := e.(InvalidContent) + return ok +} + +// New returns a new error +func New(m string) error { + return errors.New(m) +} + +// Errorf formats according to a format specifier and returns the string +// as a value that satisfies error. +func Errorf(format string, args ...interface{}) error { + return errors.Errorf(format, args...) +} diff --git a/pkg/controller/ingress/reconcile/applier/alb.go b/pkg/controller/ingress/reconcile/applier/alb.go new file mode 100644 index 000000000..fdf986039 --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/alb.go @@ -0,0 +1,190 @@ +package applier + +import ( + "context" + "fmt" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + "github.com/go-logr/logr" + "github.com/pkg/errors" + "k8s.io/apimachinery/pkg/util/sets" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" +) + +func NewAlbLoadBalancerApplier(albProvider prvd.Provider, trackingProvider tracking.TrackingProvider, stack core.Manager, logger logr.Logger) *albLoadBalancerApplier { + return &albLoadBalancerApplier{ + albProvider: albProvider, + trackingProvider: trackingProvider, + stack: stack, + logger: logger, + } +} + +type albLoadBalancerApplier struct { + albProvider prvd.Provider + trackingProvider tracking.TrackingProvider + stack core.Manager + logger logr.Logger +} + +func (s *albLoadBalancerApplier) Apply(ctx context.Context) error { + traceID := ctx.Value(util.TraceID) + + var resLBs []*albmodel.AlbLoadBalancer + s.stack.ListResources(&resLBs) + + if len(resLBs) > 1 { + return fmt.Errorf("invalid res loadBalancers, at most one loadBalancer for stack: %s", s.stack.StackID()) + } + + sdkLBs, err := s.findSDKAlbLoadBalancers(ctx) + if err != nil { + return err + } + if len(sdkLBs) > 1 { + stackID := s.stack.StackID() + return fmt.Errorf("invalid sdk loadBalancers: %v, at most one loadBalancer can find by stack tag: %s, must delete manually", sdkLBs, stackID) + } + + matchedResAndSDKLBs, unmatchedResLBs, unmatchedSDKLBs, err := matchResAndSDKAlbLoadBalancers(resLBs, sdkLBs, s.trackingProvider.ResourceIDTagKey()) + if err != nil { + return err + } + + if len(matchedResAndSDKLBs) != 0 { + s.logger.V(util.SynLogLevel).Info("synthesize loadBalancers", + "matchedResAndSDKLBs", matchedResAndSDKLBs, + "traceID", traceID) + } + if len(unmatchedResLBs) != 0 { + s.logger.V(util.SynLogLevel).Info("synthesize loadBalancers", + "unmatchedResLBs", unmatchedResLBs, + "traceID", traceID) + } + if len(unmatchedSDKLBs) != 0 { + s.logger.V(util.SynLogLevel).Info("synthesize loadBalancers", + "unmatchedSDKLBs", unmatchedSDKLBs, + "traceID", traceID) + } + + for _, sdkLB := range unmatchedSDKLBs { + if err := s.albProvider.DeleteALB(ctx, sdkLB.LoadBalancerId); err != nil { + return err + } + } + for _, resLB := range unmatchedResLBs { + var isReuseLb bool + if len(resLB.Spec.LoadBalancerId) != 0 { + isReuseLb = true + } + if isReuseLb { + lbStatus, err := s.albProvider.ReuseALB(ctx, resLB, resLB.Spec.LoadBalancerId, s.trackingProvider) + if err != nil { + return err + } + resLB.SetStatus(lbStatus) + continue + } + + lbStatus, err := s.albProvider.CreateALB(ctx, resLB, s.trackingProvider) + if err != nil { + return err + } + resLB.SetStatus(lbStatus) + } + for _, resAndSDKLB := range matchedResAndSDKLBs { + var isReuseLb bool + if len(resAndSDKLB.resLB.Spec.LoadBalancerId) != 0 { + isReuseLb = true + } + if isReuseLb { + if resAndSDKLB.resLB.Spec.ForceOverride != nil && !*resAndSDKLB.resLB.Spec.ForceOverride { + resAndSDKLB.resLB.SetStatus(albmodel.LoadBalancerStatus{ + LoadBalancerID: resAndSDKLB.sdkLB.LoadBalancerId, + DNSName: resAndSDKLB.sdkLB.DNSName, + }) + continue + } + } + + lbStatus, err := s.albProvider.UpdateALB(ctx, resAndSDKLB.resLB, resAndSDKLB.sdkLB.LoadBalancer) + if err != nil { + return err + } + resAndSDKLB.resLB.SetStatus(lbStatus) + } + return nil +} + +func (s *albLoadBalancerApplier) PostApply(ctx context.Context) error { + return nil +} + +func (s *albLoadBalancerApplier) findSDKAlbLoadBalancers(ctx context.Context) ([]albmodel.AlbLoadBalancerWithTags, error) { + stackTags := s.trackingProvider.StackTags(s.stack) + return s.albProvider.ListALBsWithTags(ctx, stackTags) +} + +type resAndSDKLoadBalancerPair struct { + resLB *albmodel.AlbLoadBalancer + sdkLB *albmodel.AlbLoadBalancerWithTags +} + +func matchResAndSDKAlbLoadBalancers(resLBs []*albmodel.AlbLoadBalancer, sdkLBs []albmodel.AlbLoadBalancerWithTags, resourceIDTagKey string) ([]resAndSDKLoadBalancerPair, []*albmodel.AlbLoadBalancer, []albmodel.AlbLoadBalancerWithTags, error) { + var matchedResAndSDKLBs []resAndSDKLoadBalancerPair + var unmatchedResLBs []*albmodel.AlbLoadBalancer + var unmatchedSDKLBs []albmodel.AlbLoadBalancerWithTags + + resLBsByID := mapResAlbLoadBalancerByResourceID(resLBs) + sdkLBsByID, err := mapSDKAlbLoadBalancerByResourceID(sdkLBs, resourceIDTagKey) + if err != nil { + return nil, nil, nil, err + } + + resLBIDs := sets.StringKeySet(resLBsByID) + sdkLBIDs := sets.StringKeySet(sdkLBsByID) + for _, resID := range resLBIDs.Intersection(sdkLBIDs).List() { + resLB := resLBsByID[resID] + sdkLBs := sdkLBsByID[resID] + for _, sdkLB := range sdkLBs { + matchedResAndSDKLBs = append(matchedResAndSDKLBs, resAndSDKLoadBalancerPair{ + resLB: resLB, + sdkLB: &sdkLB, + }) + } + } + for _, resID := range resLBIDs.Difference(sdkLBIDs).List() { + unmatchedResLBs = append(unmatchedResLBs, resLBsByID[resID]) + } + for _, resID := range sdkLBIDs.Difference(resLBIDs).List() { + unmatchedSDKLBs = append(unmatchedSDKLBs, sdkLBsByID[resID]...) + } + + return matchedResAndSDKLBs, unmatchedResLBs, unmatchedSDKLBs, nil +} + +func mapResAlbLoadBalancerByResourceID(resLBs []*albmodel.AlbLoadBalancer) map[string]*albmodel.AlbLoadBalancer { + resLBsByID := make(map[string]*albmodel.AlbLoadBalancer, len(resLBs)) + for _, resLB := range resLBs { + resLBsByID[resLB.ID()] = resLB + } + return resLBsByID +} + +func mapSDKAlbLoadBalancerByResourceID(sdkLBs []albmodel.AlbLoadBalancerWithTags, resourceIDTagKey string) (map[string][]albmodel.AlbLoadBalancerWithTags, error) { + sdkLBsByID := make(map[string][]albmodel.AlbLoadBalancerWithTags, len(sdkLBs)) + for _, sdkLB := range sdkLBs { + resourceID, ok := sdkLB.Tags[resourceIDTagKey] + if !ok { + return nil, errors.Errorf("unexpected loadBalancer with no resourceID: %v", sdkLB.LoadBalancer.LoadBalancerId) + } + sdkLBsByID[resourceID] = append(sdkLBsByID[resourceID], sdkLB) + } + return sdkLBsByID, nil +} diff --git a/pkg/controller/ingress/reconcile/applier/albconfig.go b/pkg/controller/ingress/reconcile/applier/albconfig.go new file mode 100644 index 000000000..a6ad74bd4 --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/albconfig.go @@ -0,0 +1,94 @@ +package applier + +import ( + "context" + "fmt" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/backend" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/go-logr/logr" +) + +type AlbConfigManagerApplier interface { + Apply(ctx context.Context, stack core.Manager) error +} + +var _ AlbConfigManagerApplier = &defaultAlbConfigManagerApplier{} + +func NewAlbConfigManagerApplier(store store.Storer, kubeClient client.Client, provider prvd.Provider, tagPrefix string, logger logr.Logger) *defaultAlbConfigManagerApplier { + trackingProvider := tracking.NewDefaultProvider(tagPrefix, provider.ClusterID()) + backendManager := backend.NewBackendManager(store, kubeClient, provider, logger) + return &defaultAlbConfigManagerApplier{ + trackingProvider: trackingProvider, + backendManager: *backendManager, + kubeClient: kubeClient, + albProvider: provider, + logger: logger, + } +} + +type defaultAlbConfigManagerApplier struct { + kubeClient client.Client + + trackingProvider tracking.TrackingProvider + backendManager backend.Manager + albProvider prvd.Provider + + logger logr.Logger +} + +type ResourceApply interface { + Apply(ctx context.Context) error + PostApply(ctx context.Context) error +} + +func (m *defaultAlbConfigManagerApplier) Apply(ctx context.Context, stack core.Manager) error { + + // Reuse LoadBalancer + var resLBs []*albmodel.AlbLoadBalancer + stack.ListResources(&resLBs) + if len(resLBs) > 1 { + return fmt.Errorf("invalid res loadBalancers, at most one loadBalancer for stack: %s", stack.StackID()) + } else if len(resLBs) == 1 { + resLb := resLBs[0] + var isReuseLb bool + if len(resLb.Spec.LoadBalancerId) != 0 { + isReuseLb = true + } + if isReuseLb { + if resLb.Spec.ForceOverride != nil && !*resLb.Spec.ForceOverride { + applier := NewAlbLoadBalancerApplier(m.albProvider, m.trackingProvider, stack, m.logger) + return applier.Apply(ctx) + } + } + } + + appliers := []ResourceApply{ + NewServerGroupApplier(m.kubeClient, m.backendManager, m.albProvider, m.trackingProvider, stack, m.logger), + NewAlbLoadBalancerApplier(m.albProvider, m.trackingProvider, stack, m.logger), + NewListenerApplier(m.albProvider, stack, m.logger), + NewListenerRuleApplier(m.albProvider, stack, m.logger), + } + + for _, applier := range appliers { + if err := applier.Apply(ctx); err != nil { + return err + } + } + + for i := len(appliers) - 1; i >= 0; i-- { + if err := appliers[i].PostApply(ctx); err != nil { + return err + } + } + + return nil +} diff --git a/pkg/controller/ingress/reconcile/applier/listener.go b/pkg/controller/ingress/reconcile/applier/listener.go new file mode 100644 index 000000000..908b98368 --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/listener.go @@ -0,0 +1,231 @@ +package applier + +import ( + "context" + "fmt" + "sync" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/util/sets" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" +) + +func NewListenerApplier(albProvider prvd.Provider, stack core.Manager, logger logr.Logger) *listenerApplier { + return &listenerApplier{ + albProvider: albProvider, + stack: stack, + logger: logger, + } +} + +type listenerApplier struct { + albProvider prvd.Provider + stack core.Manager + logger logr.Logger +} + +func (s *listenerApplier) Apply(ctx context.Context) error { + var resLSs []*albmodel.Listener + s.stack.ListResources(&resLSs) + + resLSsByLbID, err := mapResListenerByAlbLoadBalancerID(ctx, resLSs) + if err != nil { + return err + } + + if len(resLSsByLbID) == 0 { + resLSsByLbID = make(map[string][]*albmodel.Listener) + var resLBs []*albmodel.AlbLoadBalancer + s.stack.ListResources(&resLBs) + if len(resLBs) == 0 { + return nil + } + lbID, err := resLBs[0].LoadBalancerID().Resolve(ctx) + if err != nil { + return err + } + resLSsByLbID[lbID] = make([]*albmodel.Listener, 0) + } + + for lbID, resLSs := range resLSsByLbID { + if err := s.applyListenersOnLB(ctx, lbID, resLSs); err != nil { + return err + } + } + + return nil +} + +func (s *listenerApplier) PostApply(ctx context.Context) error { + return nil +} + +func (s *listenerApplier) applyListenersOnLB(ctx context.Context, lbID string, resLSs []*albmodel.Listener) error { + if len(lbID) == 0 { + return fmt.Errorf("empty loadBalancer id when apply listeners error") + } + + traceID := ctx.Value(util.TraceID) + + sdkLSs, err := s.findSDKListenersOnLB(ctx, lbID) + if err != nil { + return err + } + matchedResAndSDKLSs, unmatchedResLSs, unmatchedSDKLSs := matchResAndSDKListeners(resLSs, sdkLSs) + + if len(matchedResAndSDKLSs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply listeners", + "matchedResAndSDKLSs", matchedResAndSDKLSs, + "traceID", traceID) + } + if len(unmatchedResLSs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply listeners", + "unmatchedResLSs", unmatchedResLSs, + "traceID", traceID) + } + if len(unmatchedSDKLSs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply listeners", + "unmatchedSDKLSs", unmatchedSDKLSs, + "traceID", traceID) + } + + var ( + errDelete error + wgDelete sync.WaitGroup + ) + for _, sdkLS := range unmatchedSDKLSs { + wgDelete.Add(1) + go func(sdkLS albsdk.Listener) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer wgDelete.Done() + if err := s.albProvider.DeleteALB(ctx, sdkLS.ListenerId); errDelete == nil && err != nil { + errDelete = err + } + }(sdkLS) + } + wgDelete.Wait() + if errDelete != nil { + return errDelete + } + + var ( + errCreate error + wgCreate sync.WaitGroup + ) + for _, resLS := range unmatchedResLSs { + wgCreate.Add(1) + go func(resLS *albmodel.Listener) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer wgCreate.Done() + lsStatus, err := s.albProvider.CreateALBListener(ctx, resLS) + if errCreate == nil && err != nil { + errCreate = err + } + resLS.SetStatus(lsStatus) + }(resLS) + } + wgCreate.Wait() + if errCreate != nil { + return errCreate + } + + var ( + errUpdate error + wgUpdate sync.WaitGroup + ) + for _, resAndSDKLS := range matchedResAndSDKLSs { + wgUpdate.Add(1) + go func(resLs *albmodel.Listener, sdkLs *albsdk.Listener) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer wgUpdate.Done() + lsStatus, err := s.albProvider.UpdateALBListener(ctx, resLs, sdkLs) + if errUpdate == nil && err != nil { + errUpdate = err + } + resLs.SetStatus(lsStatus) + }(resAndSDKLS.resLS, resAndSDKLS.sdkLS) + } + wgUpdate.Wait() + if errUpdate != nil { + return errUpdate + } + + return nil +} + +func (s *listenerApplier) findSDKListenersOnLB(ctx context.Context, lbID string) ([]albsdk.Listener, error) { + listeners, err := s.albProvider.ListALBListeners(ctx, lbID) + if err != nil { + return nil, err + } + return listeners, nil +} + +type resAndSDKListenerPair struct { + resLS *albmodel.Listener + sdkLS *albsdk.Listener +} + +func matchResAndSDKListeners(resLSs []*albmodel.Listener, sdkLSs []albsdk.Listener) ([]resAndSDKListenerPair, []*albmodel.Listener, []albsdk.Listener) { + var matchedResAndSDKLSs []resAndSDKListenerPair + var unmatchedResLSs []*albmodel.Listener + var unmatchedSDKLSs []albsdk.Listener + + resLSByPort := mapResListenerByPort(resLSs) + sdkLSByPort := mapSDKListenerByPort(sdkLSs) + resLSPorts := sets.Int64KeySet(resLSByPort) + sdkLSPorts := sets.Int64KeySet(sdkLSByPort) + for _, port := range resLSPorts.Intersection(sdkLSPorts).List() { + resLS := resLSByPort[port] + sdkLS := sdkLSByPort[port] + matchedResAndSDKLSs = append(matchedResAndSDKLSs, resAndSDKListenerPair{ + resLS: resLS, + sdkLS: &sdkLS, + }) + } + for _, port := range resLSPorts.Difference(sdkLSPorts).List() { + unmatchedResLSs = append(unmatchedResLSs, resLSByPort[port]) + } + for _, port := range sdkLSPorts.Difference(resLSPorts).List() { + unmatchedSDKLSs = append(unmatchedSDKLSs, sdkLSByPort[port]) + } + + return matchedResAndSDKLSs, unmatchedResLSs, unmatchedSDKLSs +} + +func mapResListenerByPort(resLSs []*albmodel.Listener) map[int64]*albmodel.Listener { + resLSByPort := make(map[int64]*albmodel.Listener, len(resLSs)) + for _, ls := range resLSs { + resLSByPort[int64(ls.Spec.ListenerPort)] = ls + } + return resLSByPort +} + +func mapSDKListenerByPort(sdkLSs []albsdk.Listener) map[int64]albsdk.Listener { + sdkLSByPort := make(map[int64]albsdk.Listener, len(sdkLSs)) + for _, ls := range sdkLSs { + sdkLSByPort[int64(ls.ListenerPort)] = ls + } + return sdkLSByPort +} + +func mapResListenerByAlbLoadBalancerID(ctx context.Context, resLSs []*albmodel.Listener) (map[string][]*albmodel.Listener, error) { + resLSsByLbID := make(map[string][]*albmodel.Listener, len(resLSs)) + for _, ls := range resLSs { + lbID, err := ls.Spec.LoadBalancerID.Resolve(ctx) + if err != nil { + return nil, err + } + resLSsByLbID[lbID] = append(resLSsByLbID[lbID], ls) + } + return resLSsByLbID, nil +} diff --git a/pkg/controller/ingress/reconcile/applier/rule.go b/pkg/controller/ingress/reconcile/applier/rule.go new file mode 100644 index 000000000..2e4f462d0 --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/rule.go @@ -0,0 +1,284 @@ +package applier + +import ( + "context" + "fmt" + "sync" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/util/sets" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" +) + +func NewListenerRuleApplier(albProvider prvd.Provider, stack core.Manager, logger logr.Logger) *listenerRuleApplier { + return &listenerRuleApplier{ + stack: stack, + albProvider: albProvider, + logger: logger, + } +} + +type listenerRuleApplier struct { + albProvider prvd.Provider + stack core.Manager + logger logr.Logger +} + +func (s *listenerRuleApplier) Apply(ctx context.Context) error { + var resLRs []*albmodel.ListenerRule + s.stack.ListResources(&resLRs) + + resLRsByLsID, err := mapResListenerRuleByListenerID(ctx, resLRs) + if err != nil { + return err + } + + var resLSs []*albmodel.Listener + s.stack.ListResources(&resLSs) + + resLSsByLsID, err := mapResListenerByListenerID(ctx, resLSs) + if err != nil { + return err + } + + var ( + errApply error + wgApply sync.WaitGroup + chApply = make(chan struct{}, util.ListenerConcurrentNum) + ) + + for lsID := range resLSsByLsID { + chApply <- struct{}{} + wgApply.Add(1) + + go func(listenerID string) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer func() { + wgApply.Done() + <-chApply + }() + + rules := resLRsByLsID[listenerID] + if errOnce := s.applyListenerRulesOnListenerBatch(ctx, listenerID, rules); errApply == nil && errOnce != nil { + s.logger.Error(errOnce, "apply listener rules failed", "listener", listenerID) + errApply = errOnce + return + } + }(lsID) + } + wgApply.Wait() + if errApply != nil { + return errApply + } + + return nil +} + +func (s *listenerRuleApplier) PostApply(ctx context.Context) error { + return nil +} + +func (s *listenerRuleApplier) applyListenerRulesOnListener(ctx context.Context, lsID string, resLRs []*albmodel.ListenerRule) error { + if len(lsID) == 0 { + return fmt.Errorf("empty listener id when apply rules error") + } + + traceID := ctx.Value(util.TraceID) + + sdkLRs, err := s.findSDKListenersRulesOnLS(ctx, lsID) + if err != nil { + return err + } + + matchedResAndSDKLRs, unmatchedResLRs, unmatchedSDKLRs := matchResAndSDKListenerRules(resLRs, sdkLRs) + + if len(matchedResAndSDKLRs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply rules", + "matchedResAndSDKLRs", matchedResAndSDKLRs, + "traceID", traceID) + } + if len(unmatchedResLRs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply rules", + "unmatchedResLRs", unmatchedResLRs, + "traceID", traceID) + } + if len(unmatchedSDKLRs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply rules", + "unmatchedSDKLBs", unmatchedSDKLRs, + "traceID", traceID) + } + + for _, sdkLR := range unmatchedSDKLRs { + if err := s.albProvider.DeleteALBListenerRule(ctx, sdkLR.RuleId); err != nil { + return err + } + } + for _, resLR := range unmatchedResLRs { + lrStatus, err := s.albProvider.CreateALBListenerRule(ctx, resLR) + if err != nil { + return err + } + resLR.SetStatus(lrStatus) + } + for _, resAndSDKLR := range matchedResAndSDKLRs { + lsStatus, err := s.albProvider.UpdateALBListenerRule(ctx, resAndSDKLR.ResLR, resAndSDKLR.SdkLR) + if err != nil { + return err + } + resAndSDKLR.ResLR.SetStatus(lsStatus) + } + return nil +} + +func (s *listenerRuleApplier) applyListenerRulesOnListenerBatch(ctx context.Context, lsID string, resLRs []*albmodel.ListenerRule) error { + if len(lsID) == 0 { + return fmt.Errorf("empty listener id when apply rules error") + } + + traceID := ctx.Value(util.TraceID) + + sdkLRs, err := s.findSDKListenersRulesOnLS(ctx, lsID) + if err != nil { + return err + } + + matchedResAndSDKLRs, unmatchedResLRs, unmatchedSDKLRs := matchResAndSDKListenerRules(resLRs, sdkLRs) + + if len(matchedResAndSDKLRs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply rules batch", + "matchedResAndSDKLRs", matchedResAndSDKLRs, + "traceID", traceID) + } + if len(unmatchedResLRs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply rules batch", + "unmatchedResLRs", unmatchedResLRs, + "traceID", traceID) + } + if len(unmatchedSDKLRs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply rules batch", + "unmatchedSDKLBs", unmatchedSDKLRs, + "traceID", traceID) + } + + unmatchedSDKLRIDs := make([]string, 0) + for _, sdkLR := range unmatchedSDKLRs { + unmatchedSDKLRIDs = append(unmatchedSDKLRIDs, sdkLR.RuleId) + } + if err := s.albProvider.DeleteALBListenerRules(ctx, unmatchedSDKLRIDs); err != nil { + return err + } + + lrStatus, err := s.albProvider.CreateALBListenerRules(ctx, unmatchedResLRs) + if err != nil { + return err + } + for _, resLR := range unmatchedResLRs { + status, ok := lrStatus[resLR.Spec.Priority] + if !ok { + return fmt.Errorf("failed create rule with priority: %d", resLR.Spec.Priority) + } + resLR.SetStatus(status) + } + + resAndSDKListenerRulePairs := make([]albmodel.ResAndSDKListenerRulePair, 0) + for _, matchedResAndSDKLR := range matchedResAndSDKLRs { + resAndSDKListenerRulePairs = append(resAndSDKListenerRulePairs, albmodel.ResAndSDKListenerRulePair{ + ResLR: matchedResAndSDKLR.ResLR, + SdkLR: matchedResAndSDKLR.SdkLR, + }) + } + err = s.albProvider.UpdateALBListenerRules(ctx, resAndSDKListenerRulePairs) + if err != nil { + return err + } + for _, matchedResAndSDKLR := range matchedResAndSDKLRs { + matchedResAndSDKLR.ResLR.SetStatus(albmodel.ListenerRuleStatus{ + RuleID: matchedResAndSDKLR.SdkLR.RuleId, + }) + } + + return nil +} + +func (s *listenerRuleApplier) findSDKListenersRulesOnLS(ctx context.Context, lsID string) ([]albsdk.Rule, error) { + rules, err := s.albProvider.ListALBListenerRules(ctx, lsID) + if err != nil { + return nil, err + } + return rules, nil +} + +func matchResAndSDKListenerRules(resLRs []*albmodel.ListenerRule, sdkLRs []albsdk.Rule) ([]albmodel.ResAndSDKListenerRulePair, []*albmodel.ListenerRule, []albsdk.Rule) { + var matchedResAndSDKLRs []albmodel.ResAndSDKListenerRulePair + var unmatchedResLRs []*albmodel.ListenerRule + var unmatchedSDKLRs []albsdk.Rule + + resLRByPriority := mapResListenerRuleByPriority(resLRs) + sdkLRByPriority := mapSDKListenerRuleByPriority(sdkLRs) + resLRPriorities := sets.Int64KeySet(resLRByPriority) + sdkLRPriorities := sets.Int64KeySet(sdkLRByPriority) + for _, priority := range resLRPriorities.Intersection(sdkLRPriorities).List() { + resLR := resLRByPriority[priority] + sdkLR := sdkLRByPriority[priority] + matchedResAndSDKLRs = append(matchedResAndSDKLRs, albmodel.ResAndSDKListenerRulePair{ + ResLR: resLR, + SdkLR: &sdkLR, + }) + } + for _, priority := range resLRPriorities.Difference(sdkLRPriorities).List() { + unmatchedResLRs = append(unmatchedResLRs, resLRByPriority[priority]) + } + for _, priority := range sdkLRPriorities.Difference(resLRPriorities).List() { + unmatchedSDKLRs = append(unmatchedSDKLRs, sdkLRByPriority[priority]) + } + + return matchedResAndSDKLRs, unmatchedResLRs, unmatchedSDKLRs +} + +func mapResListenerRuleByPriority(resLRs []*albmodel.ListenerRule) map[int64]*albmodel.ListenerRule { + resLRByPriority := make(map[int64]*albmodel.ListenerRule, 0) + for _, resLR := range resLRs { + resLRByPriority[int64(resLR.Spec.Priority)] = resLR + } + return resLRByPriority +} + +func mapSDKListenerRuleByPriority(sdkLRs []albsdk.Rule) map[int64]albsdk.Rule { + sdkLRByPriority := make(map[int64]albsdk.Rule, 0) + for _, sdkLR := range sdkLRs { + priority := int64(sdkLR.Priority) + sdkLRByPriority[priority] = sdkLR + } + return sdkLRByPriority +} + +func mapResListenerRuleByListenerID(ctx context.Context, resLRs []*albmodel.ListenerRule) (map[string][]*albmodel.ListenerRule, error) { + resLRsByLsID := make(map[string][]*albmodel.ListenerRule, 0) + for _, lr := range resLRs { + lsID, err := lr.Spec.ListenerID.Resolve(ctx) + if err != nil { + return nil, err + } + resLRsByLsID[lsID] = append(resLRsByLsID[lsID], lr) + } + return resLRsByLsID, nil +} + +func mapResListenerByListenerID(ctx context.Context, resLSs []*albmodel.Listener) (map[string]*albmodel.Listener, error) { + resLSByID := make(map[string]*albmodel.Listener, len(resLSs)) + for _, ls := range resLSs { + lsID, err := ls.ListenerID().Resolve(ctx) + if err != nil { + return nil, err + } + resLSByID[lsID] = ls + } + return resLSByID, nil +} diff --git a/pkg/controller/ingress/reconcile/applier/server.go b/pkg/controller/ingress/reconcile/applier/server.go new file mode 100644 index 000000000..33b4c6717 --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/server.go @@ -0,0 +1,311 @@ +package applier + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper/k8s" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/strategicpatch" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/klog" + "sigs.k8s.io/controller-runtime/pkg/client" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/go-logr/logr" +) + +func NewServerApplier(kubeClient client.Client, albProvider prvd.Provider, serverGroupID string, endpoints []albmodel.BackendItem, trafficPolicy string, logger logr.Logger) *serverApplier { + return &serverApplier{ + kubeClient: kubeClient, + albProvider: albProvider, + serverGroupID: serverGroupID, + endpoints: endpoints, + trafficPolicy: trafficPolicy, + logger: logger, + } +} + +type serverApplier struct { + kubeClient client.Client + albProvider prvd.Provider + serverGroupID string + endpoints []albmodel.BackendItem + trafficPolicy string + logger logr.Logger +} + +func (s *serverApplier) Apply(ctx context.Context) error { + traceID := ctx.Value(util.TraceID) + + servers, err := s.albProvider.ListALBServers(ctx, s.serverGroupID) + if err != nil { + return err + } + s.logger.V(util.SynLogLevel).Info("apply servers", + "endpoints", s.endpoints, + "traceID", traceID) + // todo matched endpoints need check and update weight + _, unmatchedResEndpoints, unmatchedSDKEndpoints := matchEndpointWithTargets(s.endpoints, servers, s.trafficPolicy) + + if len(unmatchedResEndpoints) != 0 { + s.logger.V(util.SynLogLevel).Info("apply servers", + "unmatchedResEndpoints", unmatchedResEndpoints, + "traceID", traceID) + } + if len(unmatchedSDKEndpoints) != 0 { + s.logger.V(util.SynLogLevel).Info("apply servers", + "unmatchedSDKEndpoints", unmatchedSDKEndpoints, + "traceID", traceID) + } + + if len(unmatchedResEndpoints) == 0 && len(unmatchedSDKEndpoints) == 0 { + return nil + } + + // If the number of servers to be added and deleted is less than 40, please call the replacement method, and the others are called separately + if len(unmatchedResEndpoints) != 0 && len(unmatchedResEndpoints) < util.BatchReplaceServersMaxNum && + len(unmatchedSDKEndpoints) != 0 && len(unmatchedSDKEndpoints) < util.BatchReplaceServersMaxNum { + if err := s.albProvider.ReplaceALBServers(ctx, s.serverGroupID, unmatchedResEndpoints, unmatchedSDKEndpoints); err != nil { + return err + } + // TODO print err + updateTargetHealthPodCondition(ctx, s.kubeClient, k8s.BuildReadinessGatePodConditionType(), s.endpoints) + + return nil + } + if len(unmatchedSDKEndpoints) != 0 { + if err := s.albProvider.DeregisterALBServers(ctx, s.serverGroupID, unmatchedSDKEndpoints); err != nil { + return err + } + } + if len(unmatchedResEndpoints) != 0 { + if err := s.albProvider.RegisterALBServers(ctx, s.serverGroupID, unmatchedResEndpoints); err != nil { + return err + } + updateTargetHealthPodCondition(ctx, s.kubeClient, k8s.BuildReadinessGatePodConditionType(), s.endpoints) + } + + return nil +} + +func (s *serverApplier) PostApply(ctx context.Context) error { + return nil +} + +func matchEndpointWithTargets(endpoints []albmodel.BackendItem, targets []albsdk.BackendServer, trafficPolicy string) ([]endpointAndTargetPair, []albmodel.BackendItem, []albsdk.BackendServer) { + var matchedEndpointAndTargets []endpointAndTargetPair + var unmatchedEndpoints []albmodel.BackendItem + var unmatchedTargets []albsdk.BackendServer + + if len(trafficPolicy) == 0 && len(endpoints) == 0 { + trafficPolicy = albmodel.ENIBackendType + } + + endpointsByUID := make(map[string]albmodel.BackendItem, len(endpoints)) + for _, endpoint := range endpoints { + var endpointUID string + if isEniTrafficPolicy(trafficPolicy) { + endpointUID = fmt.Sprintf("%v:%v:%v", endpoint.ServerId, endpoint.ServerIp, endpoint.Port) + } else { + endpointUID = fmt.Sprintf("%v:%v", endpoint.ServerId, endpoint.Port) + } + klog.Infof("endpointUID: %s", endpointUID) + endpointsByUID[endpointUID] = endpoint + } + targetsByUID := make(map[string]albsdk.BackendServer, len(targets)) + for _, target := range targets { + var targetUID string + if isEniTrafficPolicy(trafficPolicy) { + targetUID = fmt.Sprintf("%v:%v:%v", target.ServerId, target.ServerIp, target.Port) + } else { + targetUID = fmt.Sprintf("%v:%v", target.ServerId, target.Port) + } + klog.Infof("targetUID: %s", targetUID) + targetsByUID[targetUID] = target + } + endpointUIDs := sets.StringKeySet(endpointsByUID) + targetUIDs := sets.StringKeySet(targetsByUID) + + for _, uid := range endpointUIDs.Intersection(targetUIDs).List() { + endpoint := endpointsByUID[uid] + target := targetsByUID[uid] + matchedEndpointAndTargets = append(matchedEndpointAndTargets, endpointAndTargetPair{ + endpoint: endpoint, + target: target, + }) + } + for _, uid := range endpointUIDs.Difference(targetUIDs).List() { + unmatchedEndpoints = append(unmatchedEndpoints, endpointsByUID[uid]) + } + for _, uid := range targetUIDs.Difference(endpointUIDs).List() { + target := targetsByUID[uid] + if isServerStatusRemoving(target.Status) { + continue + } + unmatchedTargets = append(unmatchedTargets, target) + } + return matchedEndpointAndTargets, unmatchedEndpoints, unmatchedTargets +} + +func isServerStatusRemoving(status string) bool { + return strings.EqualFold(status, util.ServerStatusRemoving) +} + +type endpointAndTargetPair struct { + endpoint albmodel.BackendItem + target albsdk.BackendServer +} + +//TODO remove +func isTrafficPolicyValid(trafficPolicy string) bool { + if !strings.EqualFold(trafficPolicy, util.TrafficPolicyEni) && + !strings.EqualFold(trafficPolicy, util.TrafficPolicyLocal) && + !strings.EqualFold(trafficPolicy, util.TrafficPolicyCluster) { + return false + } + return true +} + +func isEniTrafficPolicy(trafficPolicy string) bool { + return strings.EqualFold(trafficPolicy, util.TrafficPolicyEni) +} + +// updateTargetHealthPodCondition will updates pod's targetHealth condition for matchedEndpointAndTargets and unmatchedEndpoints. +// returns whether further probe is needed or not +func updateTargetHealthPodCondition(ctx context.Context, kubeClient client.Client, targetHealthCondType v1.PodConditionType, + endpoints []albmodel.BackendItem) error { + klog.Infof("start updateTargetHealthPodCondition") + for _, endpointAndTarget := range endpoints { + if len(endpointAndTarget.Pod.Spec.ReadinessGates) == 0 { + continue + } + epsKey := types.NamespacedName{ + Namespace: endpointAndTarget.Pod.Namespace, + Name: endpointAndTarget.Pod.Name, + } + pod := &v1.Pod{} + if err := kubeClient.Get(ctx, epsKey, pod); err != nil { + if errors.IsNotFound(err) { + klog.Errorf("updateTargetHealthPodCondition %v", err.Error()) + continue + } + continue + } + _, err := updateTargetHealthPodConditionForPod(ctx, kubeClient, pod, targetHealthCondType) + if err != nil { + klog.Errorf("updateTargetHealthPodConditionForPod %v", err.Error()) + continue + } + } + return nil +} + +// updateTargetHealthPodConditionForPod updates pod's targetHealth condition for a single pod and its matched target. +// returns whether further probe is needed or not. +func updateTargetHealthPodConditionForPod(ctx context.Context, kubeClient client.Client, pod *v1.Pod, targetHealthCondType v1.PodConditionType) (bool, error) { + if !HasAnyOfReadinessGates(pod, []v1.PodConditionType{targetHealthCondType}) { + return false, nil + } + + targetHealthCondStatus := v1.ConditionTrue + var reason, message string + + existingTargetHealthCond, exists := GetPodCondition(pod, targetHealthCondType) + // we skip patch pod if it matches current computed status/reason/message. + if exists && + existingTargetHealthCond.Status == targetHealthCondStatus && + existingTargetHealthCond.Reason == reason && + existingTargetHealthCond.Message == message { + return true, nil + } + + newTargetHealthCond := v1.PodCondition{ + Type: targetHealthCondType, + Status: targetHealthCondStatus, + Reason: reason, + Message: message, + } + if !exists || existingTargetHealthCond.Status != targetHealthCondStatus { + newTargetHealthCond.LastTransitionTime = metav1.Now() + } + + patch, err := buildPodConditionPatch(pod, newTargetHealthCond) + if err != nil { + return false, err + } + k8sPod := &v1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: pod.Namespace, + Name: pod.Name, + UID: pod.UID, + }, + } + if err := kubeClient.Status().Patch(ctx, k8sPod, patch); err != nil { + if errors.IsNotFound(err) { + return false, nil + } + return false, err + } + + return true, nil +} + +func buildPodConditionPatch(pod *v1.Pod, condition v1.PodCondition) (client.Patch, error) { + oldData, err := json.Marshal(v1.Pod{ + Status: v1.PodStatus{ + Conditions: nil, + }, + }) + if err != nil { + return nil, err + } + newData, err := json.Marshal(v1.Pod{ + ObjectMeta: metav1.ObjectMeta{UID: pod.UID}, // only put the uid in the new object to ensure it appears in the patch as a precondition + Status: v1.PodStatus{ + Conditions: []v1.PodCondition{condition}, + }, + }) + if err != nil { + return nil, err + } + patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, v1.Pod{}) + if err != nil { + return nil, err + } + return client.RawPatch(types.StrategicMergePatchType, patchBytes), nil +} + +// HasAnyOfReadinessGates returns whether podInfo has any of these readinessGates +func HasAnyOfReadinessGates(pod *v1.Pod, conditionTypes []v1.PodConditionType) bool { + for _, rg := range pod.Spec.ReadinessGates { + for _, conditionType := range conditionTypes { + if rg.ConditionType == conditionType { + return true + } + } + } + return false +} + +// GetPodCondition will get Pod's condition. +func GetPodCondition(pod *v1.Pod, conditionType v1.PodConditionType) (v1.PodCondition, bool) { + for _, cond := range pod.Status.Conditions { + if cond.Type == conditionType { + return cond, true + } + } + + return v1.PodCondition{}, false +} diff --git a/pkg/controller/ingress/reconcile/applier/server_group.go b/pkg/controller/ingress/reconcile/applier/server_group.go new file mode 100644 index 000000000..8343fdcc5 --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/server_group.go @@ -0,0 +1,327 @@ +package applier + +import ( + "context" + "crypto/sha256" + "encoding/hex" + "strings" + "sync" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper/k8s" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/backend" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/go-logr/logr" + "github.com/pkg/errors" +) + +func NewServerGroupApplier(kubeClient client.Client, backendManager backend.Manager, albProvider prvd.Provider, trackingProvider tracking.TrackingProvider, stack core.Manager, logger logr.Logger) *serverGroupApplier { + return &serverGroupApplier{ + kubeClient: kubeClient, + trackingProvider: trackingProvider, + stack: stack, + albProvider: albProvider, + backendManager: backendManager, + logger: logger, + } +} + +type serverGroupApplier struct { + albProvider prvd.Provider + trackingProvider tracking.TrackingProvider + stack core.Manager + backendManager backend.Manager + kubeClient client.Client + unmatchedSDKSGPs []albmodel.ServerGroupWithTags + logger logr.Logger +} + +func (s *serverGroupApplier) addServerToServerGroup(ctx context.Context, serverGroupID string, svcKey types.NamespacedName, port intstr.IntOrString) error { + backends, _, err := s.backendManager.BuildServicePortSDKBackends(ctx, svcKey, port) + if err != nil { + if apierrors.IsNotFound(err) { + return nil + } + return err + } + if len(backends) == 0 { + return nil + } + if err := s.albProvider.RegisterALBServers(ctx, serverGroupID, backends); err != nil { + return err + } + err = updateTargetHealthPodCondition(ctx, s.kubeClient, k8s.BuildReadinessGatePodConditionType(), backends) + if err != nil { + return err + } + return nil +} + +func (s *serverGroupApplier) removeServerFromServerGroup(ctx context.Context, serverGroupID string, svcKey types.NamespacedName, port intstr.IntOrString) error { + _, _, err := s.backendManager.BuildServicePortSDKBackends(ctx, svcKey, port) + if err != nil { + if apierrors.IsNotFound(err) { + servers, err := s.albProvider.ListALBServers(ctx, serverGroupID) + if err != nil { + return err + } + if len(servers) == 0 { + return nil + } + if err := s.albProvider.DeregisterALBServers(ctx, serverGroupID, servers); err != nil { + return err + } + + return nil + } + return err + } + return nil +} + +func (s *serverGroupApplier) Apply(ctx context.Context) error { + traceID := ctx.Value(util.TraceID) + + var resSGPs []*albmodel.ServerGroup + s.stack.ListResources(&resSGPs) + + sdkSGPs, err := s.findSDKServerGroups(ctx) + if err != nil { + return err + } + + matchedResAndSDKSGPs, unmatchedResSGPs, unmatchedSDKSGPs, err := matchResAndSDKServerGroupsSGP(resSGPs, sdkSGPs, s.trackingProvider.ResourceIDTagKey()) + if err != nil { + return err + } + + if len(matchedResAndSDKSGPs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply serverGroups", + "matchedResAndSDKSGPs", matchedResAndSDKSGPs, + "traceID", traceID) + } + if len(unmatchedResSGPs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply serverGroups", + "unmatchedResSGPs", unmatchedResSGPs, + "traceID", traceID) + } + if len(unmatchedSDKSGPs) != 0 { + s.logger.V(util.SynLogLevel).Info("apply serverGroups", + "unmatchedSDKSGPs", unmatchedSDKSGPs, + "traceID", traceID) + } + + s.unmatchedSDKSGPs = unmatchedSDKSGPs + + var ( + errCreate error + wgCreate sync.WaitGroup + chCreate = make(chan struct{}, util.ServerGroupConcurrentNum) + ) + for _, resSGP := range unmatchedResSGPs { + chCreate <- struct{}{} + wgCreate.Add(1) + + go func(res *albmodel.ServerGroup) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer func() { + wgCreate.Done() + <-chCreate + }() + + sgpStatus, errOnce := s.albProvider.CreateALBServerGroup(ctx, res, s.trackingProvider) + if errCreate == nil && errOnce != nil { + errCreate = errOnce + return + } + res.SetStatus(sgpStatus) + + if strings.Contains(res.Spec.ServerGroupNamedKey.IngressName, util.DefaultListenerFlag) { + return + } + if errOnce = s.addServerToServerGroup(ctx, sgpStatus.ServerGroupID, types.NamespacedName{ + Namespace: res.Spec.ServerGroupNamedKey.Namespace, + Name: res.Spec.ServerGroupNamedKey.ServiceName}, + intstr.FromInt(res.Spec.ServerGroupNamedKey.ServicePort)); errCreate == nil && errOnce != nil { + if errTmp := s.albProvider.DeleteALBServerGroup(ctx, sgpStatus.ServerGroupID); errTmp != nil { + s.logger.V(util.SynLogLevel).Error(errTmp, "apply serverGroups roll back server group failed", + "serverGroupID", sgpStatus.ServerGroupID, "traceID", traceID) + } + errCreate = errOnce + return + } + }(resSGP) + } + wgCreate.Wait() + if errCreate != nil { + return errCreate + } + + var ( + errUpdate error + wgUpdate sync.WaitGroup + chUpdate = make(chan struct{}, util.ServerGroupConcurrentNum) + ) + for _, resAndSDKSGP := range matchedResAndSDKSGPs { + chUpdate <- struct{}{} + wgUpdate.Add(1) + + go func(resSGP *albmodel.ServerGroup, sdkSGP albmodel.ServerGroupWithTags) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer func() { + wgUpdate.Done() + <-chUpdate + }() + + sgpStatus, errOnce := s.albProvider.UpdateALBServerGroup(ctx, resSGP, sdkSGP) + if errUpdate == nil && errOnce != nil { + errUpdate = errOnce + } + resSGP.SetStatus(sgpStatus) + + if strings.Contains(resSGP.Spec.ServerGroupNamedKey.IngressName, util.DefaultListenerFlag) { + return + } + if errOnce = s.removeServerFromServerGroup(ctx, sgpStatus.ServerGroupID, types.NamespacedName{ + Namespace: resSGP.Spec.ServerGroupNamedKey.Namespace, + Name: resSGP.Spec.ServerGroupNamedKey.ServiceName}, + intstr.FromInt(resSGP.Spec.ServerGroupNamedKey.ServicePort)); errCreate == nil && errOnce != nil { + errCreate = errOnce + return + } + }(resAndSDKSGP.ResSGP, resAndSDKSGP.SdkSGP) + } + wgUpdate.Wait() + if errUpdate != nil { + return errUpdate + } + + return nil +} + +func (s *serverGroupApplier) PostApply(ctx context.Context) error { + var ( + errDelete error + wgDelete sync.WaitGroup + chDelete = make(chan struct{}, util.ServerGroupConcurrentNum) + ) + for _, sdkSGP := range s.unmatchedSDKSGPs { + chDelete <- struct{}{} + wgDelete.Add(1) + + go func(sgpID string) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer func() { + wgDelete.Done() + <-chDelete + }() + + if errOnce := s.albProvider.DeleteALBServerGroup(ctx, sgpID); errDelete == nil && errOnce != nil { + errDelete = errOnce + return + } + }(sdkSGP.ServerGroup.ServerGroupId) + } + wgDelete.Wait() + if errDelete != nil { + return errDelete + } + + return nil +} + +func (s *serverGroupApplier) findSDKServerGroups(ctx context.Context) ([]albmodel.ServerGroupWithTags, error) { + stackTags := s.trackingProvider.StackTags(s.stack) + return s.albProvider.ListALBServerGroupsWithTags(ctx, stackTags) +} + +type resAndSDKServerGroupPairSGP struct { + ResSGP *albmodel.ServerGroup + SdkSGP albmodel.ServerGroupWithTags +} + +func matchResAndSDKServerGroupsSGP(resSGPs []*albmodel.ServerGroup, sdkSGPs []albmodel.ServerGroupWithTags, resourceIDTagKey string) ([]resAndSDKServerGroupPairSGP, []*albmodel.ServerGroup, []albmodel.ServerGroupWithTags, error) { + var matchedResAndSDKSGPs []resAndSDKServerGroupPairSGP + var unmatchedResSGPs []*albmodel.ServerGroup + var unmatchedSDKSGPs []albmodel.ServerGroupWithTags + + resSGPsByID := mapResServerGroupByResourceIDSGP(resSGPs) + sdkSGPsByID, err := mapSDKServerGroupByResourceIDSGP(sdkSGPs, resourceIDTagKey) + if err != nil { + return nil, nil, nil, err + } + + resSGPIDs := sets.StringKeySet(resSGPsByID) + sdkSGPIDs := sets.StringKeySet(sdkSGPsByID) + + for _, resID := range resSGPIDs.Intersection(sdkSGPIDs).List() { + resSGP := resSGPsByID[resID] + sdkSGPs := sdkSGPsByID[resID] + for _, sdkSGP := range sdkSGPs { + matchedResAndSDKSGPs = append(matchedResAndSDKSGPs, resAndSDKServerGroupPairSGP{ + ResSGP: resSGP, + SdkSGP: sdkSGP, + }) + } + } + for _, resID := range resSGPIDs.Difference(sdkSGPIDs).List() { + unmatchedResSGPs = append(unmatchedResSGPs, resSGPsByID[resID]) + } + for _, resID := range sdkSGPIDs.Difference(resSGPIDs).List() { + unmatchedSDKSGPs = append(unmatchedSDKSGPs, sdkSGPsByID[resID]...) + } + + return matchedResAndSDKSGPs, unmatchedResSGPs, unmatchedSDKSGPs, nil +} + +func mapResServerGroupByResourceIDSGP(resSGPs []*albmodel.ServerGroup) map[string]*albmodel.ServerGroup { + resSGPsByID := make(map[string]*albmodel.ServerGroup, len(resSGPs)) + for _, resSGP := range resSGPs { + resSGPsByID[resSGP.ID()] = resSGP + } + return resSGPsByID +} + +func mapSDKServerGroupByResourceIDSGP(sdkSGPs []albmodel.ServerGroupWithTags, resourceIDTagKey string) (map[string][]albmodel.ServerGroupWithTags, error) { + sdkSGPsByID := make(map[string][]albmodel.ServerGroupWithTags, 0) + for _, sdkSGP := range sdkSGPs { + resourceID, ok := sdkSGP.Tags[resourceIDTagKey] + if !ok { + return nil, errors.Errorf("unexpected serverGroup with no resourceID: %v", resourceIDTagKey) + } + if isOldResourceID(resourceID) { + resourceID = calServerGroupResourceIDHashUUID(resourceID) + } + sdkSGPsByID[resourceID] = append(sdkSGPsByID[resourceID], sdkSGP) + } + return sdkSGPsByID, nil +} + +func isOldResourceID(resourceID string) bool { + return strings.Contains(resourceID, "/") && + strings.Contains(resourceID, "-") && + strings.Contains(resourceID, ":") +} + +func calServerGroupResourceIDHashUUID(resourceID string) string { + uuidHash := sha256.New() + _, _ = uuidHash.Write([]byte(resourceID)) + uuid := hex.EncodeToString(uuidHash.Sum(nil)) + return uuid +} diff --git a/pkg/controller/ingress/reconcile/applier/service.go b/pkg/controller/ingress/reconcile/applier/service.go new file mode 100644 index 000000000..b8a1275fa --- /dev/null +++ b/pkg/controller/ingress/reconcile/applier/service.go @@ -0,0 +1,250 @@ +package applier + +import ( + "context" + "strconv" + "sync" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + "k8s.io/apimachinery/pkg/util/sets" + + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/go-logr/logr" +) + +type ServiceManagerApplier interface { + Apply(ctx context.Context, albProvider prvd.Provider, serviceStack *albmodel.ServiceManager) error +} + +var _ ServiceManagerApplier = &defaultServiceManagerApplier{} + +func NewServiceManagerApplier(kubeClient client.Client, albProvider prvd.Provider, logger logr.Logger) *defaultServiceManagerApplier { + return &defaultServiceManagerApplier{ + kubeClient: kubeClient, + albProvider: albProvider, + logger: logger, + } +} + +type defaultServiceManagerApplier struct { + kubeClient client.Client + albProvider prvd.Provider + + logger logr.Logger +} + +func (m *defaultServiceManagerApplier) Apply(ctx context.Context, albProvider prvd.Provider, serviceStack *albmodel.ServiceManager) error { + serverGroupApplier := NewServiceStackApplier(albProvider, serviceStack, m.logger) + if err := serverGroupApplier.Apply(ctx); err != nil { + return err + } + + matchedResAndSDKSGPs := serverGroupApplier.MatchedResAndSDKSGPs + + var ( + err error + wg sync.WaitGroup + chApply = make(chan struct{}, util.ServerGroupConcurrentNum) + ) + for _, v := range matchedResAndSDKSGPs { + chApply <- struct{}{} + wg.Add(1) + + go func(serverGroupID string, backends []albmodel.BackendItem) { + util.RandomSleepFunc(util.ConcurrentMaxSleepMillisecondTime) + + defer func() { + wg.Done() + <-chApply + }() + + serverApplier := NewServerApplier(m.kubeClient, albProvider, serverGroupID, backends, serviceStack.TrafficPolicy, m.logger) + if errOnce := serverApplier.Apply(ctx); err == nil && errOnce != nil { + m.logger.Error(errOnce, "synthesize servers failed", "serverGroupID", v.SdkSGP.ServerGroupId) + err = errOnce + } + }(v.SdkSGP.ServerGroupId, v.ResSGP.Backends) + } + wg.Wait() + if err != nil { + return err + } + + return nil +} + +func NewServiceStackApplier(albProvider prvd.Provider, serviceStack *albmodel.ServiceManager, logger logr.Logger) *serviceStackApplier { + tagFilters := make(map[string]string) + tagFilters[util.ClusterNameTagKey] = serviceStack.ClusterID + tagFilters[util.ServiceNamespaceTagKey] = serviceStack.Namespace + tagFilters[util.ServiceNameTagKey] = serviceStack.Name + + return &serviceStackApplier{ + serviceStack: serviceStack, + albProvider: albProvider, + tagFilters: tagFilters, + logger: logger, + } +} + +type serviceStackApplier struct { + serviceStack *albmodel.ServiceManager + albProvider prvd.Provider + tagFilters map[string]string + MatchedResAndSDKSGPs []resAndSDKServerGroupPair + + logger logr.Logger +} + +func (s *serviceStackApplier) Apply(ctx context.Context) error { + traceID := ctx.Value(util.TraceID) + + serverGroupsWithNameKey := transServiceStackToServerGroupsWithNameKey(s.serviceStack) + serverGroupsWithTags, err := s.albProvider.ListALBServerGroupsWithTags(ctx, s.tagFilters) + if err != nil { + return err + } + + matchedResAndSDKSGPs, unmatchedResSGPs, unmatchedSDKSGPs, err := matchResAndSDKServerGroups(serverGroupsWithNameKey, serverGroupsWithTags) + if err != nil { + return err + } + + if len(matchedResAndSDKSGPs) != 0 { + s.logger.V(util.SynLogLevel).Info("synthesize serviceStack", + "matchedResAndSDKSGPs", matchedResAndSDKSGPs, + "traceID", traceID) + } + if len(unmatchedResSGPs) != 0 { + s.logger.V(util.SynLogLevel).Info("synthesize serviceStack", + "unmatchedResSGPs", unmatchedResSGPs, + "traceID", traceID) + } + if len(unmatchedSDKSGPs) != 0 { + s.logger.V(util.SynLogLevel).Info("synthesize serviceStack", + "unmatchedSDKSGPs", unmatchedSDKSGPs, + "traceID", traceID) + } + + s.MatchedResAndSDKSGPs = matchedResAndSDKSGPs + return nil +} + +func (s *serviceStackApplier) PostApply(ctx context.Context) error { + return nil +} + +func transServiceStackToServerGroupsWithNameKey(serviceStack *albmodel.ServiceManager) []albmodel.ServiceGroupWithNameKey { + serverGroups := make([]albmodel.ServiceGroupWithNameKey, 0) + + for port, serverGroup := range serviceStack.PortToServerGroup { + for _, ingressName := range serverGroup.IngressNames { + serverGroupNamedKey := &albmodel.ServerGroupNamedKey{ + ClusterID: serviceStack.ClusterID, + Namespace: serviceStack.Namespace, + IngressName: ingressName, + ServiceName: serviceStack.Name, + ServicePort: int(port), + } + + serverGroups = append(serverGroups, albmodel.ServiceGroupWithNameKey{ + NamedKey: serverGroupNamedKey, + Backends: serverGroup.Backends, + }) + } + } + + return serverGroups +} + +type resAndSDKServerGroupPair struct { + ResSGP albmodel.ServiceGroupWithNameKey + SdkSGP albmodel.ServerGroupWithTags +} + +func mapResServerGroupByResourceID(resSGPs []albmodel.ServiceGroupWithNameKey) map[string]albmodel.ServiceGroupWithNameKey { + resSGPsByID := make(map[string]albmodel.ServiceGroupWithNameKey, 0) + for _, resSGP := range resSGPs { + resSGPsByID[resSGP.NamedKey.Key()] = resSGP + } + return resSGPsByID +} + +func mapSDKServerGroupByResourceID(sdkSGPs []albmodel.ServerGroupWithTags) map[string]albmodel.ServerGroupWithTags { + resSGPsByID := make(map[string]albmodel.ServerGroupWithTags, 0) + for _, sdkSGP := range sdkSGPs { + var svcNameKey albmodel.ServerGroupNamedKey + + tags := sdkSGP.Tags + if v, ok := tags[util.ClusterNameTagKey]; ok { + svcNameKey.ClusterID = v + } else { + continue + } + + if v, ok := tags[util.ServiceNamespaceTagKey]; ok { + svcNameKey.Namespace = v + } else { + continue + } + + if v, ok := tags[util.IngressNameTagKey]; ok { + svcNameKey.IngressName = v + } else { + continue + } + + if v, ok := tags[util.ServiceNameTagKey]; ok { + svcNameKey.ServiceName = v + } else { + continue + } + + if v, ok := tags[util.ServicePortTagKey]; ok { + intV, err := strconv.Atoi(v) + if err != nil { + continue + } + svcNameKey.ServicePort = intV + } else { + continue + } + + resSGPsByID[svcNameKey.Key()] = sdkSGP + } + return resSGPsByID +} + +func matchResAndSDKServerGroups(resSGPs []albmodel.ServiceGroupWithNameKey, sdkSGPs []albmodel.ServerGroupWithTags) ([]resAndSDKServerGroupPair, []albmodel.ServiceGroupWithNameKey, []albmodel.ServerGroupWithTags, error) { + var matchedResAndSDKSGPs []resAndSDKServerGroupPair + var unmatchedResSGPs []albmodel.ServiceGroupWithNameKey + var unmatchedSDKSGPs []albmodel.ServerGroupWithTags + + resSGPsByID := mapResServerGroupByResourceID(resSGPs) + sdkSGPsByID := mapSDKServerGroupByResourceID(sdkSGPs) + + resSGPIDs := sets.StringKeySet(resSGPsByID) + sdkSGPIDs := sets.StringKeySet(sdkSGPsByID) + + for _, resID := range resSGPIDs.Intersection(sdkSGPIDs).List() { + resSGP := resSGPsByID[resID] + sdkSGPs := sdkSGPsByID[resID] + matchedResAndSDKSGPs = append(matchedResAndSDKSGPs, resAndSDKServerGroupPair{ + ResSGP: resSGP, + SdkSGP: sdkSGPs, + }) + } + for _, resID := range resSGPIDs.Difference(sdkSGPIDs).List() { + unmatchedResSGPs = append(unmatchedResSGPs, resSGPsByID[resID]) + } + for _, resID := range sdkSGPIDs.Difference(resSGPIDs).List() { + unmatchedSDKSGPs = append(unmatchedSDKSGPs, sdkSGPsByID[resID]) + } + + return matchedResAndSDKSGPs, unmatchedResSGPs, unmatchedSDKSGPs, nil +} diff --git a/pkg/controller/ingress/reconcile/backend/backend.go b/pkg/controller/ingress/reconcile/backend/backend.go new file mode 100644 index 000000000..cab6ad60b --- /dev/null +++ b/pkg/controller/ingress/reconcile/backend/backend.go @@ -0,0 +1,94 @@ +package backend + +import ( + "context" + "fmt" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "github.com/go-logr/logr" + v1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +func NewBackendManager(store store.Storer, kubeClient client.Client, cloud prvd.Provider, logger logr.Logger) *Manager { + return &Manager{ + store: store, + k8sClient: kubeClient, + EndpointResolver: NewDefaultEndpointResolver(store, kubeClient, cloud, logger), + } +} + +type Manager struct { + store store.Storer + k8sClient client.Client + EndpointResolver +} + +func (mgr *Manager) BuildServicePortSDKBackends(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]alb.BackendItem, bool, error) { + svc, err := helper.GetService(mgr.k8sClient, svcKey) + if err != nil { + return nil, false, err + } + + var ( + modelBackends []alb.BackendItem + endpoints []NodePortEndpoint + containsPotentialReadyEndpoints bool + ) + + policy, err := helper.GetServiceTrafficPolicy(svc) + if err != nil { + return nil, false, err + } + switch policy { + case helper.ENITrafficPolicy: + endpoints, containsPotentialReadyEndpoints, err = mgr.ResolveENIEndpoints(ctx, util.NamespacedName(svc), port) + if err != nil { + return modelBackends, containsPotentialReadyEndpoints, err + } + case helper.LocalTrafficPolicy: + endpoints, containsPotentialReadyEndpoints, err = mgr.ResolveLocalEndpoints(ctx, util.NamespacedName(svc), port) + if err != nil { + return modelBackends, containsPotentialReadyEndpoints, err + } + case helper.ClusterTrafficPolicy: + endpoints, containsPotentialReadyEndpoints, err = mgr.ResolveClusterEndpoints(ctx, util.NamespacedName(svc), port) + if err != nil { + return modelBackends, containsPotentialReadyEndpoints, err + } + default: + return modelBackends, containsPotentialReadyEndpoints, fmt.Errorf("not supported traffic policy [%s]", policy) + } + + for _, endpoint := range endpoints { + modelBackends = append(modelBackends, alb.BackendItem(endpoint)) + } + + return modelBackends, containsPotentialReadyEndpoints, nil +} + +func (mgr *Manager) BuildServicePortsToSDKBackends(ctx context.Context, svc *v1.Service) (map[int32][]alb.BackendItem, bool, error) { + svcPort2Backends := make(map[int32][]alb.BackendItem) + containsPotentialReadyEndpoints := false + for _, port := range svc.Spec.Ports { + backends, _containsPotentialReadyEndpoints, err := mgr.BuildServicePortSDKBackends(ctx, util.NamespacedName(svc), intstr.FromInt(int(port.Port))) + if err != nil { + if apierrors.IsNotFound(err) { + continue + } + return nil, _containsPotentialReadyEndpoints, err + } + containsPotentialReadyEndpoints = _containsPotentialReadyEndpoints + svcPort2Backends[port.Port] = backends + } + + return svcPort2Backends, containsPotentialReadyEndpoints, nil +} diff --git a/pkg/controller/ingress/reconcile/backend/endpoint_resolver.go b/pkg/controller/ingress/reconcile/backend/endpoint_resolver.go new file mode 100644 index 000000000..d7be8e50a --- /dev/null +++ b/pkg/controller/ingress/reconcile/backend/endpoint_resolver.go @@ -0,0 +1,366 @@ +package backend + +import ( + "context" + "fmt" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper/k8s" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store" + + pkgModel "k8s.io/cloud-provider-alibaba-cloud/pkg/model" + + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/klog" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/go-logr/logr" + "github.com/pkg/errors" +) + +var ErrNotFound = errors.New("backend not found") + +type EndpointResolver interface { + ResolveENIEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]NodePortEndpoint, bool, error) + + ResolveLocalEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]NodePortEndpoint, bool, error) + + ResolveClusterEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]NodePortEndpoint, bool, error) +} + +type PodEndpoint struct { + IP string + Port int + NodeName *string + Pod *corev1.Pod +} + +type NodePortEndpoint alb.BackendItem + +func NewDefaultEndpointResolver(store store.Storer, k8sClient client.Client, cloud prvd.Provider, logger logr.Logger) *defaultEndpointResolver { + return &defaultEndpointResolver{ + k8sClient: k8sClient, + logger: logger, + cloud: cloud, + store: store, + } +} + +var _ EndpointResolver = &defaultEndpointResolver{} + +type defaultEndpointResolver struct { + store store.Storer + k8sClient client.Client + cloud prvd.Provider + logger logr.Logger +} + +func (r *defaultEndpointResolver) findServiceAndServicePort(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) (*corev1.Service, corev1.ServicePort, error) { + svc := &corev1.Service{} + if err := r.k8sClient.Get(ctx, svcKey, svc); err != nil { + if apierrors.IsNotFound(err) { + return nil, corev1.ServicePort{}, fmt.Errorf("%w: %v", ErrNotFound, err.Error()) + } + return nil, corev1.ServicePort{}, err + } + svcPort, err := LookupServicePort(svc, port) + if err != nil { + return nil, corev1.ServicePort{}, fmt.Errorf("%w: %v", ErrNotFound, err.Error()) + } + + return svc, svcPort, nil +} + +func (r *defaultEndpointResolver) resolvePodEndpoints(ctx context.Context, svc *corev1.Service, svcPort corev1.ServicePort) ([]PodEndpoint, bool, error) { + epsKey := util.NamespacedName(svc) + eps := &corev1.Endpoints{} + if err := r.k8sClient.Get(ctx, epsKey, eps); err != nil { + if apierrors.IsNotFound(err) { + return nil, false, fmt.Errorf("%w: %v", ErrNotFound, err.Error()) + } + return nil, false, err + } + var endpoints []PodEndpoint + containsPotentialReadyEndpoints := false + + for _, ep := range eps.Subsets { + var backendPort int + for _, p := range ep.Ports { + if p.Name == svcPort.Name { + backendPort = int(p.Port) + break + } + } + + for _, addr := range ep.Addresses { + if addr.TargetRef == nil || addr.TargetRef.Kind != "Pod" { + continue + } + pod, err := r.findPodByReference(ctx, svc.Namespace, *addr.TargetRef) + if err != nil { + return nil, false, err + } + endpoints = append(endpoints, buildPodEndpoint(addr, backendPort, pod)) + } + // readiness gates + for _, epAddr := range ep.NotReadyAddresses { + if epAddr.TargetRef == nil || epAddr.TargetRef.Kind != "Pod" { + continue + } + pod, err := r.findPodByReference(ctx, svc.Namespace, *epAddr.TargetRef) + if err != nil { + klog.Errorf("findPodByReference error: %s", err.Error()) + return nil, false, err + } + + if !k8s.IsPodHasReadinessGate(pod) { + continue + } + if !k8s.IsPodContainersReady(pod) { + containsPotentialReadyEndpoints = true + continue + } + endpoints = append(endpoints, buildPodEndpoint(epAddr, backendPort, pod)) + } + + } + + return endpoints, containsPotentialReadyEndpoints, nil +} +func (r *defaultEndpointResolver) findPodByReference(ctx context.Context, namespace string, podRef corev1.ObjectReference) (*corev1.Pod, error) { + podKey := fmt.Sprintf("%s/%s", namespace, podRef.Name) + return r.store.GetPod(podKey) +} +func (r *defaultEndpointResolver) ResolveENIEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]NodePortEndpoint, bool, error) { + svc, svcPort, err := r.findServiceAndServicePort(ctx, svcKey, port) + if err != nil { + return nil, false, err + } + + podEndpoints, containsPotentialReadyEndpoints, err := r.resolvePodEndpoints(ctx, svc, svcPort) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + + eps, err := r.transPodEndpointsToEnis(podEndpoints) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + return eps, containsPotentialReadyEndpoints, nil +} + +func (r *defaultEndpointResolver) ResolveLocalEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]NodePortEndpoint, bool, error) { + svc, svcPort, err := r.findServiceAndServicePort(ctx, svcKey, port) + if err != nil { + return nil, false, err + } + + podEndPoints, containsPotentialReadyEndpoints, err := r.resolvePodEndpoints(ctx, svc, svcPort) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + + svcNodePort := svcPort.NodePort + + nodes, err := helper.GetNodes(svc, r.k8sClient) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + nodesByName := nodesByName(nodes) + + ecsEndpoints := make([]NodePortEndpoint, 0) + eciEndpoints := make([]PodEndpoint, 0) + + for _, podEndPoint := range podEndPoints { + if podEndPoint.NodeName == nil { + return nil, containsPotentialReadyEndpoints, errors.New("empty node name") + } + + node, ok := nodesByName[*podEndPoint.NodeName] + if !ok { + continue + } + + if node.Labels["type"] == util.LabelNodeTypeVK { + eciEndpoints = append(eciEndpoints, podEndPoint) + continue + } + + if helper.HasExcludeLabel(&node) { + continue + } + + _, id, err := helper.NodeFromProviderID(node.Spec.ProviderID) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + + ecsEndpoints = append(ecsEndpoints, buildNodePortEndpoint(id, "", int(svcNodePort), alb.ECSBackendType, util.DefaultServerWeight, podEndPoint.Pod)) + } + + if len(eciEndpoints) != 0 { + eniEps, err := r.transPodEndpointsToEnis(eciEndpoints) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + ecsEndpoints = append(ecsEndpoints, eniEps...) + } + + return RemoteDuplicatedBackends(ecsEndpoints), containsPotentialReadyEndpoints, nil +} + +func (r *defaultEndpointResolver) ResolveClusterEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString) ([]NodePortEndpoint, bool, error) { + svc, svcPort, err := r.findServiceAndServicePort(ctx, svcKey, port) + if err != nil { + return nil, false, err + } + + podEndPoints, containsPotentialReadyEndpoints, err := r.resolvePodEndpoints(ctx, svc, svcPort) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + + svcNodePort := svcPort.NodePort + + nodes, err := helper.GetNodes(svc, r.k8sClient) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + nodesByName := nodesByName(nodes) + + ecsEndpoints := make([]NodePortEndpoint, 0) + for _, node := range nodes { + if helper.HasExcludeLabel(&node) { + continue + } + _, id, err := helper.NodeFromProviderID(node.Spec.ProviderID) + if err != nil { + return nil, containsPotentialReadyEndpoints, fmt.Errorf("normal parse providerid: %s. "+ + "expected: ${regionid}.${nodeid}, %s", node.Spec.ProviderID, err.Error()) + } + + ecsEndpoints = append(ecsEndpoints, buildNodePortEndpoint(id, "", int(svcNodePort), alb.ECSBackendType, util.DefaultServerWeight, nil)) + } + + eciEndpoints := make([]PodEndpoint, 0) + for _, podEndPoint := range podEndPoints { + if podEndPoint.NodeName == nil { + return nil, containsPotentialReadyEndpoints, errors.New("empty node name") + } + + node, ok := nodesByName[*podEndPoint.NodeName] + if !ok { + continue + } + + if node.Labels["type"] == util.LabelNodeTypeVK { + eciEndpoints = append(eciEndpoints, podEndPoint) + } + } + + if len(eciEndpoints) != 0 { + eniEndpointsFromEci, err := r.transPodEndpointsToEnis(eciEndpoints) + if err != nil { + return nil, containsPotentialReadyEndpoints, err + } + ecsEndpoints = append(ecsEndpoints, eniEndpointsFromEci...) + } + + return ecsEndpoints, containsPotentialReadyEndpoints, nil +} + +func nodesByName(nodes []corev1.Node) map[string]corev1.Node { + nodesByName := make(map[string]corev1.Node) + for _, node := range nodes { + nodesByName[node.Name] = node + } + return nodesByName +} + +func (r *defaultEndpointResolver) transPodEndpointsToEnis(backends []PodEndpoint) ([]NodePortEndpoint, error) { + vpcId, err := r.cloud.VpcID() + if err != nil { + return nil, fmt.Errorf("get vpc id from metadata error:%s", err.Error()) + } + + var ips []string + for _, b := range backends { + ips = append(ips, b.IP) + } + + result, err := r.cloud.DescribeNetworkInterfaces(vpcId, ips, pkgModel.IPv4) + if err != nil { + return nil, fmt.Errorf("call DescribeNetworkInterfaces: %s", err.Error()) + } + var nodePortEndpoints []NodePortEndpoint + for i := range backends { + eniid, ok := result[backends[i].IP] + if !ok { + return nil, fmt.Errorf("can not find eniid for ip %s in vpc %s", backends[i].IP, vpcId) + } + // for ENI backend type, port should be set to targetPort (default value), no need to update + nodePortEndpoints = append(nodePortEndpoints, buildNodePortEndpoint(eniid, backends[i].IP, backends[i].Port, alb.ENIBackendType, util.DefaultServerWeight, backends[i].Pod)) + } + + return nodePortEndpoints, nil + +} + +func buildPodEndpoint(epAddr corev1.EndpointAddress, port int, pod *corev1.Pod) PodEndpoint { + return PodEndpoint{ + IP: epAddr.IP, + Port: port, + NodeName: epAddr.NodeName, + Pod: pod, + } +} + +func buildNodePortEndpoint(instanceID string, serverIP string, port int, tp string, weight int, pod *corev1.Pod) NodePortEndpoint { + nodePortEndpoint := NodePortEndpoint{ + ServerId: instanceID, + ServerIp: serverIP, + Weight: weight, + Port: port, + Type: tp, + Pod: pod, + } + return nodePortEndpoint +} + +func LookupServicePort(svc *corev1.Service, port intstr.IntOrString) (corev1.ServicePort, error) { + if port.Type == intstr.String { + for _, p := range svc.Spec.Ports { + if p.Name == port.StrVal { + return p, nil + } + } + } else { + for _, p := range svc.Spec.Ports { + if p.Port == port.IntVal { + return p, nil + } + } + } + + return corev1.ServicePort{}, errors.Errorf("unable to find port %s on service %s", port.String(), util.NamespacedName(svc)) +} + +func RemoteDuplicatedBackends(backends []NodePortEndpoint) []NodePortEndpoint { + nodeMap := make(map[string]struct{}) + var uniqBackends []NodePortEndpoint + for _, backend := range backends { + if _, ok := nodeMap[backend.ServerId]; ok { + continue + } + nodeMap[backend.ServerId] = struct{}{} + uniqBackends = append(uniqBackends, backend) + } + return uniqBackends +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/cert_discovery.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/cert_discovery.go new file mode 100644 index 000000000..7364d3ad6 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/cert_discovery.go @@ -0,0 +1,234 @@ +package albconfigmanager + +import ( + "context" + "strings" + "sync" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/apimachinery/pkg/util/cache" + "k8s.io/apimachinery/pkg/util/sets" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + cassdk "github.com/aliyun/alibaba-cloud-sdk-go/services/cas" + "github.com/go-logr/logr" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +const ( + certIdentifierCacheKey = "CertIdentifier" + defaultCertIDsCacheTTL = 1 * time.Minute + defaultImportedCertDomainsCacheTTL = 5 * time.Minute + defaultPrivateCertDomainsCacheTTL = 10 * time.Hour +) + +const ( + CASVersion = "2021-06-19" + CASDomain = "cas.aliyuncs.com" + CASShowSize = 50 +) + +type CertDiscovery interface { + Discover(ctx context.Context, tlsHosts []string) ([]string, error) +} + +func NewCASCertDiscovery(cloud prvd.Provider, logger logr.Logger) *casCertDiscovery { + return &casCertDiscovery{ + logger: logger, + cloud: cloud, + loadDomainsByCertIDMutex: sync.Mutex{}, + certIDsCache: cache.NewExpiring(), + certIDsCacheTTL: defaultCertIDsCacheTTL, + certDomainsCache: cache.NewExpiring(), + importedCertDomainsCacheTTL: defaultImportedCertDomainsCacheTTL, + privateCertDomainsCacheTTL: defaultPrivateCertDomainsCacheTTL, + } +} + +var _ CertDiscovery = &casCertDiscovery{} + +type casCertDiscovery struct { + cloud prvd.Provider + logger logr.Logger + + loadDomainsByCertIDMutex sync.Mutex + certIDsCache *cache.Expiring + certIDsCacheTTL time.Duration + certDomainsCache *cache.Expiring + importedCertDomainsCacheTTL time.Duration + privateCertDomainsCacheTTL time.Duration +} + +func (d *casCertDiscovery) Discover(ctx context.Context, tlsHosts []string) ([]string, error) { + domainsByCertID, err := d.loadDomainsForAllCertificates(ctx) + if err != nil { + logrus.Errorf("loadDomainsForAllCertificates err: %v", err) + return nil, err + } + certIDs := sets.NewString() + for _, host := range tlsHosts { + var certIDsForHost []string + for certID, domains := range domainsByCertID { + for domain := range domains { + if d.domainMatchesHost(domain, host) { + certIDsForHost = append(certIDsForHost, certID) + break + } + } + } + + if len(certIDsForHost) > 1 { + return nil, errors.Errorf("multiple certificate found for host: %s, certIDs: %v", host, certIDsForHost) + } + if len(certIDsForHost) == 0 { + return nil, errors.Errorf("none certificate found for host: %s", host) + } + certIDs.Insert(certIDsForHost...) + } + return certIDs.List(), nil +} + +const ( + DescribeSSLCertificateList = "DescribeSSLCertificateList" + DescribeSSLCertificatePublicKeyDetail = "DescribeSSLCertificatePublicKeyDetail" +) + +func (d *casCertDiscovery) loadDomainsForAllCertificates(ctx context.Context) (map[string]sets.String, error) { + d.loadDomainsByCertIDMutex.Lock() + defer d.loadDomainsByCertIDMutex.Unlock() + + certIDs, err := d.loadAllCertificateIDs(ctx) + if err != nil { + logrus.Errorf("loadAllCertificateIDs error: %v", err) + return nil, err + } + domainsByCertID := make(map[string]sets.String, len(certIDs)) + for _, certID := range certIDs { + certDomains, err := d.loadDomainsForCertificate(ctx, certID) + if err != nil { + logrus.Errorf("loadDomainsForCertificate error: %v", err) + return nil, err + } + domainsByCertID[certID] = certDomains + } + return domainsByCertID, nil +} + +func (d *casCertDiscovery) loadAllCertificateIDs(ctx context.Context) ([]string, error) { + traceID := ctx.Value(util.TraceID) + + if rawCacheItem, ok := d.certIDsCache.Get(certIdentifierCacheKey); ok { + return rawCacheItem.([]string), nil + } + + req := cassdk.CreateDescribeSSLCertificateListRequest() + req.SetVersion(CASVersion) + req.Domain = CASDomain + req.ShowSize = requests.NewInteger(CASShowSize) + + certificateInfos := make([]cassdk.CertificateInfo, 0) + pageNumber := 1 + for { + req.CurrentPage = requests.NewInteger(pageNumber) + + startTime := time.Now() + d.logger.Info("listing ssl certificate", + "traceID", traceID, + "startTime", startTime, + "action", DescribeSSLCertificateList) + resp, err := d.cloud.DescribeSSLCertificateList(ctx, req) + if err != nil { + logrus.Errorf("DescribeUserCertificateList error: %v", err) + return nil, err + } + d.logger.Info("listed ssl certificate", + "traceID", traceID, + "certMetaList", resp.CertMetaList, + "elapsedTime", time.Since(startTime).Milliseconds(), + "requestID", resp.RequestId, + "action", DescribeSSLCertificateList) + + certificateInfos = append(certificateInfos, resp.CertMetaList...) + + if pageNumber < resp.PageCount { + pageNumber++ + } else { + break + } + } + + var certIDs []string + for _, certSummary := range certificateInfos { + certIDs = append(certIDs, certSummary.CertIdentifier) + } + + d.certIDsCache.Set(certIdentifierCacheKey, certIDs, d.certIDsCacheTTL) + + return certIDs, nil +} + +func (d *casCertDiscovery) loadDomainsForCertificate(ctx context.Context, certID string) (sets.String, error) { + traceID := ctx.Value(util.TraceID) + + if rawCacheItem, ok := d.certDomainsCache.Get(certID); ok { + return rawCacheItem.(sets.String), nil + } + req := cassdk.CreateDescribeSSLCertificatePublicKeyDetailRequest() + req.CertIdentifier = certID + req.SetVersion(CASVersion) + req.Domain = CASDomain + + startTime := time.Now() + d.logger.Info("getting ssl certificate", + "traceID", traceID, + "certID", certID, + "startTime", startTime, + "action", DescribeSSLCertificatePublicKeyDetail) + resp, err := d.cloud.DescribeSSLCertificatePublicKeyDetail(ctx, req) + if err != nil { + logrus.Errorf("DescribeUserCertificateDetail error: %v", err) + return nil, err + } + d.logger.Info("got ssl certificate", + "traceID", traceID, + "certID", certID, + "elapsedTime", time.Since(startTime).Milliseconds(), + "certificateInfo", resp.CertificateInfo, + "requestID", resp.RequestId, + "action", DescribeSSLCertificatePublicKeyDetail) + + domains := sets.NewString(resp.CertificateInfo.CommonName, resp.CertificateInfo.Sans) + d.certDomainsCache.Set(certID, domains, d.importedCertDomainsCacheTTL) + + return domains, nil +} + +func (d *casCertDiscovery) domainMatchesHost(domainName string, tlsHost string) bool { + isMatch := false + domains := strings.Split(domainName, ",") + for _, dom := range domains { + if strings.HasPrefix(dom, "*.") { + ds := strings.Split(dom, ".") + hs := strings.Split(tlsHost, ".") + if len(ds) != len(hs) { + continue + } + + if cmp.Equal(ds[1:], hs[1:], cmpopts.EquateEmpty()) { + isMatch = true + break + } + } + if dom == tlsHost { + isMatch = true + break + } + } + return isMatch +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/finalizer.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/finalizer.go new file mode 100644 index 000000000..f135a0ac6 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/finalizer.go @@ -0,0 +1,50 @@ +package albconfigmanager + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + networking "k8s.io/api/networking/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" +) + +type FinalizerManager interface { + AddGroupFinalizer(ctx context.Context, members []*networking.Ingress) error + + RemoveGroupFinalizer(ctx context.Context, inactiveMembers []*networking.Ingress) error +} + +func NewDefaultFinalizerManager(k8sFinalizerManager helper.FinalizerManager) *defaultFinalizerManager { + return &defaultFinalizerManager{ + k8sFinalizerManager: k8sFinalizerManager, + } +} + +var _ FinalizerManager = (*defaultFinalizerManager)(nil) + +type defaultFinalizerManager struct { + k8sFinalizerManager helper.FinalizerManager +} + +func (m *defaultFinalizerManager) AddGroupFinalizer(ctx context.Context, members []*networking.Ingress) error { + for _, member := range members { + if err := m.k8sFinalizerManager.AddFinalizers(ctx, member, GetIngressFinalizer()); err != nil { + return err + } + } + return nil +} + +func (m *defaultFinalizerManager) RemoveGroupFinalizer(ctx context.Context, inactiveMembers []*networking.Ingress) error { + for _, ing := range inactiveMembers { + if err := m.k8sFinalizerManager.RemoveFinalizers(ctx, ing, GetIngressFinalizer()); err != nil { + return err + } + } + return nil +} + +func GetIngressFinalizer() string { + return util.IngressFinalizer +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/group_loader.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/group_loader.go new file mode 100644 index 000000000..fc3e40486 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/group_loader.go @@ -0,0 +1,206 @@ +package albconfigmanager + +import ( + "context" + "fmt" + "sort" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store" + + networking "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + "k8s.io/klog" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/pkg/errors" +) + +var ( + errInvalidIngressGroup = errors.New("invalid ingress group") + DefaultGroupName = "default" + ALBConfigNamespace = "kube-system" +) + +type GroupID types.NamespacedName + +func (groupID GroupID) String() string { + return fmt.Sprintf("%s/%s", groupID.Namespace, groupID.Name) +} + +type Group struct { + ID GroupID + + Members []*networking.Ingress + + InactiveMembers []*networking.Ingress +} + +type GroupLoader interface { + Load(ctx context.Context, groupID GroupID, ingress []*store.Ingress) (*Group, error) + + LoadGroupID(ctx context.Context, ing *networking.Ingress) (*GroupID, error) +} + +func NewDefaultGroupLoader(kubeClient client.Client, annotationParser annotations.Parser) *defaultGroupLoader { + return &defaultGroupLoader{ + annotationParser: annotationParser, + kubeClient: kubeClient, + } +} + +var _ GroupLoader = (*defaultGroupLoader)(nil) + +type defaultGroupLoader struct { + annotationParser annotations.Parser + kubeClient client.Client +} + +func (m *defaultGroupLoader) Load(ctx context.Context, groupID GroupID, ingress []*store.Ingress) (*Group, error) { + + var members []*networking.Ingress + var inactiveMembers []*networking.Ingress + for _, ing := range ingress { + groupName := "" + if exists := m.annotationParser.ParseStringAnnotation(util.IngressSuffixAlbConfigName, &groupName, ing.Annotations); !exists { + // 设置默认为:default + groupName = DefaultGroupName + } + if groupID.Namespace == ALBConfigNamespace { + if groupID.Name != groupName { + continue + } + } else { + if groupID.Name != groupName || groupID.Namespace != ing.Namespace { + continue + } + } + + isGroupMember, err := m.isGroupMember(ctx, groupID, &ing.Ingress) + if err != nil { + return nil, errors.Wrapf(err, "ingress: %v", util.NamespacedName(ing)) + } + if isGroupMember { + members = append(members, &ing.Ingress) + } else if m.containsGroupFinalizer(GetIngressFinalizer(), &ing.Ingress) { + inactiveMembers = append(inactiveMembers, &ing.Ingress) + } + } + + klog.Infof("groupID: %v, members: %d, inactiveMembers: %d", groupID, len(members), len(inactiveMembers)) + + sortedMembers, err := m.sortGroupMembers(members) + if err != nil { + return nil, err + } + + return &Group{ + ID: groupID, + Members: sortedMembers, + InactiveMembers: inactiveMembers, + }, nil +} + +func (m *defaultGroupLoader) isGroupMember(ctx context.Context, groupID GroupID, ing *networking.Ingress) (bool, error) { + if !ing.DeletionTimestamp.IsZero() { + return false, nil + } + + ingGroupID, err := m.LoadGroupID(ctx, ing) + if err != nil { + return false, err + } + if ingGroupID == nil || ingGroupID.Name == "" { + return false, nil + } + + return groupID == *ingGroupID, nil +} + +func (m *defaultGroupLoader) LoadGroupID(ctx context.Context, ing *networking.Ingress) (*GroupID, error) { + groupName := "" + if exists := m.annotationParser.ParseStringAnnotation(util.IngressSuffixAlbConfigName, &groupName, ing.Annotations); !exists { + groupName = DefaultGroupName + } + albconfig := &v1.AlbConfig{} + if err := m.kubeClient.Get(ctx, types.NamespacedName{ + Namespace: ing.Namespace, + Name: groupName, + }, albconfig); err == nil { + groupID := GroupID(types.NamespacedName{ + Namespace: ing.Namespace, + Name: groupName, + }) + return &groupID, nil + } + groupID := GroupID(types.NamespacedName{ + Namespace: ALBConfigNamespace, + Name: groupName, + }) + return &groupID, nil +} + +func (m *defaultGroupLoader) containsGroupFinalizer(finalizer string, ing *networking.Ingress) bool { + return helper.HasFinalizer(ing, finalizer) +} + +type groupMemberWithOrder struct { + member *networking.Ingress + order int64 +} + +const ( + defaultGroupOrder int64 = 10 + minGroupOrder int64 = 1 + maxGroupOder int64 = 1000 +) + +func (m *defaultGroupLoader) sortGroupMembers(members []*networking.Ingress) ([]*networking.Ingress, error) { + if len(members) == 0 { + return nil, nil + } + + groupMemberWithOrderList := make([]groupMemberWithOrder, 0, len(members)) + explicitOrders := sets.NewInt64() + for _, member := range members { + var order = defaultGroupOrder + exists, err := m.annotationParser.ParseInt64Annotation(util.IngressSuffixAlbConfigOrder, &order, member.Annotations) + if err != nil { + return nil, errors.Wrapf(err, "failed to load Ingress group order for ingress: %v", util.NamespacedName(member)) + } + if exists { + if order < minGroupOrder || order > maxGroupOder { + return nil, errors.Errorf("explicit Ingress group order must be within [%v:%v], Ingress: %v, order: %v", + minGroupOrder, maxGroupOder, util.NamespacedName(member), order) + } + if explicitOrders.Has(order) { + return nil, errors.Errorf("conflict Ingress group order: %v", order) + } + explicitOrders.Insert(order) + } + + groupMemberWithOrderList = append(groupMemberWithOrderList, groupMemberWithOrder{member: member, order: order}) + } + + sort.Slice(groupMemberWithOrderList, func(i, j int) bool { + orderI := groupMemberWithOrderList[i].order + orderJ := groupMemberWithOrderList[j].order + if orderI != orderJ { + return orderI < orderJ + } + + nameI := util.NamespacedName(groupMemberWithOrderList[i].member).String() + nameJ := util.NamespacedName(groupMemberWithOrderList[j].member).String() + return nameI < nameJ + }) + + sortedMembers := make([]*networking.Ingress, 0, len(groupMemberWithOrderList)) + for _, item := range groupMemberWithOrderList { + sortedMembers = append(sortedMembers, item.member) + } + return sortedMembers, nil +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener.go new file mode 100644 index 000000000..98fb20c18 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener.go @@ -0,0 +1,115 @@ +package albconfigmanager + +import ( + "context" + "fmt" + + v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" +) + +func (t *defaultModelBuildTask) buildListener(ctx context.Context, lbID core.StringToken, lsSpec *v1.ListenerSpec) (*alb.Listener, error) { + lsSpecDst, err := t.buildListenerSpec(ctx, lbID, lsSpec) + if err != nil { + return nil, err + } + lsResID := fmt.Sprintf("%v", lsSpecDst.ListenerPort) + ls := alb.NewListener(t.stack, lsResID, lsSpecDst) + return ls, nil +} + +const ( + ListenerDescriptionPrefix = "ls" +) + +func (t *defaultModelBuildTask) buildListenerSpec(ctx context.Context, lbID core.StringToken, apiLs *v1.ListenerSpec) (alb.ListenerSpec, error) { + defaultAction, err := t.buildLsDefaultAction(ctx, apiLs.Port.IntValue()) + if err != nil { + return alb.ListenerSpec{}, err + } + modelLs := alb.ListenerSpec{ + LoadBalancerID: lbID, + } + modelLs.DefaultActions = []alb.Action{defaultAction} + modelLs.ListenerPort = apiLs.Port.IntValue() + modelLs.ListenerDescription = apiLs.Description + modelLs.ListenerProtocol = apiLs.Protocol + modelLs.IdleTimeout = apiLs.IdleTimeout + modelLs.RequestTimeout = apiLs.RequestTimeout + modelLs.SecurityPolicyId = apiLs.SecurityPolicyId + modelLs.LogConfig = alb.LogConfig{ + AccessLogRecordCustomizedHeadersEnabled: apiLs.LogConfig.AccessLogRecordCustomizedHeadersEnabled, + AccessLogTracingConfig: alb.AccessLogTracingConfig{ + TracingSample: apiLs.LogConfig.AccessLogTracingConfig.TracingSample, + TracingType: apiLs.LogConfig.AccessLogTracingConfig.TracingType, + TracingEnabled: apiLs.LogConfig.AccessLogTracingConfig.TracingEnabled, + }, + } + modelLs.QuicConfig = alb.QuicConfig{ + QuicUpgradeEnabled: apiLs.QuicConfig.QuicUpgradeEnabled, + QuicListenerId: apiLs.QuicConfig.QuicListenerId, + } + modelLs.XForwardedForConfig = alb.XForwardedForConfig{ + XForwardedForClientCertSubjectDNAlias: apiLs.XForwardedForConfig.XForwardedForClientCertSubjectDNAlias, + XForwardedForClientCertSubjectDNEnabled: apiLs.XForwardedForConfig.XForwardedForClientCertSubjectDNEnabled, + XForwardedForProtoEnabled: apiLs.XForwardedForConfig.XForwardedForProtoEnabled, + XForwardedForClientCertIssuerDNEnabled: apiLs.XForwardedForConfig.XForwardedForClientCertIssuerDNEnabled, + XForwardedForSLBIdEnabled: apiLs.XForwardedForConfig.XForwardedForSLBIdEnabled, + XForwardedForClientSrcPortEnabled: apiLs.XForwardedForConfig.XForwardedForClientSrcPortEnabled, + XForwardedForClientCertFingerprintEnabled: apiLs.XForwardedForConfig.XForwardedForClientCertFingerprintEnabled, + XForwardedForEnabled: apiLs.XForwardedForConfig.XForwardedForEnabled, + XForwardedForSLBPortEnabled: apiLs.XForwardedForConfig.XForwardedForSLBPortEnabled, + XForwardedForClientCertClientVerifyAlias: apiLs.XForwardedForConfig.XForwardedForClientCertClientVerifyAlias, + XForwardedForClientCertIssuerDNAlias: apiLs.XForwardedForConfig.XForwardedForClientCertIssuerDNAlias, + XForwardedForClientCertFingerprintAlias: apiLs.XForwardedForConfig.XForwardedForClientCertFingerprintAlias, + XForwardedForClientCertClientVerifyEnabled: apiLs.XForwardedForConfig.XForwardedForClientCertClientVerifyEnabled, + } + + if modelLs.ListenerPort == 0 { + modelLs.ListenerPort = t.defaultListenerPort + } + if len(modelLs.ListenerProtocol) == 0 { + modelLs.ListenerProtocol = t.defaultListenerProtocol + } + if modelLs.IdleTimeout == 0 { + modelLs.IdleTimeout = t.defaultListenerIdleTimeout + } + if modelLs.RequestTimeout == 0 { + modelLs.RequestTimeout = t.defaultListenerRequestTimeout + } + if len(modelLs.ListenerDescription) == 0 { + modelLs.ListenerDescription = fmt.Sprintf("%v-%v", ListenerDescriptionPrefix, modelLs.ListenerPort) + } + if apiLs.GzipEnabled == nil { + modelLs.GzipEnabled = t.defaultListenerGzipEnabled + } + + if apiLs.Protocol == string(ProtocolHTTPS) { + modelLs.Certificates = transCertificatesFromAPIToSDK(apiLs.Certificates) + if len(apiLs.CaCertificates) != 0 { + modelLs.CaCertificates = transCertificatesFromAPIToSDK(apiLs.CaCertificates) + } + if len(modelLs.SecurityPolicyId) == 0 { + modelLs.SecurityPolicyId = t.defaultListenerSecurityPolicyId + } + if apiLs.Http2Enabled == nil { + modelLs.Http2Enabled = t.defaultListenerHttp2Enabled + } + } + + return modelLs, nil +} + +func transCertificatesFromAPIToSDK(apiCerts []v1.Certificate) []alb.Certificate { + sdkCerts := make([]alb.Certificate, 0) + + for _, apiCert := range apiCerts { + sdkCerts = append(sdkCerts, alb.Certificate{ + IsDefault: apiCert.IsDefault, + CertificateId: apiCert.CertificateId, + }) + } + + return sdkCerts +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener_rules.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener_rules.go new file mode 100644 index 000000000..d90693f40 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_listener_rules.go @@ -0,0 +1,356 @@ +package albconfigmanager + +import ( + "context" + "fmt" + "strconv" + "strings" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + corev1 "k8s.io/api/core/v1" + networking "k8s.io/api/networking/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + "k8s.io/klog" + + "github.com/pkg/errors" +) + +const ( + ListenerRuleNamePrefix = "rule" + HTTPRedirectCode = "308" + CookieAlways = "always" + HTTPS443 = "443" +) + +func (t *defaultModelBuildTask) buildListenerRules(ctx context.Context, lsID core.StringToken, port int32, ingList []networking.Ingress) error { + var rules []alb.ListenerRule + carryWeight := make(map[string][]alb.ServerGroupTuple, 0) + for _, ing := range ingList { + if v := annotations.GetStringAnnotationMutil(annotations.NginxCanary, annotations.AlbCanary, &ing); v == "true" { + weight := 0 + w := annotations.GetStringAnnotationMutil(annotations.NginxCanaryWeight, annotations.AlbCanaryWeight, &ing) + wi, _ := strconv.Atoi(w) + weight = wi + for _, rule := range ing.Spec.Rules { + if rule.HTTP == nil { + continue + } + for _, path := range rule.HTTP.Paths { + if _, ok := carryWeight[rule.Host+"-"+path.Path]; ok { + carryWeight[rule.Host+"-"+path.Path] = append(carryWeight[rule.Host+"-"+path.Path], alb.ServerGroupTuple{ + ServiceName: path.Backend.Service.Name, + ServicePort: int(path.Backend.Service.Port.Number), + Weight: weight, + }) + } else { + carryWeight[rule.Host+"-"+path.Path] = []alb.ServerGroupTuple{{ + ServiceName: path.Backend.Service.Name, + ServicePort: int(path.Backend.Service.Port.Number), + Weight: weight, + }, + } + } + + break + } + } + break + } + } + for _, ing := range ingList { + if v := annotations.GetStringAnnotationMutil(annotations.NginxCanary, annotations.AlbCanary, &ing); v == "true" { + we := annotations.GetStringAnnotationMutil(annotations.NginxCanaryWeight, annotations.AlbCanaryWeight, &ing) + if we != "" { + continue + } + } + for _, rule := range ing.Spec.Rules { + if rule.HTTP == nil { + continue + } + + for _, path := range rule.HTTP.Paths { + var action alb.Action + if v := annotations.GetStringAnnotationMutil(annotations.NginxSslRedirect, annotations.AlbSslRedirect, &ing); v == "true" && port != 443 { + action = buildActionViaHostAndPath(ctx, rule.Host, path.Path) + } else { + action = buildActionViaServiceAndServicePort(ctx, path.Backend.Service.Name, int(path.Backend.Service.Port.Number), 100) + if v := annotations.GetStringAnnotationMutil(annotations.NginxCanary, annotations.AlbCanary, &ing); v != "true" { + if canaryWeights, ok := carryWeight[rule.Host+"-"+path.Path]; ok { + canaryWeight := 0 + for _, cw := range canaryWeights { + canaryWeight += cw.Weight + } + for i := range action.ForwardConfig.ServerGroups { + action.ForwardConfig.ServerGroups[i].Weight = 100 - canaryWeight + } + action.ForwardConfig.ServerGroups = append(action.ForwardConfig.ServerGroups, canaryWeights...) + } + } + } + + conditions, err := t.buildRuleConditions(ctx, rule, path, ing) + if err != nil { + return errors.Wrapf(err, "ingress: %v", util.NamespacedName(&ing)) + } + action2, err := t.buildAction(ctx, ing, action) + lrs := alb.ListenerRuleSpec{ + ListenerID: lsID, + } + lrs.RuleActions = []alb.Action{action2} + lrs.RuleConditions = conditions + rules = append(rules, alb.ListenerRule{ + Spec: lrs, + }) + } + } + } + + priority := 1 + for _, rule := range rules { + ruleResID := fmt.Sprintf("%v:%v", port, priority) + klog.Infof("ruleResID: %s", ruleResID) + lrs := alb.ListenerRuleSpec{ + ListenerID: lsID, + } + lrs.Priority = priority + lrs.RuleConditions = rule.Spec.RuleConditions + lrs.RuleActions = rule.Spec.RuleActions + lrs.RuleName = fmt.Sprintf("%v-%v-%v", ListenerRuleNamePrefix, port, priority) + _ = alb.NewListenerRule(t.stack, ruleResID, lrs) + priority += 1 + } + + return nil +} + +func buildActionViaServiceAndServicePort(_ context.Context, svcName string, svcPort int, weight int) alb.Action { + action := alb.Action{ + Type: util.RuleActionTypeForward, + ForwardConfig: &alb.ForwardActionConfig{ + ServerGroups: []alb.ServerGroupTuple{ + { + ServiceName: svcName, + ServicePort: svcPort, + Weight: weight, + }, + }, + }, + } + return action +} + +func buildActionViaHostAndPath(_ context.Context, host, path string) alb.Action { + action := alb.Action{ + Type: util.RuleActionTypeRedirect, + RedirectConfig: &alb.RedirectConfig{ + Host: host, + Path: "${path}", + Protocol: util.ListenerProtocolHTTPS, + Port: HTTPS443, + HttpCode: HTTPRedirectCode, + Query: "${query}", + }, + } + return action +} + +func (t *defaultModelBuildTask) buildPathPatternsForImplementationSpecificPathType(path string) ([]string, error) { + return []string{path}, nil +} + +func (t *defaultModelBuildTask) buildPathPatternsForExactPathType(path string) ([]string, error) { + if strings.ContainsAny(path, "*?") { + return nil, errors.Errorf("exact path shouldn't contain wildcards: %v", path) + } + return []string{path}, nil +} + +func (t *defaultModelBuildTask) buildPathPatternsForPrefixPathType(path string) ([]string, error) { + if path == "/" { + return []string{"/*"}, nil + } + if strings.ContainsAny(path, "*?") { + return nil, errors.Errorf("prefix path shouldn't contain wildcards: %v", path) + } + + normalizedPath := strings.TrimSuffix(path, "/") + return []string{normalizedPath, normalizedPath + "/*"}, nil +} + +func (t *defaultModelBuildTask) buildPathPatterns(path string, pathType *networking.PathType) ([]string, error) { + normalizedPathType := networking.PathTypeImplementationSpecific + if pathType != nil { + normalizedPathType = *pathType + } + switch normalizedPathType { + case networking.PathTypeImplementationSpecific: + return t.buildPathPatternsForImplementationSpecificPathType(path) + case networking.PathTypeExact: + return t.buildPathPatternsForExactPathType(path) + case networking.PathTypePrefix: + return t.buildPathPatternsForPrefixPathType(path) + default: + return nil, errors.Errorf("unsupported pathType: %v", normalizedPathType) + } +} + +func (t *defaultModelBuildTask) buildHostHeaderCondition(_ context.Context, hosts []string) alb.Condition { + return alb.Condition{ + Type: util.RuleConditionFieldHost, + HostConfig: alb.HostConfig{ + Values: hosts, + }, + } +} + +func (t *defaultModelBuildTask) buildHeaderCondition(_ context.Context, key string, values []string) alb.Condition { + return alb.Condition{ + Type: util.RuleConditionFieldHeader, + HeaderConfig: alb.HeaderConfig{ + Key: key, + Values: values, + }, + } +} +func (t *defaultModelBuildTask) buildCookieCondition(_ context.Context, key string, value string) alb.Condition { + return alb.Condition{ + Type: util.RuleConditionFieldCookie, + CookieConfig: alb.CookieConfig{ + Values: []alb.Value{{ + Key: key, + Value: value, + }, + }, + }, + } +} + +func (t *defaultModelBuildTask) buildPathPatternCondition(_ context.Context, paths []string) alb.Condition { + return alb.Condition{ + Type: util.RuleConditionFieldPath, + PathConfig: alb.PathConfig{ + Values: paths, + }, + } +} + +func (t *defaultModelBuildTask) buildRuleConditions(ctx context.Context, rule networking.IngressRule, + path networking.HTTPIngressPath, ing networking.Ingress) ([]alb.Condition, error) { + var hosts []string + if rule.Host != "" { + hosts = append(hosts, rule.Host) + } + var paths []string + if path.Path != "" { + pathPatterns, err := t.buildPathPatterns(path.Path, path.PathType) + if err != nil { + return nil, err + } + paths = append(paths, pathPatterns...) + } + + var conditions []alb.Condition + if len(hosts) != 0 { + conditions = append(conditions, t.buildHostHeaderCondition(ctx, hosts)) + } + if len(paths) != 0 { + conditions = append(conditions, t.buildPathPatternCondition(ctx, paths)) + } + if v := annotations.GetStringAnnotationMutil(annotations.NginxCanary, annotations.AlbCanary, &ing); v == "true" { + header := annotations.GetStringAnnotationMutil(annotations.NginxCanaryByHeader, annotations.AlbCanaryByHeader, &ing) + if header != "" { + value := annotations.GetStringAnnotationMutil(annotations.NginxCanaryByHeaderValue, annotations.AlbCanaryByHeaderValue, &ing) + conditions = append(conditions, t.buildHeaderCondition(ctx, header, []string{value})) + } + cookie := annotations.GetStringAnnotationMutil(annotations.NginxCanaryByCookie, annotations.AlbCanaryByCookie, &ing) + if cookie != "" { + conditions = append(conditions, t.buildCookieCondition(ctx, cookie, CookieAlways)) + } + + } + + return conditions, nil +} + +func (t *defaultModelBuildTask) buildFixedResponseAction(_ context.Context, actionCfg alb.Action) (*alb.Action, error) { + if len(actionCfg.FixedResponseConfig.ContentType) == 0 { + return nil, errors.New("missing FixedResponseConfig") + } + return &alb.Action{ + Type: util.RuleActionTypeFixedResponse, + FixedResponseConfig: &alb.FixedResponseConfig{ + ContentType: actionCfg.FixedResponseConfig.ContentType, + Content: actionCfg.FixedResponseConfig.Content, + HttpCode: actionCfg.FixedResponseConfig.HttpCode, + }, + }, nil +} + +func (t *defaultModelBuildTask) buildRedirectAction(_ context.Context, actionCfg alb.Action) (*alb.Action, error) { + if actionCfg.RedirectConfig == nil { + return nil, errors.New("missing RedirectConfig") + } + return &alb.Action{ + Type: util.RuleActionTypeRedirect, + RedirectConfig: &alb.RedirectConfig{ + Host: actionCfg.RedirectConfig.Host, + Path: actionCfg.RedirectConfig.Path, + Port: actionCfg.RedirectConfig.Port, + Protocol: actionCfg.RedirectConfig.Protocol, + Query: actionCfg.RedirectConfig.Query, + HttpCode: actionCfg.RedirectConfig.HttpCode, + }, + }, nil +} + +func (t *defaultModelBuildTask) buildForwardAction(ctx context.Context, ing networking.Ingress, actionCfg alb.Action) (*alb.Action, error) { + if actionCfg.ForwardConfig == nil { + return nil, errors.New("missing ForwardConfig") + } + + var serverGroupTuples []alb.ServerGroupTuple + for _, sgp := range actionCfg.ForwardConfig.ServerGroups { + svc := new(corev1.Service) + svc.Namespace = ing.Namespace + svc.Name = sgp.ServiceName + modelSgp, err := t.buildServerGroup(ctx, &ing, svc, sgp.ServicePort) + if err != nil { + return nil, err + } + serverGroupTuples = append(serverGroupTuples, alb.ServerGroupTuple{ + ServerGroupID: modelSgp.ServerGroupID(), + Weight: sgp.Weight, + }) + } + + return &alb.Action{ + Type: util.RuleActionTypeForward, + ForwardConfig: &alb.ForwardActionConfig{ + ServerGroups: serverGroupTuples, + }, + }, nil +} + +func (t *defaultModelBuildTask) buildBackendAction(ctx context.Context, ing networking.Ingress, actionCfg alb.Action) (*alb.Action, error) { + switch actionCfg.Type { + case util.RuleActionTypeFixedResponse: + return t.buildFixedResponseAction(ctx, actionCfg) + case util.RuleActionTypeRedirect: + return t.buildRedirectAction(ctx, actionCfg) + case util.RuleActionTypeForward: + return t.buildForwardAction(ctx, ing, actionCfg) + } + return nil, errors.Errorf("unknown action type: %v", actionCfg.Type) +} + +func (t *defaultModelBuildTask) buildAction(ctx context.Context, ing networking.Ingress, action alb.Action) (alb.Action, error) { + backendAction, err := t.buildBackendAction(ctx, ing, action) + if err != nil { + return alb.Action{}, err + } + return *backendAction, nil +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_load_balancer.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_load_balancer.go new file mode 100644 index 000000000..5be3639aa --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_load_balancer.go @@ -0,0 +1,119 @@ +package albconfigmanager + +import ( + "context" + "crypto/sha256" + "encoding/hex" + "fmt" + "regexp" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + + "github.com/pkg/errors" +) + +const ( + ApplicationLoadBalancerResource = "ApplicationLoadBalancer" +) + +func (t *defaultModelBuildTask) buildAlbLoadBalancer(ctx context.Context, albconfig *v1.AlbConfig) (*alb.AlbLoadBalancer, error) { + lbSpec, err := t.buildAlbLoadBalancerSpec(ctx, albconfig) + if err != nil { + return nil, err + } + lb := alb.NewAlbLoadBalancer(t.stack, ApplicationLoadBalancerResource, lbSpec) + t.loadBalancer = lb + return lb, nil +} + +func (t *defaultModelBuildTask) buildAlbLoadBalancerSpec(ctx context.Context, albConfig *v1.AlbConfig) (alb.ALBLoadBalancerSpec, error) { + lbModel := alb.ALBLoadBalancerSpec{} + lbModel.LoadBalancerId = albConfig.Spec.LoadBalancer.Id + lbModel.ForceOverride = albConfig.Spec.LoadBalancer.ForceOverride + if len(albConfig.Spec.LoadBalancer.Name) != 0 { + lbModel.LoadBalancerName = albConfig.Spec.LoadBalancer.Name + } else { + lbName, err := t.buildAlbLoadBalancerName() + if err != nil { + return alb.ALBLoadBalancerSpec{}, nil + } + lbModel.LoadBalancerName = lbName + } + lbModel.VpcId = t.vpcID + lbModel.AccessLogConfig = alb.AccessLogConfig{ + LogStore: albConfig.Spec.LoadBalancer.AccessLogConfig.LogStore, + LogProject: albConfig.Spec.LoadBalancer.AccessLogConfig.LogProject, + } + + zoneMappings := make([]alb.ZoneMapping, 0) + if albConfig.Spec.LoadBalancer.Id == "" { + if len(albConfig.Spec.LoadBalancer.ZoneMappings) != 0 { + vSwitchIds := make([]string, 0) + for _, zm := range albConfig.Spec.LoadBalancer.ZoneMappings { + vSwitchIds = append(vSwitchIds, zm.VSwitchId) + } + vSwitches, err := t.vSwitchResolver.ResolveViaIDSlice(ctx, vSwitchIds) + if err != nil { + return alb.ALBLoadBalancerSpec{}, err + } + if len(vSwitches) < 2 { + return alb.ALBLoadBalancerSpec{}, errors.New("unable to discover at least two vswitchs for alb") + } + for _, vSwitch := range vSwitches { + zoneMappings = append(zoneMappings, alb.ZoneMapping{ + VSwitchId: vSwitch.VSwitchId, + ZoneId: vSwitch.ZoneId, + }) + } + } else { + vSwitches, err := t.vSwitchResolver.ResolveViaDiscovery(ctx) + if err != nil { + return alb.ALBLoadBalancerSpec{}, err + } + if len(vSwitches) < 2 { + return alb.ALBLoadBalancerSpec{}, errors.New("unable to discover at least two albZones for alb") + } + for _, vSwitch := range vSwitches { + zoneMappings = append(zoneMappings, alb.ZoneMapping{ + VSwitchId: vSwitch.VSwitchId, + ZoneId: vSwitch.ZoneId, + }) + } + } + } + lbModel.ZoneMapping = zoneMappings + + lbModel.AddressAllocatedMode = albConfig.Spec.LoadBalancer.AddressAllocatedMode + lbModel.AddressType = albConfig.Spec.LoadBalancer.AddressType + lbModel.DeletionProtectionConfig = alb.DeletionProtectionConfig{ + Enabled: *albConfig.Spec.LoadBalancer.DeletionProtectionEnabled, + EnabledTime: "", + } + lbModel.ModificationProtectionConfig = alb.ModificationProtectionConfig{ + Reason: "", + Status: util.LoadBalancerModificationProtectionStatusConsoleProtection, + } + lbModel.LoadBalancerBillingConfig = alb.LoadBalancerBillingConfig{ + InternetBandwidth: albConfig.Spec.LoadBalancer.BillingConfig.InternetBandwidth, + InternetChargeType: albConfig.Spec.LoadBalancer.BillingConfig.InternetChargeType, + PayType: albConfig.Spec.LoadBalancer.BillingConfig.PayType, + } + lbModel.LoadBalancerEdition = albConfig.Spec.LoadBalancer.Edition + return lbModel, nil +} + +var invalidLoadBalancerNamePattern = regexp.MustCompile("[[:^alnum:]]") + +func (t *defaultModelBuildTask) buildAlbLoadBalancerName() (string, error) { + uuidHash := sha256.New() + _, _ = uuidHash.Write([]byte(t.clusterID)) + _, _ = uuidHash.Write([]byte(t.ingGroup.ID.String())) + uuid := hex.EncodeToString(uuidHash.Sum(nil)) + + sanitizedNamespace := invalidLoadBalancerNamePattern.ReplaceAllString(t.ingGroup.ID.Namespace, "") + sanitizedName := invalidLoadBalancerNamePattern.ReplaceAllString(t.ingGroup.ID.Name, "") + return fmt.Sprintf("k8s-%s-%s-%.10s", sanitizedNamespace, sanitizedName, uuid), nil +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_server_group.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_server_group.go new file mode 100644 index 000000000..68524fdca --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_build_server_group.go @@ -0,0 +1,186 @@ +package albconfigmanager + +import ( + "context" + "crypto/sha256" + "encoding/hex" + "fmt" + "regexp" + "strconv" + + corev1 "k8s.io/api/core/v1" + networking "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + "k8s.io/klog" +) + +func (t *defaultModelBuildTask) buildServerGroup(ctx context.Context, + ing *networking.Ingress, svc *corev1.Service, port int) (*alb.ServerGroup, error) { + sgpResID := t.buildServerGroupResourceID(util.NamespacedName(ing), util.NamespacedName(svc), port) + if sgp, exists := t.sgpByResID[sgpResID]; exists { + return sgp, nil + } + sgpSpec, err := t.buildServerGroupSpec(ctx, ing, svc, port) + if err != nil { + return nil, err + } + sgp := alb.NewServerGroup(t.stack, sgpResID, sgpSpec) + t.sgpByResID[sgpResID] = sgp + return sgp, nil +} + +func calServerGroupResourceIDHashUUID(resourceID string) string { + uuidHash := sha256.New() + _, _ = uuidHash.Write([]byte(resourceID)) + uuid := hex.EncodeToString(uuidHash.Sum(nil)) + return uuid +} + +func (t *defaultModelBuildTask) buildServerGroupResourceID(ingKey types.NamespacedName, svcKey types.NamespacedName, port int) string { + resourceID := fmt.Sprintf("%s/%s-%s:%s", ingKey.Namespace, ingKey.Name, svcKey.Name, fmt.Sprintf("%v", port)) + return calServerGroupResourceIDHashUUID(resourceID) +} + +var invalidTargetGroupNamePattern = regexp.MustCompile("[[:^alnum:]]") + +func (t *defaultModelBuildTask) buildServerGroupName(ing *networking.Ingress, svc *corev1.Service, port int) string { + return fmt.Sprintf("%s-%s-%s", svc.Namespace, svc.Name, fmt.Sprintf("%v", port)) +} + +func (t *defaultModelBuildTask) buildServerGroupSpec(_ context.Context, + ing *networking.Ingress, svc *corev1.Service, port int) (alb.ServerGroupSpec, error) { + + // preCheck tag value + if len(ing.Namespace) == 0 || + len(ing.Name) == 0 || + len(svc.Name) == 0 { + return alb.ServerGroupSpec{}, fmt.Errorf("ingress namespace, ingress name and service name cant be empty") + } + tags := make([]alb.ALBTag, 0) + tags = append(tags, []alb.ALBTag{ + { + Key: util.ServiceNamespaceTagKey, + Value: ing.Namespace, + }, + { + Key: util.IngressNameTagKey, + Value: ing.Name, + }, + { + Key: util.ServiceNameTagKey, + Value: svc.Name, + }, + { + Key: util.ServicePortTagKey, + Value: fmt.Sprintf("%v", port), + }, + }...) + + sgpNameKey := alb.ServerGroupNamedKey{ + ClusterID: t.clusterID, + IngressName: ing.GetName(), + ServiceName: svc.GetName(), + Namespace: svc.GetNamespace(), + ServicePort: port, + } + + var sgpSpec alb.ServerGroupSpec + sgpSpec.ServerGroupNamedKey = sgpNameKey + sgpSpec.Tags = tags + sgpSpec.HealthCheckConfig = buildServerGroupHealthCheckConfig(ing) + sgpSpec.ServerGroupName = t.buildServerGroupName(ing, svc, port) + sgpSpec.Scheduler = t.defaultServerGroupScheduler + sgpSpec.Protocol = t.defaultServerGroupProtocol + sgpSpec.StickySessionConfig = buildServerGroupStickySessionConfig(ing) + sgpSpec.ServerGroupType = t.defaultServerGroupType + sgpSpec.VpcId = t.vpcID + return sgpSpec, nil +} + +func buildServerGroupHealthCheckConfig(ing *networking.Ingress) alb.HealthCheckConfig { + healthCheckEnabled := util.DefaultServerGroupHealthCheckEnabled + if v, ok := ing.Annotations[annotations.HealthCheckEnabled]; ok && v == "true" { + healthCheckEnabled = true + } + + healthcheckPath := util.DefaultServerGroupHealthCheckPath + if v, ok := ing.Annotations[annotations.HealthCheckPath]; ok { + healthcheckPath = v + } + healthcheckMethod := util.DefaultServerGroupHealthCheckMethod + if v, ok := ing.Annotations[annotations.HealthCheckMethod]; ok { + healthcheckMethod = v + } + healthcheckProtocol := util.DefaultServerGroupHealthCheckProtocol + if v, ok := ing.Annotations[annotations.HealthCheckProtocol]; ok { + healthcheckProtocol = v + } + healthcheckCode := util.DefaultServerGroupHealthCheckHTTPCodes + if v, ok := ing.Annotations[annotations.HealthCheckHTTPCode]; ok { + healthcheckCode = v + } + healthcheckTimeout := util.DefaultServerGroupHealthCheckTimeout + if v, ok := ing.Annotations[annotations.HealthCheckTimeout]; ok { + if val, err := strconv.Atoi(v); err != nil { + klog.Error(err.Error()) + } else { + healthcheckTimeout = val + } + } + healthCheckInterval := util.DefaultServerGroupHealthCheckInterval + if v, ok := ing.Annotations[annotations.HealthCheckInterval]; ok { + if val, err := strconv.Atoi(v); err != nil { + klog.Error(err.Error()) + } else { + healthCheckInterval = val + } + } + healthyThreshold := util.DefaultServerGroupHealthyThreshold + if v, ok := ing.Annotations[annotations.HealthThreshold]; ok { + if val, err := strconv.Atoi(v); err != nil { + klog.Error(err.Error()) + } else { + healthyThreshold = val + } + } + unhealthyThreshold := util.DefaultServerGroupUnhealthyThreshold + if v, ok := ing.Annotations[annotations.UnHealthThreshold]; ok { + if val, err := strconv.Atoi(v); err != nil { + klog.Error(err.Error()) + } else { + unhealthyThreshold = val + } + } + return alb.HealthCheckConfig{ + HealthCheckConnectPort: util.DefaultServerGroupHealthCheckConnectPort, + HealthCheckEnabled: healthCheckEnabled, + HealthCheckHost: util.DefaultServerGroupHealthCheckHost, + HealthCheckHttpVersion: util.DefaultServerGroupHealthCheckHttpVersion, + HealthCheckInterval: healthCheckInterval, + HealthCheckMethod: healthcheckMethod, + HealthCheckPath: healthcheckPath, + HealthCheckProtocol: healthcheckProtocol, + HealthCheckTimeout: healthcheckTimeout, + HealthyThreshold: healthyThreshold, + UnhealthyThreshold: unhealthyThreshold, + HealthCheckTcpFastCloseEnabled: util.DefaultServerGroupHealthCheckTcpFastCloseEnabled, + HealthCheckHttpCodes: []string{ + healthcheckCode, + }, + HealthCheckCodes: []string{ + util.DefaultServerGroupHealthCheckCodes, + }, + } +} + +func buildServerGroupStickySessionConfig(ing *networking.Ingress) alb.StickySessionConfig { + return alb.StickySessionConfig{ + Cookie: "", + CookieTimeout: util.DefaultServerGroupStickySessionCookieTimeout, + StickySessionEnabled: util.DefaultServerGroupStickySessionEnabled, + StickySessionType: util.DefaultServerGroupStickySessionType, + } +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_builder.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_builder.go new file mode 100644 index 000000000..a5c9a276a --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/model_builder.go @@ -0,0 +1,316 @@ +package albconfigmanager + +import ( + "context" + "encoding/json" + "fmt" + "sort" + "strconv" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + corev1 "k8s.io/api/core/v1" + networking "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/klog" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/go-logr/logr" + "github.com/pkg/errors" +) + +type Builder interface { + Build(ctx context.Context, gateway *v1.AlbConfig, ingGroup *Group) (core.Manager, *alb.AlbLoadBalancer, error) +} + +var _ Builder = &defaultAlbConfigManagerBuilder{} + +type defaultAlbConfigManagerBuilder struct { + kubeClient client.Client + cloud prvd.Provider + logger logr.Logger +} + +func NewDefaultAlbConfigManagerBuilder(kubeClient client.Client, cloud prvd.Provider, logger logr.Logger) *defaultAlbConfigManagerBuilder { + return &defaultAlbConfigManagerBuilder{ + kubeClient: kubeClient, + cloud: cloud, + logger: logger, + } +} + +func (b defaultAlbConfigManagerBuilder) Build(ctx context.Context, albconfig *v1.AlbConfig, ingGroup *Group) (core.Manager, *alb.AlbLoadBalancer, error) { + stack := core.NewDefaultManager(core.StackID(ingGroup.ID)) + + vpcID, err := b.cloud.VpcID() + if err != nil { + return nil, nil, err + } + + task := &defaultModelBuildTask{ + stack: stack, + albconfig: albconfig, + ingGroup: ingGroup, + + clusterID: b.cloud.ClusterID(), + vpcID: vpcID, + + sgpByResID: make(map[string]*alb.ServerGroup), + backendServices: make(map[types.NamespacedName]*corev1.Service), + + annotationParser: annotations.NewSuffixAnnotationParser(annotations.DefaultAnnotationsPrefix), + certDiscovery: NewCASCertDiscovery(b.cloud, b.logger), + vSwitchResolver: NewDefaultVSwitchResolver(b.cloud, vpcID, b.logger), + + defaultServerGroupScheduler: util.DefaultServerGroupScheduler, + defaultServerGroupProtocol: util.DefaultServerGroupProtocol, + defaultServerGroupType: util.DefaultServerGroupType, + defaultListenerProtocol: util.DefaultListenerProtocol, + defaultListenerPort: util.DefaultListenerPort, + defaultListenerIdleTimeout: util.DefaultListenerIdleTimeout, + defaultListenerRequestTimeout: util.DefaultListenerRequestTimeout, + defaultListenerGzipEnabled: util.DefaultListenerGzipEnabled, + defaultListenerHttp2Enabled: util.DefaultListenerHttp2Enabled, + defaultListenerSecurityPolicyId: util.DefaultListenerSecurityPolicyId, + } + if err := task.run(ctx); err != nil { + return nil, nil, err + } + + return task.stack, task.loadBalancer, nil +} + +type defaultModelBuildTask struct { + stack core.Manager + loadBalancer *alb.AlbLoadBalancer + albconfig *v1.AlbConfig + ingGroup *Group + + clusterID string + vpcID string + + sgpByResID map[string]*alb.ServerGroup + + annotationParser annotations.Parser + certDiscovery CertDiscovery + vSwitchResolver VSwitchResolver + + backendServices map[types.NamespacedName]*corev1.Service + + defaultServerGroupScheduler string + defaultServerGroupProtocol string + defaultServerGroupType string + + defaultListenerPort int + defaultListenerProtocol string + defaultListenerIdleTimeout int + defaultListenerRequestTimeout int + defaultListenerGzipEnabled bool + defaultListenerHttp2Enabled bool + defaultListenerSecurityPolicyId string +} + +type portProtocol struct { + port int32 + protocol Protocol +} + +type FakeGateway struct { + loadBalancer alb.ALBLoadBalancerSpec + listeners map[int]alb.ListenerSpec +} + +var ( + fakeDefaultServiceName = "fake-svc" +) + +func (t *defaultModelBuildTask) buildLsDefaultAction(ctx context.Context, lsPort int) (alb.Action, error) { + svcName := fakeDefaultServiceName + ing := new(networking.Ingress) + ing.Namespace = t.albconfig.Namespace + ing.Name = t.albconfig.Name + util.DefaultListenerFlag + strconv.Itoa(lsPort) + action := buildActionViaServiceAndServicePort(ctx, svcName, lsPort, 0) + actions, err := t.buildAction(ctx, *ing, action) + if err != nil { + return alb.Action{}, err + } + + return actions, nil +} + +func removeDuplicateElement(elements []string) []string { + result := make([]string, 0, len(elements)) + temp := map[string]struct{}{} + for _, element := range elements { + if _, ok := temp[element]; !ok { + temp[element] = struct{}{} + result = append(result, element) + } + } + return result +} + +func (t *defaultModelBuildTask) run(ctx context.Context) error { + if !t.albconfig.DeletionTimestamp.IsZero() { + return nil + } + + lb, err := t.buildAlbLoadBalancer(ctx, t.albconfig) + if err != nil { + return err + } + + var lss = make(map[int32]*alb.Listener, 0) + for _, ls := range t.albconfig.Spec.Listeners { + modelLs, err := t.buildListener(ctx, lb.LoadBalancerID(), ls) + if err != nil { + return err + } + lss[int32(ls.Port.IntValue())] = modelLs + } + + ingListByPort := make(map[portProtocol][]networking.Ingress) + + for _, member := range t.ingGroup.Members { + listenPorts, err := ComputeIngressListenPorts(member) + if err != nil { + return err + } + for k, v := range listenPorts { + pp := portProtocol{ + port: k, + protocol: v, + } + ingListByPort[pp] = append(ingListByPort[pp], *member) + } + } + for pp, ingList := range ingListByPort { + ls, ok := lss[pp.port] + if !ok { + continue + } + if pp.protocol == ProtocolHTTPS { + if len(ls.Spec.Certificates) == 0 { + var certIDs []string + for _, ing := range ingList { + cert, err := t.computeIngressInferredTLSCertIDs(ctx, &ing) + if err != nil { + klog.Errorf("computeIngressInferredTLSCertARNs error: %s", err.Error()) + return err + } + certIDs = append(certIDs, cert...) + } + if len(certIDs) == 0 { + return fmt.Errorf("no cert was discovered: %v", certIDs) + } + certIDs = removeDuplicateElement(certIDs) + sort.Strings(certIDs) + cs := make([]alb.Certificate, 0) + for index, cid := range certIDs { + cert := alb.Certificate{ + IsDefault: false, + CertificateId: cid, + } + if index == 0 { + cert.IsDefault = true + } + cs = append(cs, cert) + } + lss[pp.port].Spec.ListenerProtocol = string(ProtocolHTTPS) + lss[pp.port].Spec.Certificates = cs + } + } + if err := t.buildListenerRules(ctx, ls.ListenerID(), pp.port, ingList); err != nil { + return err + } + } + + for _, ls := range lss { + if ls.Spec.ListenerProtocol == string(ProtocolHTTPS) { + var isDefaultCertExist bool + for _, c := range ls.Spec.Certificates { + if c.IsDefault { + isDefaultCertExist = true + break + } + } + if !isDefaultCertExist { + return fmt.Errorf("https listener: %d must provider one default cert", ls.Spec.ListenerPort) + } + } + } + + return nil +} + +func (t *defaultModelBuildTask) computeIngressInferredTLSCertIDs(ctx context.Context, ing *networking.Ingress) ([]string, error) { + hosts := sets.NewString() + for _, r := range ing.Spec.Rules { + if len(r.Host) != 0 { + hosts.Insert(r.Host) + } + } + for _, t := range ing.Spec.TLS { + hosts.Insert(t.Hosts...) + } + return t.certDiscovery.Discover(ctx, hosts.List()) +} + +func ComputeIngressListenPorts(ing *networking.Ingress) (map[int32]Protocol, error) { + rawListenPorts := "" + portAndProtocols := make(map[int32]Protocol, 0) + // http transfer to https + if v := annotations.GetStringAnnotationMutil(annotations.NginxSslRedirect, annotations.AlbSslRedirect, ing); v == "true" { + portAndProtocols[80] = ProtocolHTTP + } + rawListenPorts, err := annotations.GetStringAnnotation(annotations.ListenPorts, ing) + if err != nil { + for _, tls := range ing.Spec.TLS { + for _, host := range tls.Hosts { + if host != "" { + portAndProtocols[443] = ProtocolHTTPS + return portAndProtocols, nil + } + } + } + return map[int32]Protocol{80: ProtocolHTTP}, nil + } + + var entries []map[string]int32 + if err := json.Unmarshal([]byte(rawListenPorts), &entries); err != nil { + return nil, errors.Wrapf(err, "failed to parse listen-ports configuration: `%s`", rawListenPorts) + } + if len(entries) == 0 { + return nil, errors.Errorf("empty listen-ports configuration: `%s`", rawListenPorts) + } + + for _, entry := range entries { + for protocol, port := range entry { + if port < 1 || port > 65535 { + return nil, errors.Errorf("listen port must be within [1, 65535]: %v", port) + } + switch protocol { + case string(ProtocolHTTP): + portAndProtocols[port] = util.ListenerProtocolHTTP + case string(ProtocolHTTPS): + portAndProtocols[port] = util.ListenerProtocolHTTPS + default: + return nil, errors.Errorf("listen protocol must be within [%v, %v]: %v", ProtocolHTTP, ProtocolHTTPS, protocol) + } + } + } + return portAndProtocols, nil +} + +type Protocol string + +const ( + ProtocolHTTP Protocol = util.ListenerProtocolHTTP + ProtocolHTTPS Protocol = util.ListenerProtocolHTTPS +) diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/schema_builder.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/schema_builder.go new file mode 100644 index 000000000..436d4069e --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/schema_builder.go @@ -0,0 +1,38 @@ +package albconfigmanager + +import "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + +type StackSchema struct { + ID string `json:"id"` + + Resources map[string]map[string]interface{} `json:"resources"` +} + +func NewStackSchemaBuilder(stackID core.StackID) *stackSchemaBuilder { + return &stackSchemaBuilder{ + stackID: stackID, + resources: make(map[string]map[string]interface{}), + } +} + +var _ core.ResourceVisitor = &stackSchemaBuilder{} + +type stackSchemaBuilder struct { + stackID core.StackID + resources map[string]map[string]interface{} +} + +func (b *stackSchemaBuilder) Visit(res core.Resource) error { + if _, ok := b.resources[res.Type()]; !ok { + b.resources[res.Type()] = make(map[string]interface{}) + } + b.resources[res.Type()][res.ID()] = res + return nil +} + +func (b *stackSchemaBuilder) Build() StackSchema { + return StackSchema{ + ID: b.stackID.String(), + Resources: b.resources, + } +} diff --git a/pkg/controller/ingress/reconcile/builder/albconfig_manager/vswitch_discovery.go b/pkg/controller/ingress/reconcile/builder/albconfig_manager/vswitch_discovery.go new file mode 100644 index 000000000..da2a87306 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/albconfig_manager/vswitch_discovery.go @@ -0,0 +1,169 @@ +package albconfigmanager + +import ( + "context" + "errors" + "fmt" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" + "github.com/go-logr/logr" +) + +type VSwitchResolver interface { + ResolveViaDiscovery(ctx context.Context) ([]vpc.VSwitch, error) + + ResolveViaIDSlice(ctx context.Context, vSwitchIDs []string) ([]vpc.VSwitch, error) +} + +func NewDefaultVSwitchResolver(cloud prvd.Provider, vpcID string, logger logr.Logger) *defaultVSwitchesResolver { + return &defaultVSwitchesResolver{ + cloud: cloud, + vpcID: vpcID, + logger: logger, + } +} + +var _ VSwitchResolver = &defaultVSwitchesResolver{} + +type defaultVSwitchesResolver struct { + cloud prvd.Provider + logger logr.Logger + + vpcID string +} + +const ( + DescribeALBZones = "DescribeALBZones" + DescribeVSwitches = "DescribeVSwitches" +) + +const ( + albLeastZoneCount = 2 + vSwitchLeastIPCount = 5 +) + +func (v *defaultVSwitchesResolver) discoveryALBZones(ctx context.Context) ([]albsdk.Zone, error) { + traceID := ctx.Value(util.TraceID) + + req := albsdk.CreateDescribeZonesRequest() + + startTime := time.Now() + v.logger.Info("describing alb zones", + "traceID", traceID, + "startTime", startTime, + "action", DescribeALBZones) + resp, err := v.cloud.DescribeALBZones(req) + if err != nil { + return nil, err + } + v.logger.Info("described alb zones", + "traceID", traceID, + "zones", resp.Zones, + "elapsedTime", time.Since(startTime).Milliseconds(), + "requestID", resp.RequestId, + "action", DescribeALBZones) + + return resp.Zones, nil +} + +func (v *defaultVSwitchesResolver) ResolveViaDiscovery(ctx context.Context) ([]vpc.VSwitch, error) { + traceID := ctx.Value(util.TraceID) + + albZones, err := v.discoveryALBZones(ctx) + if err != nil { + return nil, err + } + if len(albZones) < albLeastZoneCount { + return nil, errors.New("unable to discover at least two albZones for alb") + } + + startTime := time.Now() + v.logger.Info("describing vSwitches", + "traceID", traceID, + "vpcID", v.vpcID, + "startTime", startTime, + "action", DescribeVSwitches) + allVSwitches, err := v.cloud.DescribeVSwitches(ctx, v.vpcID) + if err != nil { + return nil, err + } + v.logger.Info("described vSwitches", + "traceID", traceID, + "vpcID", v.vpcID, + "vSwitches", allVSwitches, + "elapsedTime", time.Since(startTime).Milliseconds(), + "action", DescribeVSwitches) + + vSwitchesByZone := mapSDKVSwitchesByZone(allVSwitches) + + chosenVSwitches := make([]vpc.VSwitch, 0) + + for _, albZone := range albZones { + if vSwitches, ok := vSwitchesByZone[albZone.ZoneId]; ok { + for _, vSwitch := range vSwitches { + // todo how to choose vSwitch + chosenVSwitches = append(chosenVSwitches, vSwitch) + break + } + } + } + + if len(chosenVSwitches) < albLeastZoneCount { + return nil, fmt.Errorf("unable to discover at least two vSwitches from alb zones: %v", albZones) + } + + return chosenVSwitches[:albLeastZoneCount], nil +} + +func mapSDKVSwitchesByZone(vSwitches []vpc.VSwitch) map[string][]vpc.VSwitch { + vSwitchesByZone := make(map[string][]vpc.VSwitch) + for _, vSwitch := range vSwitches { + vSwitchesByZone[vSwitch.ZoneId] = append(vSwitchesByZone[vSwitch.ZoneId], vSwitch) + } + return vSwitchesByZone +} + +func (v *defaultVSwitchesResolver) ResolveViaIDSlice(ctx context.Context, vSwitchIDs []string) ([]vpc.VSwitch, error) { + traceID := ctx.Value(util.TraceID) + + startTime := time.Now() + v.logger.Info("describing vSwitches", + "traceID", traceID, + "vpcID", v.vpcID, + "vSwitchIDs", vSwitchIDs, + "startTime", startTime, + "action", DescribeVSwitches) + allVSwitches, err := v.cloud.DescribeVSwitches(ctx, v.vpcID) + if err != nil { + return nil, err + } + v.logger.Info("described vSwitches", + "traceID", traceID, + "vpcID", v.vpcID, + "vSwitches", allVSwitches, + "elapsedTime", time.Since(startTime).Milliseconds(), + "action", DescribeVSwitches) + + chosenVSwitches := make([]vpc.VSwitch, 0) + for _, vSwitchID := range vSwitchIDs { + for _, vSwitch := range allVSwitches { + if vSwitch.VSwitchId == vSwitchID { + chosenVSwitches = append(chosenVSwitches, vSwitch) + break + } + + } + } + + if len(chosenVSwitches) < albLeastZoneCount { + return nil, fmt.Errorf("unable to discover at least two vSwitches: %v", vSwitchIDs) + } + + return chosenVSwitches[:albLeastZoneCount], nil +} diff --git a/pkg/controller/ingress/reconcile/builder/service_manager/model_builder_service.go b/pkg/controller/ingress/reconcile/builder/service_manager/model_builder_service.go new file mode 100644 index 000000000..e39f50169 --- /dev/null +++ b/pkg/controller/ingress/reconcile/builder/service_manager/model_builder_service.go @@ -0,0 +1,60 @@ +package servicemanager + +import ( + "context" + "fmt" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/backend" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" +) + +type Builder interface { + Build(ctx context.Context, svcStackCtx *alb.ServiceStackContext) (*alb.ServiceManager, error) +} + +var _ Builder = &defaultServiceManagerBuilder{} + +type defaultServiceManagerBuilder struct { + backendMgr *backend.Manager +} + +func NewDefaultServiceStackBuilder(backendMgr *backend.Manager) *defaultServiceManagerBuilder { + return &defaultServiceManagerBuilder{ + backendMgr: backendMgr, + } +} + +func (b defaultServiceManagerBuilder) Build(ctx context.Context, svcStackCtx *alb.ServiceStackContext) (*alb.ServiceManager, error) { + serverStack := new(alb.ServiceManager) + serverStack.ClusterID = svcStackCtx.ClusterID + serverStack.Namespace = svcStackCtx.ServiceNamespace + serverStack.Name = svcStackCtx.ServiceName + port2ServerGroup := make(map[int32]*alb.ServerGroupWithIngress) + port2Backends := make(map[int32][]alb.BackendItem) + containsPotentialReadyEndpoints := false + if !svcStackCtx.IsServiceNotFound { + policy, err := helper.GetServiceTrafficPolicy(svcStackCtx.Service) + if err != nil { + return nil, err + } + serverStack.TrafficPolicy = string(policy) + port2Backends, containsPotentialReadyEndpoints, err = b.backendMgr.BuildServicePortsToSDKBackends(ctx, svcStackCtx.Service) + if err != nil { + return nil, fmt.Errorf("build servicePortToServerGroup error: %v", err) + } + serverStack.ContainsPotentialReadyEndpoints = containsPotentialReadyEndpoints + } + for port, ingressNames := range svcStackCtx.ServicePortToIngressNames { + port2ServerGroup[port] = new(alb.ServerGroupWithIngress) + port2ServerGroup[port].IngressNames = ingressNames + + if backends, ok := port2Backends[port]; ok { + port2ServerGroup[port].Backends = backends + } + } + serverStack.PortToServerGroup = port2ServerGroup + + return serverStack, nil +} diff --git a/pkg/controller/ingress/reconcile/store/common.go b/pkg/controller/ingress/reconcile/store/common.go new file mode 100644 index 000000000..b0773fe13 --- /dev/null +++ b/pkg/controller/ingress/reconcile/store/common.go @@ -0,0 +1,463 @@ +package store + +import ( + "context" + "fmt" + "os" + "strings" + "sync" + + apiv1 "k8s.io/api/core/v1" + networking "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/version" + clientset "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + "k8s.io/klog/v2" +) + +const ( + // IngressKey picks a specific "class" for the Ingress. + // The controller only processes Ingresses with this annotation either + // unset, or set to either the configured value or the empty string. + IngressKey = "kubernetes.io/ingress.class" +) + +var ( + // DefaultClass defines the default class used in the alb ingress controller + DefaultClass = "alb" + + // IngressClass sets the runtime ingress class to use + // An empty string means accept all ingresses without + // annotation and the ones configured with class alb + IngressClassName = "alb" +) + +// Ingress holds the definition of an Ingress plus its annotations +type Ingress struct { + networking.Ingress `json:"-"` +} + +// IsValid returns true if the given Ingress specify the ingress.class +// annotation or IngressClassName resource for Kubernetes >= v1.18 +func IsValid(ing *networking.Ingress) bool { + // 1. with annotation or IngressClass + ingress, ok := ing.GetAnnotations()[IngressKey] + if !ok && ing.Spec.IngressClassName != nil { + ingress = *ing.Spec.IngressClassName + } + + // k8s > v1.18. + // Processing may be redundant because k8s.IngressClass is obtained by IngressClass + // 2. without annotation and IngressClass. Check IngressClass + if IngressClass != nil { + return ingress == IngressClass.Name + } + + // 3. with IngressClass + return ingress == IngressClassName +} + +// ConfigMapLister makes a Store that lists Configmaps. +type ConfigMapLister struct { + cache.Store +} + +// ByKey returns the ConfigMap matching key in the local ConfigMap Store. +func (cml *ConfigMapLister) ByKey(key string) (*apiv1.ConfigMap, error) { + s, exists, err := cml.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return s.(*apiv1.ConfigMap), nil +} + +// EndpointLister makes a Store that lists Endpoints. +type EndpointLister struct { + cache.Store +} + +// ByKey returns the Endpoints of the Service matching key in the local Endpoint Store. +func (s *EndpointLister) ByKey(key string) (*apiv1.Endpoints, error) { + eps, exists, err := s.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return eps.(*apiv1.Endpoints), nil +} + +// IngressLister makes a Store that lists Ingress. +type IngressLister struct { + cache.Store +} + +// ByKey returns the Ingress matching key in the local Ingress Store. +func (il IngressLister) ByKey(key string) (*networking.Ingress, error) { + i, exists, err := il.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return i.(*networking.Ingress), nil +} + +// FilterIngresses returns the list of Ingresses +func FilterIngresses(ingresses []*Ingress, filterFunc IngressFilterFunc) []*Ingress { + afterFilter := make([]*Ingress, 0) + for _, ingress := range ingresses { + if !filterFunc(ingress) { + afterFilter = append(afterFilter, ingress) + } + } + + sortIngressSlice(afterFilter) + return afterFilter +} + +// NodeLister makes a Store that lists Nodes. +type NodeLister struct { + cache.Store +} + +// ByKey returns the Node matching key in the local Node Store. +func (sl *NodeLister) ByKey(key string) (*apiv1.Node, error) { + s, exists, err := sl.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return s.(*apiv1.Node), nil +} + +// IngressWithAnnotationsLister makes a Store that lists Ingress rules with annotations already parsed +type IngressWithAnnotationsLister struct { + cache.Store +} + +// ByKey returns the Ingress with annotations matching key in the local store or an error +func (il IngressWithAnnotationsLister) ByKey(key string) (*Ingress, error) { + i, exists, err := il.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return i.(*Ingress), nil +} + +// ParseNameNS parses a string searching a namespace and name +func ParseNameNS(input string) (string, string, error) { + nsName := strings.Split(input, "/") + if len(nsName) != 2 { + return "", "", fmt.Errorf("invalid format (namespace/name) found in '%v'", input) + } + + return nsName[0], nsName[1], nil +} + +// GetNodeIPOrName returns the IP address or the name of a node in the cluster +func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP bool) string { + node, err := kubeClient.CoreV1().Nodes().Get(context.TODO(), name, metav1.GetOptions{}) + if err != nil { + klog.ErrorS(err, "Error getting node", "name", name) + return "" + } + + defaultOrInternalIP := "" + for _, address := range node.Status.Addresses { + if address.Type == apiv1.NodeInternalIP { + if address.Address != "" { + defaultOrInternalIP = address.Address + break + } + } + } + + if useInternalIP { + return defaultOrInternalIP + } + + for _, address := range node.Status.Addresses { + if address.Type == apiv1.NodeExternalIP { + if address.Address != "" { + return address.Address + } + } + } + + return defaultOrInternalIP +} + +var ( + // IngressPodDetails hold information about the ingress-nginx pod + IngressPodDetails *PodInfo +) + +// PodInfo contains runtime information about the pod running the Ingres controller +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type PodInfo struct { + metav1.TypeMeta + metav1.ObjectMeta +} + +// GetIngressPod load the ingress-nginx pod +func GetIngressPod(kubeClient clientset.Interface) error { + podName := os.Getenv("POD_NAME") + podNs := os.Getenv("POD_NAMESPACE") + + if podName == "" || podNs == "" { + return fmt.Errorf("unable to get POD information (missing POD_NAME or POD_NAMESPACE environment variable") + } + + pod, err := kubeClient.CoreV1().Pods(podNs).Get(context.TODO(), podName, metav1.GetOptions{}) + if err != nil { + return fmt.Errorf("unable to get POD information: %v", err) + } + + IngressPodDetails = &PodInfo{ + TypeMeta: metav1.TypeMeta{APIVersion: "v1", Kind: "Pod"}, + } + + pod.ObjectMeta.DeepCopyInto(&IngressPodDetails.ObjectMeta) + IngressPodDetails.SetLabels(pod.GetLabels()) + + return nil +} + +// MetaNamespaceKey knows how to make keys for API objects which implement meta.Interface. +func MetaNamespaceKey(obj interface{}) string { + key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + klog.Warning(err) + } + + return key +} + +// IsIngressV1Beta1Ready indicates if the running Kubernetes version is at least v1.18.0 +var IsIngressV1Beta1Ready bool + +// IsIngressV1Ready indicates if the running Kubernetes version is at least v1.19.0 +var IsIngressV1Ready bool + +// IngressClass indicates the class of the Ingress to use as filter +var IngressClass *networking.IngressClass + +// IngressNGINXController defines the valid value of IngressClass +// Controller field for ingress-nginx +const IngressNGINXController = "k8s.io/ingress-nginx" + +// NetworkingIngressAvailable checks if the package "k8s.io/api/networking/v1beta1" +// is available or not and if Ingress V1 is supported (k8s >= v1.18.0) +func NetworkingIngressAvailable(client clientset.Interface) (bool, bool, bool) { + // check kubernetes version to use new ingress package or not + version114, _ := version.ParseGeneric("v1.14.0") + version118, _ := version.ParseGeneric("v1.18.0") + version119, _ := version.ParseGeneric("v1.19.0") + + serverVersion, err := client.Discovery().ServerVersion() + if err != nil { + return false, false, false + } + + runningVersion, err := version.ParseGeneric(serverVersion.String()) + if err != nil { + klog.ErrorS(err, "unexpected error parsing running Kubernetes version") + return false, false, false + } + + return runningVersion.AtLeast(version114), runningVersion.AtLeast(version118), runningVersion.AtLeast(version119) +} + +// default path type is Prefix to not break existing definitions +var defaultPathType = networking.PathTypePrefix + +// SetDefaultNGINXPathType sets a default PathType when is not defined. +func SetDefaultALBPathType(ing *networking.Ingress) { + for _, rule := range ing.Spec.Rules { + if rule.IngressRuleValue.HTTP == nil { + continue + } + + for idx := range rule.IngressRuleValue.HTTP.Paths { + p := &rule.IngressRuleValue.HTTP.Paths[idx] + if p.PathType == nil { + p.PathType = &defaultPathType + } + + if *p.PathType == networking.PathTypeImplementationSpecific { + p.PathType = &defaultPathType + } + } + } +} + +// ObjectRefMap is a map of references from object(s) to object (1:n). It is +// used to keep track of which data objects (Secrets) are used within Ingress +// objects. +type ObjectRefMap interface { + Insert(consumer string, ref ...string) + Delete(consumer string) + Len() int + Has(ref string) bool + HasConsumer(consumer string) bool + Reference(ref string) []string + ReferencedBy(consumer string) []string +} + +type objectRefMap struct { + sync.Mutex + v map[string]sets.String +} + +// NewObjectRefMap returns a new ObjectRefMap. +func NewObjectRefMap() ObjectRefMap { + return &objectRefMap{ + v: make(map[string]sets.String), + } +} + +// Insert adds a consumer to one or more referenced objects. +func (o *objectRefMap) Insert(consumer string, ref ...string) { + o.Lock() + defer o.Unlock() + + for _, r := range ref { + if _, ok := o.v[r]; !ok { + o.v[r] = sets.NewString(consumer) + continue + } + o.v[r].Insert(consumer) + } +} + +// Delete deletes a consumer from all referenced objects. +func (o *objectRefMap) Delete(consumer string) { + o.Lock() + defer o.Unlock() + + for ref, consumers := range o.v { + consumers.Delete(consumer) + if consumers.Len() == 0 { + delete(o.v, ref) + } + } +} + +// Len returns the count of referenced objects. +func (o *objectRefMap) Len() int { + return len(o.v) +} + +// Has returns whether the given object is referenced by any other object. +func (o *objectRefMap) Has(ref string) bool { + o.Lock() + defer o.Unlock() + + if _, ok := o.v[ref]; ok { + return true + } + return false +} + +// HasConsumer returns whether the store contains the given consumer. +func (o *objectRefMap) HasConsumer(consumer string) bool { + o.Lock() + defer o.Unlock() + + for _, consumers := range o.v { + if consumers.Has(consumer) { + return true + } + } + return false +} + +// Reference returns all objects referencing the given object. +func (o *objectRefMap) Reference(ref string) []string { + o.Lock() + defer o.Unlock() + + consumers, ok := o.v[ref] + if !ok { + return make([]string, 0) + } + return consumers.List() +} + +// ReferencedBy returns all objects referenced by the given object. +func (o *objectRefMap) ReferencedBy(consumer string) []string { + o.Lock() + defer o.Unlock() + + refs := make([]string, 0) + for ref, consumers := range o.v { + if consumers.Has(consumer) { + refs = append(refs, ref) + } + } + return refs +} + +// PodLister makes a Store that lists Pods. +type PodLister struct { + cache.Store +} + +// ByKey returns the Endpoints of the Service matching key in the local Endpoint Store. +func (s *PodLister) ByKey(key string) (*apiv1.Pod, error) { + pod, exists, err := s.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return pod.(*apiv1.Pod), nil +} + +// SecretLister makes a Store that lists Secrets. +type SecretLister struct { + cache.Store +} + +// ByKey returns the Secret matching key in the local Secret Store. +func (sl *SecretLister) ByKey(key string) (*apiv1.Secret, error) { + s, exists, err := sl.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return s.(*apiv1.Secret), nil +} + +// ServiceLister makes a Store that lists Services. +type ServiceLister struct { + cache.Store +} + +// ByKey returns the Service matching key in the local Service Store. +func (sl *ServiceLister) ByKey(key string) (*apiv1.Service, error) { + s, exists, err := sl.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, NotExistsError(key) + } + return s.(*apiv1.Service), nil +} diff --git a/pkg/controller/ingress/reconcile/store/store.go b/pkg/controller/ingress/reconcile/store/store.go new file mode 100644 index 000000000..6516d3250 --- /dev/null +++ b/pkg/controller/ingress/reconcile/store/store.go @@ -0,0 +1,625 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package store + +import ( + "fmt" + "reflect" + "sort" + "sync" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/utils/pointer" + + "github.com/eapache/channels" + + corev1 "k8s.io/api/core/v1" + networking "k8s.io/api/networking/v1" + k8sruntime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/informers" + clientset "k8s.io/client-go/kubernetes" + "k8s.io/client-go/kubernetes/scheme" + clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/tools/record" + "k8s.io/klog/v2" +) + +// IngressFilterFunc decides if an Ingress should be omitted or not +type IngressFilterFunc func(*Ingress) bool + +// Storer is the interface that wraps the required methods to gather information +// about ingresses, services, secrets and ingress annotations. +type Storer interface { + + // GetService returns the Service matching key. + GetService(key string) (*corev1.Service, error) + + // GetServiceEndpoints returns the Endpoints of a Service matching key. + GetServiceEndpoints(key string) (*corev1.Endpoints, error) + + GetPod(key string) (*corev1.Pod, error) + + // ListIngresses returns a list of all Ingresses in the store. + ListIngresses() []*Ingress + + // Run initiates the synchronization of the controllers + Run(stopCh chan struct{}) +} + +// Informer defines the required SharedIndexInformers that interact with the API server. +type Informer struct { + Ingress cache.SharedIndexInformer + Endpoint cache.SharedIndexInformer + Service cache.SharedIndexInformer + Node cache.SharedIndexInformer + Pod cache.SharedIndexInformer +} + +// Lister contains object listers (stores). +type Lister struct { + Ingress IngressLister + Service ServiceLister + Endpoint EndpointLister + Pod PodLister + Node NodeLister + IngressWithAnnotation IngressWithAnnotationsLister +} + +// NotExistsError is returned when an object does not exist in a local store. +type NotExistsError string + +// Error implements the error interface. +func (e NotExistsError) Error() string { + return fmt.Sprintf("no object matching key %q in local store", string(e)) +} + +// Run initiates the synchronization of the informers against the API server. +func (i *Informer) Run(stopCh chan struct{}) { + go i.Pod.Run(stopCh) + go i.Endpoint.Run(stopCh) + go i.Service.Run(stopCh) + go i.Node.Run(stopCh) + // wait for all involved caches to be synced before processing items + // from the queue + if !cache.WaitForCacheSync(stopCh, + i.Pod.HasSynced, + i.Endpoint.HasSynced, + i.Service.HasSynced, + i.Node.HasSynced, + ) { + runtime.HandleError(fmt.Errorf("timed out waiting for caches to sync")) + } + + // in big clusters, deltas can keep arriving even after HasSynced + // functions have returned 'true' + time.Sleep(1 * time.Second) + + // we can start syncing ingress objects only after other caches are + // ready, because ingress rules require content from other listers, and + // 'add' events get triggered in the handlers during caches population. + go i.Ingress.Run(stopCh) + if !cache.WaitForCacheSync(stopCh, + i.Ingress.HasSynced, + ) { + runtime.HandleError(fmt.Errorf("timed out waiting for caches to sync")) + } +} + +// k8sStore internal Storer implementation using informers and thread safe stores +type k8sStore struct { + + // informer contains the cache Informers + informers *Informer + + // listers contains the cache.Store interfaces used in the ingress controller + listers *Lister + + // secretIngressMap contains information about which ingress references a + // secret in the annotations. + secretIngressMap ObjectRefMap + + // updateCh + updateCh *channels.RingChannel + + // syncSecretMu protects against simultaneous invocations of syncSecret + syncSecretMu *sync.Mutex + + // backendConfigMu protects against simultaneous read/write of backendConfig + backendConfigMu *sync.RWMutex +} + +// New creates a new object store to be used in the ingress controller +func New( + namespace string, + resyncPeriod time.Duration, + client clientset.Interface, + updateCh *channels.RingChannel, + disableCatchAll bool) Storer { + + store := &k8sStore{ + informers: &Informer{}, + listers: &Lister{}, + updateCh: updateCh, + syncSecretMu: &sync.Mutex{}, + backendConfigMu: &sync.RWMutex{}, + secretIngressMap: NewObjectRefMap(), + } + + eventBroadcaster := record.NewBroadcaster() + eventBroadcaster.StartLogging(klog.Infof) + eventBroadcaster.StartRecordingToSink(&clientcorev1.EventSinkImpl{ + Interface: client.CoreV1().Events(namespace), + }) + recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{ + Component: "alb-ingress-controller", + }) + + store.listers.IngressWithAnnotation.Store = cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc) + // create informers factory, enable and assign required informers + infFactory := informers.NewSharedInformerFactoryWithOptions(client, resyncPeriod, + informers.WithNamespace(namespace), + ) + + store.informers.Ingress = infFactory.Networking().V1().Ingresses().Informer() + store.listers.Ingress.Store = store.informers.Ingress.GetStore() + + store.informers.Endpoint = infFactory.Core().V1().Endpoints().Informer() + store.listers.Endpoint.Store = store.informers.Endpoint.GetStore() + + store.informers.Service = infFactory.Core().V1().Services().Informer() + store.listers.Service.Store = store.informers.Service.GetStore() + + store.informers.Node = infFactory.Core().V1().Nodes().Informer() + store.listers.Node.Store = store.informers.Node.GetStore() + + store.informers.Pod = infFactory.Core().V1().Pods().Informer() + store.listers.Pod.Store = store.informers.Pod.GetStore() + + ingDeleteHandler := func(obj interface{}) { + ing, ok := toIngress(obj) + if !ok { + // If we reached here it means the ingress was deleted but its final state is unrecorded. + tombstone, ok := obj.(cache.DeletedFinalStateUnknown) + if !ok { + klog.ErrorS(nil, "Error obtaining object from tombstone", "key", obj) + return + } + ing, ok = tombstone.Obj.(*networking.Ingress) + if !ok { + klog.Errorf("Tombstone contained object that is not an Ingress: %#v", obj) + return + } + } + + if !IsValid(ing) { + return + } + + if isCatchAllIngress(ing.Spec) && disableCatchAll { + klog.InfoS("Ignoring delete for catch-all because of --disable-catch-all", "ingress", klog.KObj(ing)) + return + } + + //store.listers.IngressWithAnnotation.Delete(ing) + + key := MetaNamespaceKey(ing) + store.secretIngressMap.Delete(key) + + updateCh.In() <- helper.Event{ + Type: helper.IngressDeleteEvent, + Obj: obj, + } + } + + ingEventHandler := cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + ing, ok := toIngress(obj) + if !ok { + return + } + if !IsValid(ing) { + ingressClass, _ := annotations.GetStringAnnotation(IngressKey, ing) + klog.InfoS("Ignoring ingress", "ingress", klog.KObj(ing), "kubernetes.io/ingress.class", ingressClass, "ingressClassName", pointer.StringPtrDerefOr(ing.Spec.IngressClassName, "")) + return + } + + if isCatchAllIngress(ing.Spec) && disableCatchAll { + klog.InfoS("Ignoring add for catch-all ingress because of --disable-catch-all", "ingress", klog.KObj(ing)) + return + } + + recorder.Eventf(ing, corev1.EventTypeNormal, "Sync", "Scheduled for sync") + + store.syncIngress(ing) + + updateCh.In() <- helper.Event{ + Type: helper.CreateEvent, + Obj: obj, + } + }, + DeleteFunc: ingDeleteHandler, + UpdateFunc: func(old, cur interface{}) { + oldIng, ok := toIngress(old) + if !ok { + return + } + curIng, ok := toIngress(cur) + if !ok { + return + } + validOld := IsValid(oldIng) + validCur := IsValid(curIng) + if !validOld && validCur { + if isCatchAllIngress(curIng.Spec) && disableCatchAll { + klog.InfoS("ignoring update for catch-all ingress because of --disable-catch-all", "ingress", klog.KObj(curIng)) + return + } + + klog.InfoS("creating ingress", "ingress", klog.KObj(curIng), "class", IngressKey) + recorder.Eventf(curIng, corev1.EventTypeNormal, "Sync", "Scheduled for sync") + } else if validOld && !validCur { + klog.InfoS("removing ingress", "ingress", klog.KObj(curIng), "class", IngressKey) + ingDeleteHandler(old) + return + } else if validCur && !reflect.DeepEqual(old, cur) { + if isCatchAllIngress(curIng.Spec) && disableCatchAll { + klog.InfoS("ignoring update for catch-all ingress and delete old one because of --disable-catch-all", "ingress", klog.KObj(curIng)) + ingDeleteHandler(old) + return + } + + recorder.Eventf(curIng, corev1.EventTypeNormal, "Sync", "Scheduled for sync") + } else { + klog.V(3).InfoS("No changes on ingress. Skipping update", "ingress", klog.KObj(curIng)) + return + } + + store.syncIngress(curIng) + + updateCh.In() <- helper.Event{ + Type: helper.UpdateEvent, + Obj: cur, + } + }, + } + + epEventHandler := cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + ep1 := obj.(*corev1.Endpoints) + key := MetaNamespaceKey(ep1) + svc, exist, err := store.listers.Service.GetByKey(key) + if err != nil { + klog.Error(err, "get service GetByKey by endpoint failed", "endpoint", ep1) + return + } + if !exist { + klog.Warningf("epEventHandler %s", key) + return + } + s := svc.(*corev1.Service) + + klog.Info("controller: endpoint add event", + util.NamespacedName(ep1).String()) + updateCh.In() <- helper.Event{ + Type: helper.EndPointEvent, + Obj: s, + } + }, + DeleteFunc: func(obj interface{}) { + ep1 := obj.(*corev1.Endpoints) + key := MetaNamespaceKey(ep1) + svc, exist, err := store.listers.Service.GetByKey(key) + if err != nil { + klog.Error(err, "DeleteFunc get service GetByKey by endpoint failed", "endpoint", ep1) + return + } + if !exist { + klog.Warningf("DeleteFunc epEventHandler %s", key) + return + } + + s := svc.(*corev1.Service) + + klog.Info("controller: endpoint delete event", + util.NamespacedName(ep1).String()) + updateCh.In() <- helper.Event{ + Type: helper.EndPointEvent, + Obj: s, + } + }, + UpdateFunc: func(old, cur interface{}) { + ep1 := old.(*corev1.Endpoints) + ep2 := cur.(*corev1.Endpoints) + if !reflect.DeepEqual(ep1.Subsets, ep2.Subsets) { + key := MetaNamespaceKey(ep1) + svc, exist, err := store.listers.Service.GetByKey(key) + if err != nil { + klog.Error(err, "UpdateFunc get service GetByKey by endpoint failed", "endpoint", ep1) + return + } + if !exist { + klog.Warningf("UpdateFunc epEventHandler %s", key) + return + } + s := svc.(*corev1.Service) + + klog.Info("controller: endpoint update event", + util.NamespacedName(ep1).String()) + updateCh.In() <- helper.Event{ + Type: helper.EndPointEvent, + Obj: s, + } + } + }, + } + podEventHandler := cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + err := store.listers.Pod.Add(obj) + if err != nil { + klog.Error(err, "Pod Add failed") + return + } + }, + DeleteFunc: func(obj interface{}) { + store.listers.Pod.Delete(obj) + }, + UpdateFunc: func(old, cur interface{}) { + }, + } + nodeEventHandler := cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + serviceList := store.listers.Service.List() + for _, v := range serviceList { + svc := v.(*corev1.Service) + klog.Info("node change: enqueue service", util.Key(svc)) + updateCh.In() <- helper.Event{ + Type: helper.NodeEvent, + Obj: svc, + } + } + }, + UpdateFunc: func(old, cur interface{}) { + nodeOld := old.(*corev1.Node) + nodeNew := cur.(*corev1.Node) + + if !reflect.DeepEqual(nodeOld.Labels, nodeNew.Labels) { + serviceList := store.listers.Service.List() + for _, v := range serviceList { + svc := v.(*corev1.Service) + klog.Info("node change: enqueue service", util.Key(svc)) + updateCh.In() <- helper.Event{ + Type: helper.NodeEvent, + Obj: svc, + } + } + } + }, + + DeleteFunc: func(obj interface{}) { + serviceList := store.listers.Service.List() + for _, v := range serviceList { + svc := v.(*corev1.Service) + klog.Info("node change: enqueue service", util.Key(svc)) + updateCh.In() <- helper.Event{ + Type: helper.NodeEvent, + Obj: svc, + } + } + + }, + } + + serviceHandler := cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + curSvc := obj.(*corev1.Service) + store.enqueueImpactedIngresses(updateCh, curSvc) + }, + UpdateFunc: func(old, cur interface{}) { + // update the server group + oldSvc := old.(*corev1.Service) + curSvc := cur.(*corev1.Service) + + if reflect.DeepEqual(oldSvc, curSvc) { + return + } + + updateCh.In() <- helper.Event{ + Type: helper.ServiceEvent, + Obj: cur, + } + }, + DeleteFunc: func(obj interface{}) { + // ingress refer service to delete + curSvc := obj.(*corev1.Service) + store.enqueueImpactedIngresses(updateCh, curSvc) + }, + } + + store.informers.Ingress.AddEventHandler(ingEventHandler) + store.informers.Endpoint.AddEventHandler(epEventHandler) + store.informers.Node.AddEventHandler(podEventHandler) + store.informers.Service.AddEventHandler(serviceHandler) + store.informers.Node.AddEventHandler(nodeEventHandler) + return store +} + +func (s *k8sStore) enqueueImpactedIngresses(updateCh *channels.RingChannel, svc *corev1.Service) { + ingList := s.listers.Ingress.List() + + for _, t := range ingList { + ing := t.(*networking.Ingress) + + if !IsIngressAlbClass(*ing) { + continue + } + + updateCh.In() <- helper.Event{ + Type: helper.IngressEvent, + Obj: ing, + } + } +} + +func IsIngressAlbClass(ing networking.Ingress) bool { + if ingClassAnnotation, exists := ing.Annotations[util.IngressClass]; exists { + if ingClassAnnotation == IngressClassName { + return true + } + } + return false +} + +// isCatchAllIngress returns whether or not an ingress produces a +// catch-all server, and so should be ignored when --disable-catch-all is set +func isCatchAllIngress(spec networking.IngressSpec) bool { + return spec.DefaultBackend != nil && len(spec.Rules) == 0 +} + +// syncIngress parses ingress annotations converting the value of the +// annotation to a go struct +func (s *k8sStore) syncIngress(ing *networking.Ingress) { + key := MetaNamespaceKey(ing) + klog.V(3).Infof("updating annotations information for ingress %v", key) + if !IsValid(ing) { + return + } + copyIng := &networking.Ingress{} + ing.ObjectMeta.DeepCopyInto(©Ing.ObjectMeta) + ing.Spec.DeepCopyInto(©Ing.Spec) + ing.Status.DeepCopyInto(©Ing.Status) + + for ri, rule := range copyIng.Spec.Rules { + if rule.HTTP == nil { + continue + } + + for pi, path := range rule.HTTP.Paths { + if path.Path == "" { + copyIng.Spec.Rules[ri].HTTP.Paths[pi].Path = "/" + } + } + } + + SetDefaultALBPathType(copyIng) + + err := s.listers.IngressWithAnnotation.Update(&Ingress{ + Ingress: *copyIng, + }) + if err != nil { + klog.Error(err) + } +} + +// GetService returns the Service matching key. +func (s *k8sStore) GetService(key string) (*corev1.Service, error) { + return s.listers.Service.ByKey(key) +} + +// getIngress returns the Ingress matching key. +func (s *k8sStore) getIngress(key string) (*networking.Ingress, error) { + ing, err := s.listers.IngressWithAnnotation.ByKey(key) + if err != nil { + return nil, err + } + + return &ing.Ingress, nil +} + +func sortIngressSlice(ingresses []*Ingress) { + // sort Ingresses using the CreationTimestamp field + sort.SliceStable(ingresses, func(i, j int) bool { + ir := ingresses[i].CreationTimestamp + jr := ingresses[j].CreationTimestamp + if ir.Equal(&jr) { + in := fmt.Sprintf("%v/%v", ingresses[i].Namespace, ingresses[i].Name) + jn := fmt.Sprintf("%v/%v", ingresses[j].Namespace, ingresses[j].Name) + klog.V(3).Infof("Ingress %v and %v have identical CreationTimestamp", in, jn) + return in > jn + } + return ir.Before(&jr) + }) +} + +// ListIngresses returns the list of Ingresses +func (s *k8sStore) ListIngresses() []*Ingress { + // filter ingress rules + ingresses := make([]*Ingress, 0) + for _, item := range s.listers.IngressWithAnnotation.List() { + ing := item.(*Ingress) + if IsValid(&ing.Ingress) { + ingresses = append(ingresses, ing) + } + + } + + sortIngressSlice(ingresses) + + return ingresses +} + +// GetServiceEndpoints returns the Endpoints of a Service matching key. +func (s *k8sStore) GetServiceEndpoints(key string) (*corev1.Endpoints, error) { + return s.listers.Endpoint.ByKey(key) +} + +func (s *k8sStore) GetPod(key string) (*corev1.Pod, error) { + return s.listers.Pod.ByKey(key) +} + +// Run initiates the synchronization of the informers and the initial +// synchronization of the secrets. +func (s *k8sStore) Run(stopCh chan struct{}) { + // start informers + s.informers.Run(stopCh) +} + +var runtimeScheme = k8sruntime.NewScheme() + +func init() { + utilruntime.Must(networking.AddToScheme(runtimeScheme)) +} + +func toIngress(obj interface{}) (*networking.Ingress, bool) { + if ing, ok := obj.(*networking.Ingress); ok { + SetDefaultALBPathType(ing) + return ing, true + } + + return nil, false +} + +func isLoadBalancerOrNodePortService(svc *corev1.Service) bool { + return isLoadBalancerService(svc) || isNodePortService(svc) +} +func isLoadBalancerService(svc *corev1.Service) bool { + return svc.Spec.Type == corev1.ServiceTypeLoadBalancer +} + +func isNodePortService(svc *corev1.Service) bool { + return svc.Spec.Type == corev1.ServiceTypeNodePort +} +func isLocalModeService(svc *corev1.Service) bool { + return svc.Spec.ExternalTrafficPolicy == corev1.ServiceExternalTrafficPolicyTypeLocal +} diff --git a/pkg/controller/ingress/reconcile/tracking/tracking.go b/pkg/controller/ingress/reconcile/tracking/tracking.go new file mode 100644 index 000000000..c224212d1 --- /dev/null +++ b/pkg/controller/ingress/reconcile/tracking/tracking.go @@ -0,0 +1,71 @@ +package tracking + +import ( + "fmt" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" +) + +type TrackingProvider interface { + ResourceIDTagKey() string + + AlbConfigTagKey() string + + ClusterNameTagKey() string + + StackTags(stack core.Manager) map[string]string + + ResourceTags(stack core.Manager, res core.Resource, additionalTags map[string]string) map[string]string +} + +func NewDefaultProvider(tagPrefix, clusterID string) *defaultTrackingProvider { + return &defaultTrackingProvider{ + tagPrefix: tagPrefix, + clusterID: clusterID, + } +} + +var _ TrackingProvider = &defaultTrackingProvider{} + +type defaultTrackingProvider struct { + tagPrefix string + clusterID string +} + +func (p *defaultTrackingProvider) ResourceIDTagKey() string { + return p.prefixedTrackingKey("resource") +} + +func (p *defaultTrackingProvider) AlbConfigTagKey() string { + return p.prefixedTrackingKey(util.AlbConfigTagKey) +} + +func (p *defaultTrackingProvider) ClusterNameTagKey() string { + return util.ClusterNameTagKey +} + +func (p *defaultTrackingProvider) StackTags(stack core.Manager) map[string]string { + stackID := stack.StackID() + return map[string]string{ + p.ClusterNameTagKey(): p.clusterID, + p.AlbConfigTagKey(): stackID.String(), + } +} + +// ResourceTags +// ack.aliyun.com ${cluster_id} +// ingress.k8s.alibaba/resource ApplicationLoadBalancer +// ingress.k8s.alibaba/albconfig ${albconfig_ns}/${albconfig_name} +func (p *defaultTrackingProvider) ResourceTags(stack core.Manager, res core.Resource, additionalTags map[string]string) map[string]string { + stackTags := p.StackTags(stack) + resourceIDTags := map[string]string{ + p.ResourceIDTagKey(): res.ID(), + } + return util.MergeStringMap(stackTags, resourceIDTags, additionalTags) +} + +func (p *defaultTrackingProvider) prefixedTrackingKey(tag string) string { + return fmt.Sprintf("%v/%v", p.tagPrefix, tag) +} diff --git a/pkg/controller/register.go b/pkg/controller/register.go index 9df94b30f..d680df264 100644 --- a/pkg/controller/register.go +++ b/pkg/controller/register.go @@ -2,11 +2,11 @@ package controller import ( "fmt" + "reflect" + "k8s.io/cloud-provider-alibaba-cloud/cmd/health" v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" - "reflect" - apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" apiext "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" @@ -42,8 +42,7 @@ func RegisterCRD(cfg *rest.Config) error { } client := crd.NewClient(extc) for _, crd := range []CRD{ - NewGatewayCRD(client), - NewAckIngressCRD(client), + NewAlbConfigCRD(client), } { err := crd.Initialize() if err != nil { @@ -60,76 +59,30 @@ type CRD interface { GetListerWatcher() cache.ListerWatcher } -// AckIngressCRD is the cluster crd . -type AckIngressCRD struct { - crdc crd.Interface - //kino vcset.Interface -} - -func NewAckIngressCRD( - //kinoClient vcset.Interface, - crdClient crd.Interface, -) *AckIngressCRD { - return &AckIngressCRD{ - crdc: crdClient, - //kino: kinoClient, - } -} - -// podTerminatorCRD satisfies resource.crd interface. -func (p *AckIngressCRD) Initialize() error { - crd := crd.Conf{ - Kind: "AckIngress", - NamePlural: "ackingresses", - Group: "alibabacloud.com", - Version: "v1", - Scope: apiextv1beta1.NamespaceScoped, - EnableStatusSubresource: true, - } - - return p.crdc.EnsurePresent(crd) -} - -// GetListerWatcher satisfies resource.crd interface (and retrieve.Retriever). -func (p *AckIngressCRD) GetListerWatcher() cache.ListerWatcher { - //return &cache.ListWatch{ - // ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - // return p.kino.KinoV1().Clusters("").List(context.TODO(), options) - // }, - // WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - // return p.kino.KinoV1().Clusters("").Watch(context.TODO(),options) - // }, - //} - return nil -} - -// GetObject satisfies resource.crd interface (and retrieve.Retriever). -func (p *AckIngressCRD) GetObject() runtime.Object { return &v1.AckIngress{} } - -// AckIngressCRD is the cluster crd . -type GatewayCRD struct { +// AlbConfigCRD is the cluster crd . +type AlbConfigCRD struct { crdc crd.Interface //kino vcset.Interface } -func NewGatewayCRD( +func NewAlbConfigCRD( //kinoClient vcset.Interface, crdClient crd.Interface, -) *GatewayCRD { - return &GatewayCRD{ +) *AlbConfigCRD { + return &AlbConfigCRD{ crdc: crdClient, //kino: kinoClient, } } // podTerminatorCRD satisfies resource.crd interface. -func (p *GatewayCRD) Initialize() error { +func (p *AlbConfigCRD) Initialize() error { crd := crd.Conf{ - Kind: "Gateway", - NamePlural: "gateways", + Kind: "AlbConfig", + NamePlural: "albconfigs", Group: "alibabacloud.com", Version: "v1", - Scope: apiextv1beta1.NamespaceScoped, + Scope: crd.NamespaceScoped, EnableStatusSubresource: true, } @@ -137,17 +90,9 @@ func (p *GatewayCRD) Initialize() error { } // GetListerWatcher satisfies resource.crd interface (and retrieve.Retriever). -func (p *GatewayCRD) GetListerWatcher() cache.ListerWatcher { - //return &cache.ListWatch{ - // ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - // return p.kino.KinoV1().Clusters("").List(context.TODO(), options) - // }, - // WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - // return p.kino.KinoV1().Clusters("").Watch(context.TODO(),options) - // }, - //} +func (p *AlbConfigCRD) GetListerWatcher() cache.ListerWatcher { return nil } // GetObject satisfies resource.crd interface (and retrieve.Retriever). -func (p *GatewayCRD) GetObject() runtime.Object { return &v1.Gateway{} } +func (p *AlbConfigCRD) GetObject() runtime.Object { return &v1.AlbConfig{} } diff --git a/pkg/model/alb/alb.go b/pkg/model/alb/alb.go new file mode 100644 index 000000000..8fd8ff5ab --- /dev/null +++ b/pkg/model/alb/alb.go @@ -0,0 +1,279 @@ +package alb + +import "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + +type ALBLoadBalancerSpec struct { + AddressAllocatedMode string `json:"AddressAllocatedMode" xml:"AddressAllocatedMode"` + AddressType string `json:"AddressType" xml:"AddressType"` + DNSName string `json:"DNSName" xml:"DNSName"` + LoadBalancerEdition string `json:"LoadBalancerEdition" xml:"LoadBalancerEdition"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + LoadBalancerName string `json:"LoadBalancerName" xml:"LoadBalancerName"` + LoadBalancerStatus string `json:"LoadBalancerStatus" xml:"LoadBalancerStatus"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + VpcId string `json:"VpcId" xml:"VpcId"` + ForceOverride *bool `json:"ForceOverride" xml:"ForceOverride"` + AccessLogConfig AccessLogConfig `json:"AccessLogConfig" xml:"AccessLogConfig"` + DeletionProtectionConfig DeletionProtectionConfig `json:"DeletionProtectionConfig" xml:"DeletionProtectionConfig"` + LoadBalancerBillingConfig LoadBalancerBillingConfig `json:"LoadBalancerBillingConfig" xml:"LoadBalancerBillingConfig"` + ModificationProtectionConfig ModificationProtectionConfig `json:"ModificationProtectionConfig" xml:"ModificationProtectionConfig"` + LoadBalancerOperationLocks []LoadBalancerOperationLock `json:"LoadBalancerOperationLocks" xml:"LoadBalancerOperationLocks"` + Tags []ALBTag `json:"Tags" xml:"Tags"` + ZoneMapping []ZoneMapping `json:"ZoneMapping" xml:"ZoneMapping"` +} + +type ALBListenerSpec struct { + DefaultActions []Action `json:"DefaultActions" xml:"DefaultActions"` + Certificates []Certificate `json:"Certificates" xml:"Certificates"` + CaCertificates []Certificate `json:"CaCertificates" xml:"CaCertificates"` + GzipEnabled bool `json:"GzipEnabled" xml:"GzipEnabled"` + Http2Enabled bool `json:"Http2Enabled" xml:"Http2Enabled"` + IdleTimeout int `json:"IdleTimeout" xml:"IdleTimeout"` + ListenerDescription string `json:"ListenerDescription" xml:"ListenerDescription"` + ListenerId string `json:"ListenerId" xml:"ListenerId"` + ListenerPort int `json:"ListenerPort" xml:"ListenerPort"` + ListenerProtocol string `json:"ListenerProtocol" xml:"ListenerProtocol"` + ListenerStatus string `json:"ListenerStatus" xml:"ListenerStatus"` + RequestTimeout int `json:"RequestTimeout" xml:"RequestTimeout"` + SecurityPolicyId string `json:"SecurityPolicyId" xml:"SecurityPolicyId"` + LogConfig LogConfig `json:"LogConfig" xml:"LogConfig"` + QuicConfig QuicConfig `json:"QuicConfig" xml:"QuicConfig"` + XForwardedForConfig XForwardedForConfig `json:"XForwardedForConfig" xml:"XForwardedForConfig"` +} + +type ALBListenerRuleSpec struct { + Priority int `json:"Priority" xml:"Priority"` + RuleId string `json:"RuleId" xml:"RuleId"` + RuleName string `json:"RuleName" xml:"RuleName"` + RuleStatus string `json:"RuleStatus" xml:"RuleStatus"` + RuleActions []Action `json:"RuleActions" xml:"RuleActions"` + RuleConditions []Condition `json:"RuleConditions" xml:"RuleConditions"` +} + +type ALBServerGroupSpec struct { + Protocol string `json:"Protocol" xml:"Protocol"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + Scheduler string `json:"Scheduler" xml:"Scheduler"` + ServerGroupId string `json:"ServerGroupId" xml:"ServerGroupId"` + ServerGroupName string `json:"ServerGroupName" xml:"ServerGroupName"` + ServerGroupStatus string `json:"ServerGroupStatus" xml:"ServerGroupStatus"` + ServerGroupType string `json:"ServerGroupType" xml:"ServerGroupType"` + VpcId string `json:"VpcId" xml:"VpcId"` + HealthCheckConfig HealthCheckConfig `json:"HealthCheckConfig" xml:"HealthCheckConfig"` + StickySessionConfig StickySessionConfig `json:"StickySessionConfig" xml:"StickySessionConfig"` + Tags []ALBTag `json:"Tags" xml:"Tags"` +} + +type AccessLogConfig struct { + LogStore string `json:"LogStore" xml:"LogStore"` + LogProject string `json:"LogProject" xml:"LogProject"` +} +type DeletionProtectionConfig struct { + Enabled bool `json:"Enabled" xml:"Enabled"` + EnabledTime string `json:"EnabledTime" xml:"EnabledTime"` +} +type LoadBalancerBillingConfig struct { + InternetBandwidth int `json:"InternetBandwidth" xml:"InternetBandwidth"` + InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"` + PayType string `json:"PayType" xml:"PayType"` +} +type ModificationProtectionConfig struct { + Reason string `json:"Reason" xml:"Reason"` + Status string `json:"Status" xml:"Status"` +} +type LoadBalancerOperationLock struct { + LockReason string `json:"LockReason" xml:"LockReason"` + LockType string `json:"LockType" xml:"LockType"` +} + +type AccessLog struct { + LogProject string `json:"project"` + LogStore string `json:"logstore"` +} + +type ZoneMapping struct { + VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + LoadBalancerAddresses []LoadBalancerAddress `json:"LoadBalancerAddresses" xml:"LoadBalancerAddresses"` +} +type LoadBalancerAddress struct { + Address string `json:"Address" xml:"Address"` +} + +type HealthCheckConfig struct { + HealthCheckConnectPort int `json:"HealthCheckConnectPort" xml:"HealthCheckConnectPort"` + HealthCheckEnabled bool `json:"HealthCheckEnabled" xml:"HealthCheckEnabled"` + HealthCheckHost string `json:"HealthCheckHost" xml:"HealthCheckHost"` + HealthCheckHttpVersion string `json:"HealthCheckHttpVersion" xml:"HealthCheckHttpVersion"` + HealthCheckInterval int `json:"HealthCheckInterval" xml:"HealthCheckInterval"` + HealthCheckMethod string `json:"HealthCheckMethod" xml:"HealthCheckMethod"` + HealthCheckPath string `json:"HealthCheckPath" xml:"HealthCheckPath"` + HealthCheckProtocol string `json:"HealthCheckProtocol" xml:"HealthCheckProtocol"` + HealthCheckTimeout int `json:"HealthCheckTimeout" xml:"HealthCheckTimeout"` + HealthyThreshold int `json:"HealthyThreshold" xml:"HealthyThreshold"` + UnhealthyThreshold int `json:"UnhealthyThreshold" xml:"UnhealthyThreshold"` + HealthCheckTcpFastCloseEnabled bool `json:"HealthCheckTcpFastCloseEnabled" xml:"HealthCheckTcpFastCloseEnabled"` + HealthCheckHttpCodes []string `json:"HealthCheckHttpCodes" xml:"HealthCheckHttpCodes"` + HealthCheckCodes []string `json:"HealthCheckCodes" xml:"HealthCheckCodes"` +} +type StickySessionConfig struct { + Cookie string `json:"Cookie" xml:"Cookie"` + CookieTimeout int `json:"CookieTimeout" xml:"CookieTimeout"` + StickySessionEnabled bool `json:"StickySessionEnabled" xml:"StickySessionEnabled"` + StickySessionType string `json:"StickySessionType" xml:"StickySessionType"` +} + +type Certificate struct { + IsDefault bool `json:"IsDefault" xml:"IsDefault"` + CertificateId string `json:"CertificateId" xml:"CertificateId"` + Status string `json:"Status" xml:"Status"` +} +type LogConfig struct { + AccessLogRecordCustomizedHeadersEnabled bool `json:"AccessLogRecordCustomizedHeadersEnabled" xml:"AccessLogRecordCustomizedHeadersEnabled"` + AccessLogTracingConfig AccessLogTracingConfig `json:"AccessLogTracingConfig" xml:"AccessLogTracingConfig"` +} +type AccessLogTracingConfig struct { + TracingSample int `json:"TracingSample" xml:"TracingSample"` + TracingType string `json:"TracingType" xml:"TracingType"` + TracingEnabled bool `json:"TracingEnabled" xml:"TracingEnabled"` +} +type QuicConfig struct { + QuicUpgradeEnabled bool `json:"QuicUpgradeEnabled" xml:"QuicUpgradeEnabled"` + QuicListenerId string `json:"QuicListenerId" xml:"QuicListenerId"` +} + +type XForwardedForConfig struct { + XForwardedForClientCertSubjectDNAlias string `json:"XForwardedForClientCertSubjectDNAlias" xml:"XForwardedForClientCertSubjectDNAlias"` + XForwardedForClientCertSubjectDNEnabled bool `json:"XForwardedForClientCertSubjectDNEnabled" xml:"XForwardedForClientCertSubjectDNEnabled"` + XForwardedForProtoEnabled bool `json:"XForwardedForProtoEnabled" xml:"XForwardedForProtoEnabled"` + XForwardedForClientCertIssuerDNEnabled bool `json:"XForwardedForClientCertIssuerDNEnabled" xml:"XForwardedForClientCertIssuerDNEnabled"` + XForwardedForSLBIdEnabled bool `json:"XForwardedForSLBIdEnabled" xml:"XForwardedForSLBIdEnabled"` + XForwardedForClientSrcPortEnabled bool `json:"XForwardedForClientSrcPortEnabled" xml:"XForwardedForClientSrcPortEnabled"` + XForwardedForClientCertFingerprintEnabled bool `json:"XForwardedForClientCertFingerprintEnabled" xml:"XForwardedForClientCertFingerprintEnabled"` + XForwardedForEnabled bool `json:"XForwardedForEnabled" xml:"XForwardedForEnabled"` + XForwardedForSLBPortEnabled bool `json:"XForwardedForSLBPortEnabled" xml:"XForwardedForSLBPortEnabled"` + XForwardedForClientCertClientVerifyAlias string `json:"XForwardedForClientCertClientVerifyAlias" xml:"XForwardedForClientCertClientVerifyAlias"` + XForwardedForClientCertIssuerDNAlias string `json:"XForwardedForClientCertIssuerDNAlias" xml:"XForwardedForClientCertIssuerDNAlias"` + XForwardedForClientCertFingerprintAlias string `json:"XForwardedForClientCertFingerprintAlias" xml:"XForwardedForClientCertFingerprintAlias"` + XForwardedForClientCertClientVerifyEnabled bool `json:"XForwardedForClientCertClientVerifyEnabled" xml:"XForwardedForClientCertClientVerifyEnabled"` +} + +type Action struct { + Order int `json:"Order" xml:"Order"` + Type string `json:"Type" xml:"Type"` + ForwardConfig *ForwardActionConfig `json:"forwardConfig,omitempty"` + FixedResponseConfig *FixedResponseConfig `json:"FixedResponseConfig" xml:"FixedResponseConfig"` + RedirectConfig *RedirectConfig `json:"RedirectConfig" xml:"RedirectConfig"` + InsertHeaderConfig *InsertHeaderConfig `json:"InsertHeaderConfig" xml:"InsertHeaderConfig"` + RemoveHeaderConfig *RemoveHeaderConfig `json:"RemoveHeaderConfig" xml:"RemoveHeaderConfig"` + RewriteConfig *RewriteConfig `json:"RewriteConfig" xml:"RewriteConfig"` + TrafficMirrorConfig *TrafficMirrorConfig `json:"TrafficMirrorConfig" xml:"TrafficMirrorConfig"` + TrafficLimitConfig *TrafficLimitConfig `json:"TrafficLimitConfig" xml:"TrafficLimitConfig"` +} + +type ServerGroupTuple struct { + ServerGroupID core.StringToken `json:"serverGroupID"` + + ServiceName string `json:"serviceName"` + + ServicePort int `json:"servicePort"` + + Weight int `json:"weight,omitempty"` +} +type InsertHeaderConfig struct { + CoverEnabled bool `json:"CoverEnabled" xml:"CoverEnabled"` + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` + ValueType string `json:"ValueType" xml:"ValueType"` +} +type RemoveHeaderConfig struct { + Key string `json:"Key" xml:"Key"` +} +type RewriteConfig struct { + Host string `json:"Host" xml:"Host"` + Path string `json:"Path" xml:"Path"` + Query string `json:"Query" xml:"Query"` +} +type RedirectConfig struct { + Host string `json:"Host" xml:"Host"` + HttpCode string `json:"HttpCode" xml:"HttpCode"` + Path string `json:"Path" xml:"Path"` + Port string `json:"Port" xml:"Port"` + Protocol string `json:"Protocol" xml:"Protocol"` + Query string `json:"Query" xml:"Query"` +} + +type ForwardActionConfig struct { + ServerGroupStickySession *ServerGroupStickySession `json:"ServerGroupStickySession" xml:"ServerGroupStickySession"` + ServerGroups []ServerGroupTuple `json:"serverGroups"` +} +type ServerGroupStickySession struct { + Enabled bool `json:"Enabled" xml:"Enabled"` + Timeout int `json:"Timeout" xml:"Timeout"` +} + +type TrafficMirrorConfig struct { + TargetType string `json:"TargetType" xml:"TargetType"` + MirrorGroupConfig MirrorGroupConfig `json:"MirrorGroupConfig" xml:"MirrorGroupConfig"` +} +type MirrorGroupConfig struct { + ServerGroupTuples []ServerGroupTuple `json:"ServerGroupTuples" xml:"ServerGroupTuples"` +} +type TrafficLimitConfig struct { + QPS int `json:"QPS" xml:"QPS"` +} +type FixedResponseConfig struct { + Content string `json:"Content" xml:"Content"` + ContentType string `json:"ContentType" xml:"ContentType"` + HttpCode string `json:"HttpCode" xml:"HttpCode"` +} + +type Condition struct { + Type string `json:"Type" xml:"Type"` + CookieConfig CookieConfig `json:"CookieConfig" xml:"CookieConfig"` + HeaderConfig HeaderConfig `json:"HeaderConfig" xml:"HeaderConfig"` + HostConfig HostConfig `json:"HostConfig" xml:"HostConfig"` + MethodConfig MethodConfig `json:"MethodConfig" xml:"MethodConfig"` + PathConfig PathConfig `json:"PathConfig" xml:"PathConfig"` + QueryStringConfig QueryStringConfig `json:"QueryStringConfig" xml:"QueryStringConfig"` + SourceIpConfig SourceIpConfig `json:"SourceIpConfig" xml:"SourceIpConfig"` + ResponseStatusCodeConfig ResponseStatusCodeConfig `json:"ResponseStatusCodeConfig" xml:"ResponseStatusCodeConfig"` + ResponseHeaderConfig ResponseHeaderConfig `json:"ResponseHeaderConfig" xml:"ResponseHeaderConfig"` +} +type CookieConfig struct { + Values []Value `json:"Values" xml:"Values"` +} +type HeaderConfig struct { + Key string `json:"Key" xml:"Key"` + Values []string `json:"Values" xml:"Values"` +} +type Value struct { + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` +} +type HostConfig struct { + Values []string `json:"Values" xml:"Values"` +} +type MethodConfig struct { + Values []string `json:"Values" xml:"Values"` +} +type PathConfig struct { + Values []string `json:"Values" xml:"Values"` +} +type QueryStringConfig struct { + Values []Value `json:"Values" xml:"Values"` +} +type SourceIpConfig struct { + Values []string `json:"Values" xml:"Values"` +} +type ResponseStatusCodeConfig struct { + Values []string `json:"Values" xml:"Values"` +} +type ResponseHeaderConfig struct { + Key string `json:"Key" xml:"Key"` + Values []string `json:"Values" xml:"Values"` +} +type ALBTag struct { + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` +} diff --git a/pkg/model/alb/core/graph/resource_graph.go b/pkg/model/alb/core/graph/resource_graph.go new file mode 100644 index 000000000..78413c9aa --- /dev/null +++ b/pkg/model/alb/core/graph/resource_graph.go @@ -0,0 +1,60 @@ +package graph + +import "reflect" + +// unique ID for a resource. +type ResourceUID struct { + ResType reflect.Type + ResID string +} + +// ResourceGraph is an abstraction of resource DAG. +type ResourceGraph interface { + // Add a node into ResourceGraph. + AddNode(node ResourceUID) + + // Add a edge into ResourceGraph, where dstNode depends on srcNode. + AddEdge(srcNode ResourceUID, dstNode ResourceUID) + + // Nodes returns all nodes in ResourceGraph. + Nodes() []ResourceUID + + // OutEdgeNodes returns all nodes that depends on this node. + OutEdgeNodes(node ResourceUID) []ResourceUID +} + +// NewDefaultResourceGraph constructs new defaultResourceGraph. +func NewDefaultResourceGraph() *defaultResourceGraph { + return &defaultResourceGraph{ + nodes: nil, + outEdges: make(map[ResourceUID][]ResourceUID), + } +} + +var _ ResourceGraph = &defaultResourceGraph{} + +// defaultResourceGraph is the default implementation for ResourceGraph. +type defaultResourceGraph struct { + nodes []ResourceUID + outEdges map[ResourceUID][]ResourceUID +} + +// Add a node into ResourceGraph. +func (g *defaultResourceGraph) AddNode(node ResourceUID) { + g.nodes = append(g.nodes, node) +} + +// Add a edge into ResourceGraph, where dstNode depends on srcNode. +func (g *defaultResourceGraph) AddEdge(srcNode ResourceUID, dstNode ResourceUID) { + g.outEdges[srcNode] = append(g.outEdges[srcNode], dstNode) +} + +// Nodes returns all nodes in ResourceGraph. +func (g *defaultResourceGraph) Nodes() []ResourceUID { + return g.nodes +} + +// OutEdgeNodes returns all nodes that depends on this node. +func (g *defaultResourceGraph) OutEdgeNodes(node ResourceUID) []ResourceUID { + return g.outEdges[node] +} diff --git a/pkg/model/alb/core/graph/typological_traversal.go b/pkg/model/alb/core/graph/typological_traversal.go new file mode 100644 index 000000000..779024895 --- /dev/null +++ b/pkg/model/alb/core/graph/typological_traversal.go @@ -0,0 +1,49 @@ +package graph + +import ( + "github.com/pkg/errors" +) + +// TopologicalTraversal will traversal nodes in typological order. +func TopologicalTraversal(graph ResourceGraph, visitFunc func(uid ResourceUID) error) error { + nodes := graph.Nodes() + indegreeByNode := make(map[ResourceUID]int, len(nodes)) + for _, node := range nodes { + if _, ok := indegreeByNode[node]; !ok { + indegreeByNode[node] = 0 + } + for _, outEdgeNode := range graph.OutEdgeNodes(node) { + indegreeByNode[outEdgeNode]++ + } + + } + + var queue []ResourceUID + for node, indegree := range indegreeByNode { + if indegree == 0 { + queue = append(queue, node) + } + } + + for len(queue) > 0 { + node := queue[len(queue)-1] + queue = queue[:len(queue)-1] + if err := visitFunc(node); err != nil { + return err + } + + for _, outEdgeNode := range graph.OutEdgeNodes(node) { + indegreeByNode[outEdgeNode]-- + if indegreeByNode[outEdgeNode] == 0 { + queue = append(queue, outEdgeNode) + } + } + } + + for _, indegree := range indegreeByNode { + if indegree > 0 { + return errors.New("ResourceGraph is not a DAG") + } + } + return nil +} diff --git a/pkg/model/alb/core/resource.go b/pkg/model/alb/core/resource.go new file mode 100644 index 000000000..8dab8146c --- /dev/null +++ b/pkg/model/alb/core/resource.go @@ -0,0 +1,46 @@ +package core + +// Resource represents a deployment unit. +type Resource interface { + // resource's stack. + Stack() Manager + + // resource's Type. + Type() string + + // resource's ID within stack. + ID() string +} + +// NewResourceMeta constructs new resource metadata. +func NewResourceMeta(stack Manager, resType string, id string) ResourceMeta { + return ResourceMeta{ + stack: stack, + resType: resType, + id: id, + } +} + +// Metadata for all resources. +type ResourceMeta struct { + stack Manager + resType string + id string +} + +func (m *ResourceMeta) Stack() Manager { + return m.stack +} + +func (m *ResourceMeta) Type() string { + return m.resType +} + +func (m *ResourceMeta) ID() string { + return m.id +} + +// ResourceVisitor represents a functor that can operate on a resource. +type ResourceVisitor interface { + Visit(res Resource) error +} diff --git a/pkg/model/alb/core/stack.go b/pkg/model/alb/core/stack.go new file mode 100644 index 000000000..3b9c6659f --- /dev/null +++ b/pkg/model/alb/core/stack.go @@ -0,0 +1,116 @@ +package core + +import ( + "reflect" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core/graph" + + "github.com/pkg/errors" +) + +// Manager presents a resource graph, where resources can depend on each other. +type Manager interface { + // stackID returns a unique ID for stack. + StackID() StackID + + // Add a resource into stack. + AddResource(res Resource) error + + // Add a dependency relationship between resources. + AddDependency(dependee Resource, depender Resource) error + + // ListResources list all resources for specific type. + // pResourceSlice must be a pointer to a slice of resources, which will be filled. + ListResources(pResourceSlice interface{}) error + + // TopologicalTraversal visits resources in stack in topological order. + TopologicalTraversal(visitor ResourceVisitor) error +} + +// NewDefaultManager constructs new stack. +func NewDefaultManager(stackID StackID) *defaultManager { + return &defaultManager{ + stackID: stackID, + + resources: make(map[graph.ResourceUID]Resource), + resourceGraph: graph.NewDefaultResourceGraph(), + } +} + +var _ Manager = &defaultManager{} + +// default implementation for stack. +type defaultManager struct { + stackID StackID + + resources map[graph.ResourceUID]Resource + resourceGraph graph.ResourceGraph +} + +func (s *defaultManager) StackID() StackID { + return s.stackID +} + +// Add a resource. +func (s *defaultManager) AddResource(res Resource) error { + resUID := s.computeResourceUID(res) + if _, ok := s.resources[resUID]; ok { + return errors.Errorf("resource already exists, type: %v, id: %v", res.Type(), res.ID()) + } + s.resources[resUID] = res + s.resourceGraph.AddNode(resUID) + return nil +} + +// Add a dependency relationship between resources. +func (s *defaultManager) AddDependency(dependee Resource, depender Resource) error { + dependeeResUID := s.computeResourceUID(dependee) + dependerResUID := s.computeResourceUID(depender) + if _, ok := s.resources[dependeeResUID]; !ok { + return errors.Errorf("dependee resource didn't exists, type: %v, id: %v", dependee.Type(), dependee.ID()) + } + if _, ok := s.resources[dependerResUID]; !ok { + return errors.Errorf("depender resource didn't exists, type: %v, id: %v", depender.Type(), depender.ID()) + } + s.resourceGraph.AddEdge(dependeeResUID, dependerResUID) + return nil +} + +// ListResources list all resources for specific type. +// pResourceSlice must be a pointer to a slice of resources, which will be filled. +func (s *defaultManager) ListResources(pResourceSlice interface{}) error { + v := reflect.ValueOf(pResourceSlice) + if v.Kind() != reflect.Ptr { + return errors.New("pResourceSlice must be pointer to resource slice") + } + v = v.Elem() + if v.Kind() != reflect.Slice { + return errors.New("pResourceSlice must be pointer to resource slice") + } + resType := v.Type().Elem() + var resForType []Resource + for resID, res := range s.resources { + if resID.ResType == resType { + resForType = append(resForType, res) + } + } + v.Set(reflect.MakeSlice(v.Type(), len(resForType), len(resForType))) + for i := range resForType { + v.Index(i).Set(reflect.ValueOf(resForType[i])) + } + return nil +} + +func (s *defaultManager) TopologicalTraversal(visitor ResourceVisitor) error { + return graph.TopologicalTraversal(s.resourceGraph, func(uid graph.ResourceUID) error { + return visitor.Visit(s.resources[uid]) + }) +} + +// computeResourceUID returns the UID for resources. +func (s *defaultManager) computeResourceUID(res Resource) graph.ResourceUID { + return graph.ResourceUID{ + ResType: reflect.TypeOf(res), + ResID: res.ID(), + } +} diff --git a/pkg/model/alb/core/stack_id.go b/pkg/model/alb/core/stack_id.go new file mode 100644 index 000000000..cd23c059c --- /dev/null +++ b/pkg/model/alb/core/stack_id.go @@ -0,0 +1,16 @@ +package core + +import ( + "fmt" + + "k8s.io/apimachinery/pkg/types" +) + +type StackID types.NamespacedName + +func (stackID StackID) String() string { + if stackID.Namespace == "" { + return stackID.Name + } + return fmt.Sprintf("%s/%s", stackID.Namespace, stackID.Name) +} diff --git a/pkg/model/alb/core/token_types.go b/pkg/model/alb/core/token_types.go new file mode 100644 index 000000000..242749bc3 --- /dev/null +++ b/pkg/model/alb/core/token_types.go @@ -0,0 +1,62 @@ +package core + +import ( + "context" + "fmt" +) + +// Token represent a value that can be resolved at resolution time. +type Token interface { + // token's value resolution may depends on 0 or more Resources. + Dependencies() []Resource +} + +// StringToken represent a string value that can be resolved at resolution time. +type StringToken interface { + Token + Resolve(ctx context.Context) (string, error) +} + +var _ StringToken = LiteralStringToken("") + +// LiteralStringToken represents a literal string value. +type LiteralStringToken string + +func (t LiteralStringToken) Resolve(ctx context.Context) (string, error) { + return string(t), nil +} + +func (t LiteralStringToken) Dependencies() []Resource { + return nil +} + +// NewResourceFieldStringToken constructs new ResourceFieldStringToken. +func NewResourceFieldStringToken(res Resource, fieldPath string, + resolverFunc func(ctx context.Context, res Resource, fieldPath string) (string, error)) *ResourceFieldStringToken { + return &ResourceFieldStringToken{ + res: res, + fieldPath: fieldPath, + resolveFunc: resolverFunc, + } +} + +var _ StringToken = &ResourceFieldStringToken{} + +type ResourceFieldStringToken struct { + res Resource + fieldPath string + resolveFunc func(ctx context.Context, res Resource, fieldPath string) (string, error) +} + +func (t *ResourceFieldStringToken) Resolve(ctx context.Context) (string, error) { + return t.resolveFunc(ctx, t.res, t.fieldPath) +} + +func (t *ResourceFieldStringToken) Dependencies() []Resource { + return []Resource{t.res} +} + +func (t *ResourceFieldStringToken) MarshalJSON() ([]byte, error) { + payload := fmt.Sprintf(`{"$ref": "#/resources/%v/%v/%v"}`, t.res.Type(), t.res.ID(), t.fieldPath) + return []byte(payload), nil +} diff --git a/pkg/model/alb/listener.go b/pkg/model/alb/listener.go new file mode 100644 index 000000000..4fc3465f2 --- /dev/null +++ b/pkg/model/alb/listener.go @@ -0,0 +1,60 @@ +package alb + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + + "github.com/pkg/errors" +) + +var _ core.Resource = &Listener{} + +type Listener struct { + core.ResourceMeta `json:"-"` + + Spec ListenerSpec `json:"spec"` + + Status *ListenerStatus `json:"status,omitempty"` +} + +func NewListener(stack core.Manager, id string, spec ListenerSpec) *Listener { + ls := &Listener{ + ResourceMeta: core.NewResourceMeta(stack, "ALIYUN::ALB::LISTENER", id), + Spec: spec, + Status: nil, + } + stack.AddResource(ls) + ls.registerDependencies(stack) + return ls +} + +func (ls *Listener) SetStatus(status ListenerStatus) { + ls.Status = &status +} + +func (ls *Listener) ListenerID() core.StringToken { + return core.NewResourceFieldStringToken(ls, "status/listenerID", + func(ctx context.Context, res core.Resource, fieldPath string) (s string, err error) { + ls := res.(*Listener) + if ls.Status == nil { + return "", errors.Errorf("Listener is not fulfilled yet: %v", ls.ID()) + } + return ls.Status.ListenerID, nil + }, + ) +} + +func (ls *Listener) registerDependencies(stack core.Manager) { + for _, dep := range ls.Spec.LoadBalancerID.Dependencies() { + stack.AddDependency(dep, ls) + } +} + +type ListenerSpec struct { + LoadBalancerID core.StringToken `json:"loadBalancerID"` + ALBListenerSpec +} +type ListenerStatus struct { + ListenerID string `json:"listenerID"` +} diff --git a/pkg/model/alb/load_balancer.go b/pkg/model/alb/load_balancer.go new file mode 100644 index 000000000..8b8296e6a --- /dev/null +++ b/pkg/model/alb/load_balancer.go @@ -0,0 +1,67 @@ +package alb + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + + "github.com/pkg/errors" +) + +var _ core.Resource = &AlbLoadBalancer{} + +type AlbLoadBalancer struct { + core.ResourceMeta `json:"-"` + + Spec ALBLoadBalancerSpec `json:"spec"` + + Status *LoadBalancerStatus `json:"status,omitempty"` +} + +func NewAlbLoadBalancer(stack core.Manager, id string, spec ALBLoadBalancerSpec) *AlbLoadBalancer { + lb := &AlbLoadBalancer{ + ResourceMeta: core.NewResourceMeta(stack, "ALIYUN::ALB::LOADBALANCER", id), + Spec: spec, + Status: nil, + } + stack.AddResource(lb) + lb.registerDependencies(stack) + return lb +} + +func (lb *AlbLoadBalancer) SetStatus(status LoadBalancerStatus) { + lb.Status = &status +} + +func (lb *AlbLoadBalancer) LoadBalancerID() core.StringToken { + return core.NewResourceFieldStringToken(lb, "status/loadBalancerID", + func(ctx context.Context, res core.Resource, fieldPath string) (s string, err error) { + lb := res.(*AlbLoadBalancer) + if lb.Status == nil { + return "", errors.Errorf("LoadBalancer is not fulfilled yet: %v", lb.ID()) + } + return lb.Status.LoadBalancerID, nil + }, + ) +} + +func (lb *AlbLoadBalancer) DNSName() core.StringToken { + return core.NewResourceFieldStringToken(lb, "status/dnsName", + func(ctx context.Context, res core.Resource, fieldPath string) (s string, err error) { + lb := res.(*AlbLoadBalancer) + if lb.Status == nil { + return "", errors.Errorf("LoadBalancer is not fulfilled yet: %v", lb.ID()) + } + return lb.Status.DNSName, nil + }, + ) +} + +func (lb *AlbLoadBalancer) registerDependencies(stack core.Manager) { + return +} + +type LoadBalancerStatus struct { + DNSName string `json:"dnsName"` + LoadBalancerID string `json:"loadBalancerID"` +} diff --git a/pkg/model/alb/rule.go b/pkg/model/alb/rule.go new file mode 100644 index 000000000..6bdd1f35a --- /dev/null +++ b/pkg/model/alb/rule.go @@ -0,0 +1,51 @@ +package alb + +import ( + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" +) + +var _ core.Resource = &ListenerRule{} + +type ListenerRule struct { + core.ResourceMeta `json:"-"` + + Spec ListenerRuleSpec `json:"spec"` + + Status *ListenerRuleStatus `json:"status,omitempty"` +} + +func NewListenerRule(stack core.Manager, id string, spec ListenerRuleSpec) *ListenerRule { + lr := &ListenerRule{ + ResourceMeta: core.NewResourceMeta(stack, "ALIYUN::ALB::RULE", id), + Spec: spec, + Status: nil, + } + stack.AddResource(lr) + lr.registerDependencies(stack) + return lr +} + +func (lr *ListenerRule) SetStatus(status ListenerRuleStatus) { + lr.Status = &status +} + +func (lr *ListenerRule) registerDependencies(stack core.Manager) { + for _, dep := range lr.Spec.ListenerID.Dependencies() { + stack.AddDependency(dep, lr) + } +} + +type ListenerRuleStatus struct { + RuleID string `json:"ruleID"` +} + +type ListenerRuleSpec struct { + ListenerID core.StringToken `json:"listenerID"` + ALBListenerRuleSpec +} + +type ResAndSDKListenerRulePair struct { + ResLR *ListenerRule + SdkLR *albsdk.Rule +} diff --git a/pkg/model/alb/server_group.go b/pkg/model/alb/server_group.go new file mode 100644 index 000000000..b616788d7 --- /dev/null +++ b/pkg/model/alb/server_group.go @@ -0,0 +1,54 @@ +package alb + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb/core" + + "github.com/pkg/errors" +) + +var _ core.Resource = &ServerGroup{} + +type ServerGroup struct { + core.ResourceMeta `json:"-"` + + Spec ServerGroupSpec `json:"spec"` + + Status *ServerGroupStatus `json:"status,omitempty"` +} + +func NewServerGroup(stack core.Manager, id string, spec ServerGroupSpec) *ServerGroup { + sgp := &ServerGroup{ + ResourceMeta: core.NewResourceMeta(stack, "ALIYUN::ALB::SERVERGROUP", id), + Spec: spec, + Status: nil, + } + stack.AddResource(sgp) + return sgp +} + +func (sgp *ServerGroup) ServerGroupID() core.StringToken { + return core.NewResourceFieldStringToken(sgp, "status/serverGroupID", + func(ctx context.Context, res core.Resource, fieldPath string) (s string, err error) { + sgp := res.(*ServerGroup) + if sgp.Status == nil { + return "", errors.Errorf("ServerGroup is not fulfilled yet: %v", sgp.ID()) + } + return sgp.Status.ServerGroupID, nil + }, + ) +} + +type ServerGroupSpec struct { + ServerGroupNamedKey + ALBServerGroupSpec +} + +type ServerGroupStatus struct { + ServerGroupID string `json:"serverGroupID"` +} + +func (sgp *ServerGroup) SetStatus(status ServerGroupStatus) { + sgp.Status = &status +} diff --git a/pkg/model/alb/service_manager.go b/pkg/model/alb/service_manager.go new file mode 100644 index 000000000..84f2b2e0a --- /dev/null +++ b/pkg/model/alb/service_manager.go @@ -0,0 +1,89 @@ +package alb + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" +) + +type ServiceManager struct { + ClusterID string + + Namespace string + Name string + + PortToServerGroup map[int32]*ServerGroupWithIngress + + TrafficPolicy string + ContainsPotentialReadyEndpoints bool +} + +type ServerGroupNamedKey struct { + Prefix string + ClusterID string + Namespace string + IngressName string + ServiceName string + ServicePort int +} + +type BackendItem struct { + Pod *v1.Pod + Description string + ServerId string + ServerIp string + Weight int + Port int + Type string +} + +type ServiceGroupWithNameKey struct { + NamedKey *ServerGroupNamedKey + Backends []BackendItem +} + +type ServerGroupWithIngress struct { + IngressNames []string + Backends []BackendItem +} + +const ( + ECSBackendType = "ecs" + ENIBackendType = "eni" +) + +const ( + OnFlag = FlagType("on") + OffFlag = FlagType("off") +) + +type FlagType string + +func (n *ServerGroupNamedKey) String() string { + if n == nil { + return "" + } + return n.Key() +} + +const DefaultPrefix = "k8s" + +func (n *ServerGroupNamedKey) Key() string { + if n.Prefix == "" { + n.Prefix = DefaultPrefix + } + return fmt.Sprintf("%s_%d_%s_%s_%s_%.6s", n.Prefix, n.ServicePort, n.ServiceName, n.IngressName, n.Namespace, n.ClusterID) +} + +type ServiceStackContext struct { + ClusterID string + + ServiceNamespace string + ServiceName string + + Service *v1.Service + + ServicePortToIngressNames map[int32][]string + + IsServiceNotFound bool +} diff --git a/pkg/model/alb/tag.go b/pkg/model/alb/tag.go new file mode 100644 index 000000000..cf5a557be --- /dev/null +++ b/pkg/model/alb/tag.go @@ -0,0 +1,13 @@ +package alb + +import albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + +type ServerGroupWithTags struct { + albsdk.ServerGroup + Servers []albsdk.BackendServer + Tags map[string]string +} +type AlbLoadBalancerWithTags struct { + albsdk.LoadBalancer + Tags map[string]string +} diff --git a/pkg/provider/alibaba/alb/alb.go b/pkg/provider/alibaba/alb/alb.go new file mode 100644 index 000000000..af4eda96e --- /dev/null +++ b/pkg/provider/alibaba/alb/alb.go @@ -0,0 +1,877 @@ +package alb + +import ( + "context" + "errors" + "fmt" + "strings" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" + "github.com/go-logr/logr" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + ctrl "sigs.k8s.io/controller-runtime" +) + +const ( + DefaultWaitSGPDeletionPollInterval = 2 * time.Second + DefaultWaitSGPDeletionTimeout = 50 * time.Second + DefaultWaitLSExistencePollInterval = 2 * time.Second + DefaultWaitLSExistenceTimeout = 20 * time.Second +) + +func NewALBProvider( + auth *base.ClientMgr, +) *ALBProvider { + logger := ctrl.Log.WithName("controllers").WithName("ALBProvider") + return &ALBProvider{ + logger: logger, + auth: auth, + waitSGPDeletionPollInterval: DefaultWaitSGPDeletionPollInterval, + waitSGPDeletionTimeout: DefaultWaitSGPDeletionTimeout, + waitLSExistenceTimeout: DefaultWaitLSExistenceTimeout, + waitLSExistencePollInterval: DefaultWaitLSExistencePollInterval, + } +} + +var _ prvd.IALB = &ALBProvider{} + +type ALBProvider struct { + auth *base.ClientMgr + logger logr.Logger + sdkCerts []albsdk.CertificateModel + + waitLSExistencePollInterval time.Duration + waitLSExistenceTimeout time.Duration + waitSGPDeletionPollInterval time.Duration + waitSGPDeletionTimeout time.Duration +} + +func (m *ALBProvider) CreateALB(ctx context.Context, resLB *alb.AlbLoadBalancer, trackingProvider tracking.TrackingProvider) (alb.LoadBalancerStatus, error) { + traceID := ctx.Value(util.TraceID) + + createLbReq, err := buildSDKCreateAlbLoadBalancerRequest(resLB.Spec) + if err != nil { + return alb.LoadBalancerStatus{}, err + } + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("creating loadBalancer", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "startTime", startTime, + util.Action, util.CreateALBLoadBalancer) + createLbResp, err := m.auth.ALB.CreateLoadBalancer(createLbReq) + if err != nil { + return alb.LoadBalancerStatus{}, err + } + m.logger.V(util.MgrLogLevel).Info("created loadBalancer", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "loadBalancerID", createLbResp.LoadBalancerId, + "traceID", traceID, + "requestID", createLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.CreateALBLoadBalancer) + + asynchronousStartTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("creating loadBalancer asynchronous", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", createLbResp.LoadBalancerId, + "startTime", asynchronousStartTime, + util.Action, util.CreateALBLoadBalancerAsynchronous) + var getLbResp *albsdk.GetLoadBalancerAttributeResponse + for i := 0; i < util.CreateLoadBalancerWaitActiveMaxRetryTimes; i++ { + time.Sleep(util.CreateLoadBalancerWaitActiveRetryInterval) + + getLbResp, err = getALBLoadBalancerAttributeFunc(ctx, createLbResp.LoadBalancerId, m.auth, m.logger) + if err != nil { + return alb.LoadBalancerStatus{}, err + } + if isAlbLoadBalancerActive(getLbResp.LoadBalancerStatus) { + break + } + } + m.logger.V(util.MgrLogLevel).Info("created loadBalancer asynchronous", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", createLbResp.LoadBalancerId, + "requestID", getLbResp.RequestId, + "elapsedTime", time.Since(asynchronousStartTime).Milliseconds(), + util.Action, util.CreateALBLoadBalancerAsynchronous) + + if err := m.Tag(ctx, resLB, createLbResp.LoadBalancerId, trackingProvider); err != nil { + if errTmp := m.DeleteALB(ctx, createLbResp.LoadBalancerId); errTmp != nil { + m.logger.V(util.MgrLogLevel).Error(errTmp, "roll back load balancer failed", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", createLbResp.LoadBalancerId, + util.Action, util.TagALBResource) + } + return alb.LoadBalancerStatus{}, err + } + + if len(resLB.Spec.AccessLogConfig.LogProject) != 0 && len(resLB.Spec.AccessLogConfig.LogStore) != 0 { + if err := m.AnalyzeAndAssociateAccessLogToALB(ctx, createLbResp.LoadBalancerId, resLB); err != nil { + return alb.LoadBalancerStatus{}, err + } + } + + return buildResAlbLoadBalancerStatus(createLbResp.LoadBalancerId, getLbResp.DNSName), nil +} + +func isAlbLoadBalancerActive(status string) bool { + return strings.EqualFold(status, util.LoadBalancerStatusActive) +} + +func (m *ALBProvider) UpdateALB(ctx context.Context, resLB *alb.AlbLoadBalancer, sdkLB albsdk.LoadBalancer) (alb.LoadBalancerStatus, error) { + if err := m.updateAlbLoadBalancerAttribute(ctx, resLB, &sdkLB); err != nil { + return alb.LoadBalancerStatus{}, err + } + if err := m.updateAlbLoadBalancerDeletionProtection(ctx, resLB, &sdkLB); err != nil { + return alb.LoadBalancerStatus{}, err + } + if err := m.updateAlbLoadBalancerAccessLogConfig(ctx, resLB, &sdkLB); err != nil { + return alb.LoadBalancerStatus{}, err + } + if err := m.updateAlbLoadBalancerEdition(ctx, resLB, &sdkLB); err != nil { + return alb.LoadBalancerStatus{}, err + } + + return buildResAlbLoadBalancerStatus(sdkLB.LoadBalancerId, sdkLB.DNSName), nil +} + +func (m *ALBProvider) Tag(ctx context.Context, resLB *alb.AlbLoadBalancer, lbID string, trackingProvider tracking.TrackingProvider) error { + traceID := ctx.Value(util.TraceID) + + lbTags := trackingProvider.ResourceTags(resLB.Stack(), resLB, transTagListToMap(resLB.Spec.Tags)) + lbIDs := make([]string, 0) + lbIDs = append(lbIDs, lbID) + tags := transTagMapToSDKTagResourcesTagList(lbTags) + tagReq := albsdk.CreateTagResourcesRequest() + tagReq.Tag = &tags + tagReq.ResourceId = &lbIDs + tagReq.ResourceType = util.LoadBalancerResourceType + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("tagging resource", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.TagALBResource) + tagResp, err := m.auth.ALB.TagResources(tagReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("tagged resource", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", lbID, + "requestID", tagResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.TagALBResource) + + return nil +} + +func (m *ALBProvider) preCheckTagConflictForReuse(ctx context.Context, sdkLB *albsdk.GetLoadBalancerAttributeResponse, resLB *alb.AlbLoadBalancer, trackingProvider tracking.TrackingProvider) error { + if sdkLB.VpcId != resLB.Spec.VpcId { + return fmt.Errorf("the vpc %s of reused alb %s is not same with cluster vpc %s", sdkLB.VpcId, sdkLB.LoadBalancerId, resLB.Spec.VpcId) + } + + if len(sdkLB.Tags) == 0 { + return nil + } + sdkTags := transSDKTagListToMap(sdkLB.Tags) + resTags := trackingProvider.ResourceTags(resLB.Stack(), resLB, transTagListToMap(resLB.Spec.Tags)) + + sdkClusterID, okSdkClusterID := sdkTags[trackingProvider.ClusterNameTagKey()] + resClusterID, okResClusterID := resTags[trackingProvider.ClusterNameTagKey()] + if okSdkClusterID && okResClusterID { + if sdkClusterID != resClusterID { + return fmt.Errorf("alb %s belongs to cluster: %s, cant reuse alb to another cluster: %s", + sdkLB.LoadBalancerId, sdkClusterID, resClusterID) + } + + sdkAlbConfig, okSdkAlbConfig := sdkTags[trackingProvider.AlbConfigTagKey()] + resAlbConfig, okResAlbConfig := resTags[trackingProvider.AlbConfigTagKey()] + if okSdkAlbConfig && okResAlbConfig { + if sdkAlbConfig != resAlbConfig { + return fmt.Errorf("alb %s belongs to albconfig: %s, cant reuse alb to another albconfig: %s", + sdkLB.LoadBalancerId, sdkAlbConfig, resAlbConfig) + } + } + } + + return nil +} + +func (m *ALBProvider) ReuseALB(ctx context.Context, resLB *alb.AlbLoadBalancer, lbID string, trackingProvider tracking.TrackingProvider) (alb.LoadBalancerStatus, error) { + getLbResp, err := getALBLoadBalancerAttributeFunc(ctx, lbID, m.auth, m.logger) + if err != nil { + return alb.LoadBalancerStatus{}, err + } + + if err := m.preCheckTagConflictForReuse(ctx, getLbResp, resLB, trackingProvider); err != nil { + return alb.LoadBalancerStatus{}, err + } + + if err = m.Tag(ctx, resLB, lbID, trackingProvider); err != nil { + return alb.LoadBalancerStatus{}, err + } + + if resLB.Spec.ForceOverride != nil && *resLB.Spec.ForceOverride { + loadBalancer := transSDKGetLoadBalancerAttributeResponseToLoadBalancer(*getLbResp) + return m.UpdateALB(ctx, resLB, loadBalancer) + } + + return buildResAlbLoadBalancerStatus(lbID, getLbResp.DNSName), nil +} + +func transSDKGetLoadBalancerAttributeResponseToLoadBalancer(albAttr albsdk.GetLoadBalancerAttributeResponse) albsdk.LoadBalancer { + return albsdk.LoadBalancer{ + AddressAllocatedMode: albAttr.AddressAllocatedMode, + AddressType: albAttr.AddressType, + BandwidthCapacity: albAttr.BandwidthCapacity, + BandwidthPackageId: albAttr.BandwidthPackageId, + CreateTime: albAttr.CreateTime, + DNSName: albAttr.DNSName, + ServiceManagedEnabled: albAttr.ServiceManagedEnabled, + ServiceManagedMode: albAttr.ServiceManagedMode, + LoadBalancerBussinessStatus: albAttr.LoadBalancerBussinessStatus, + LoadBalancerEdition: albAttr.LoadBalancerEdition, + LoadBalancerId: albAttr.LoadBalancerId, + LoadBalancerName: albAttr.LoadBalancerName, + LoadBalancerStatus: albAttr.LoadBalancerStatus, + ResourceGroupId: albAttr.ResourceGroupId, + VpcId: albAttr.VpcId, + AccessLogConfig: albAttr.AccessLogConfig, + DeletionProtectionConfig: albAttr.DeletionProtectionConfig, + LoadBalancerBillingConfig: albAttr.LoadBalancerBillingConfig, + ModificationProtectionConfig: albAttr.ModificationProtectionConfig, + LoadBalancerOperationLocks: albAttr.LoadBalancerOperationLocks, + Tags: albAttr.Tags, + } +} + +var getALBLoadBalancerAttributeFunc = func(ctx context.Context, lbID string, auth *base.ClientMgr, logger logr.Logger) (*albsdk.GetLoadBalancerAttributeResponse, error) { + traceID := ctx.Value(util.TraceID) + + getLbReq := albsdk.CreateGetLoadBalancerAttributeRequest() + getLbReq.LoadBalancerId = lbID + startTime := time.Now() + logger.V(util.MgrLogLevel).Info("getting loadBalancer attribute", + "traceID", traceID, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.GetALBLoadBalancerAttribute) + getLbResp, err := auth.ALB.GetLoadBalancerAttribute(getLbReq) + if err != nil { + return nil, err + } + logger.V(util.MgrLogLevel).Info("got loadBalancer attribute", + "traceID", traceID, + "loadBalancerID", lbID, + "loadBalancerStatus", getLbResp.LoadBalancerStatus, + "requestID", getLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.GetALBLoadBalancerAttribute) + return getLbResp, nil +} + +var disableALBDeletionProtectionFunc = func(ctx context.Context, lbID string, auth *base.ClientMgr, logger logr.Logger) (*albsdk.DisableDeletionProtectionResponse, error) { + traceID := ctx.Value(util.TraceID) + + updateLbReq := albsdk.CreateDisableDeletionProtectionRequest() + updateLbReq.ResourceId = lbID + startTime := time.Now() + logger.V(util.MgrLogLevel).Info("disabling delete protection", + "traceID", traceID, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.DisableALBDeletionProtection) + updateLbResp, err := auth.ALB.DisableDeletionProtection(updateLbReq) + if err != nil { + return nil, err + } + logger.V(util.MgrLogLevel).Info("disabled delete protection", + "traceID", traceID, + "loadBalancerID", lbID, + "requestID", updateLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DisableALBDeletionProtection) + + return updateLbResp, nil +} + +var enableALBDeletionProtectionFunc = func(ctx context.Context, lbID string, auth *base.ClientMgr, logger logr.Logger) (*albsdk.EnableDeletionProtectionResponse, error) { + traceID := ctx.Value(util.TraceID) + + updateLbReq := albsdk.CreateEnableDeletionProtectionRequest() + updateLbReq.ResourceId = lbID + startTime := time.Now() + logger.V(util.MgrLogLevel).Info("enabling delete protection", + "traceID", traceID, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.EnableALBDeletionProtection) + updateLbResp, err := auth.ALB.EnableDeletionProtection(updateLbReq) + if err != nil { + return nil, err + } + logger.V(util.MgrLogLevel).Info("enabled delete protection", + "traceID", traceID, + "loadBalancerID", lbID, + "requestID", updateLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.EnableALBDeletionProtection) + + return updateLbResp, nil +} + +var deleteALBLoadBalancerFunc = func(ctx context.Context, m *ALBProvider, lbID string) (*albsdk.DeleteLoadBalancerResponse, error) { + traceID := ctx.Value(util.TraceID) + + lbReq := albsdk.CreateDeleteLoadBalancerRequest() + lbReq.LoadBalancerId = lbID + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("deleting loadBalancer", + "loadBalancerID", lbID, + "traceID", traceID, + "startTime", startTime, + util.Action, util.DeleteALBLoadBalancer) + lsResp, err := m.auth.ALB.DeleteLoadBalancer(lbReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("deleted loadBalancer", + "loadBalancerID", lbID, + "traceID", traceID, + "requestID", lsResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DeleteALBLoadBalancer) + + return lsResp, nil +} + +func (m *ALBProvider) DeleteALB(ctx context.Context, lbID string) error { + getLbResp, err := getALBLoadBalancerAttributeFunc(ctx, lbID, m.auth, m.logger) + if err != nil { + return err + } + + if getLbResp.DeletionProtectionConfig.Enabled { + _, err := disableALBDeletionProtectionFunc(ctx, lbID, m.auth, m.logger) + if err != nil { + return err + } + } + + if _, err = deleteALBLoadBalancerFunc(ctx, m, lbID); err != nil { + return err + } + + return nil +} + +func transSDKModificationProtectionConfigToCreateLb(mpc alb.ModificationProtectionConfig) albsdk.CreateLoadBalancerModificationProtectionConfig { + return albsdk.CreateLoadBalancerModificationProtectionConfig{ + Reason: mpc.Reason, + Status: mpc.Status, + } +} + +func transSDKLoadBalancerBillingConfigToCreateLb(lbc alb.LoadBalancerBillingConfig) albsdk.CreateLoadBalancerLoadBalancerBillingConfig { + return albsdk.CreateLoadBalancerLoadBalancerBillingConfig{ + PayType: lbc.PayType, + } +} + +func transSDKZoneMappingsToCreateLb(zoneMappings []alb.ZoneMapping) *[]albsdk.CreateLoadBalancerZoneMappings { + createLbZoneMappings := make([]albsdk.CreateLoadBalancerZoneMappings, 0) + + for _, zoneMapping := range zoneMappings { + createLbZoneMapping := albsdk.CreateLoadBalancerZoneMappings{ + VSwitchId: zoneMapping.VSwitchId, + ZoneId: zoneMapping.ZoneId, + } + createLbZoneMappings = append(createLbZoneMappings, createLbZoneMapping) + } + + return &createLbZoneMappings +} + +func buildSDKCreateAlbLoadBalancerRequest(lbSpec alb.ALBLoadBalancerSpec) (*albsdk.CreateLoadBalancerRequest, error) { + createLbReq := albsdk.CreateCreateLoadBalancerRequest() + if len(lbSpec.VpcId) == 0 { + return nil, fmt.Errorf("invalid load balancer vpc id: %s", lbSpec.VpcId) + } + createLbReq.VpcId = lbSpec.VpcId + + if !isAlbLoadBalancerAddressTypeValid(lbSpec.AddressType) { + return nil, fmt.Errorf("invalid load balancer address type: %s", lbSpec.AddressType) + } + createLbReq.AddressType = lbSpec.AddressType + + createLbReq.LoadBalancerName = lbSpec.LoadBalancerName + + createLbReq.DeletionProtectionEnabled = requests.NewBoolean(lbSpec.DeletionProtectionConfig.Enabled) + + if !isAlbLoadBalancerModificationProtectionStatusValid(lbSpec.ModificationProtectionConfig.Status) { + return nil, fmt.Errorf("invalid load balancer modification protection config: %v", lbSpec.ModificationProtectionConfig) + } + createLbReq.ModificationProtectionConfig = transSDKModificationProtectionConfigToCreateLb(lbSpec.ModificationProtectionConfig) + + if len(lbSpec.ZoneMapping) == 0 { + return nil, fmt.Errorf("empty load balancer zone mapping") + } + createLbReq.ZoneMappings = transSDKZoneMappingsToCreateLb(lbSpec.ZoneMapping) + + if !isLoadBalancerAddressAllocatedModeValid(lbSpec.AddressAllocatedMode) { + return nil, fmt.Errorf("invalid load balancer address allocate mode: %s", lbSpec.AddressAllocatedMode) + } + createLbReq.AddressAllocatedMode = lbSpec.AddressAllocatedMode + + createLbReq.ResourceGroupId = lbSpec.ResourceGroupId + + if !isAlbLoadBalancerEditionValid(lbSpec.LoadBalancerEdition) { + return nil, fmt.Errorf("invalid load balancer edition: %s", lbSpec.LoadBalancerEdition) + } + createLbReq.LoadBalancerEdition = lbSpec.LoadBalancerEdition + + if !isAlbLoadBalancerLoadBalancerPayTypeValid(lbSpec.LoadBalancerBillingConfig.PayType) { + return nil, fmt.Errorf("invalid load balancer paytype: %s", lbSpec.LoadBalancerBillingConfig.PayType) + } + createLbReq.LoadBalancerBillingConfig = transSDKLoadBalancerBillingConfigToCreateLb(lbSpec.LoadBalancerBillingConfig) + + return createLbReq, nil +} + +func transSDKModificationProtectionConfigToUpdateLb(mpc alb.ModificationProtectionConfig) albsdk.UpdateLoadBalancerAttributeModificationProtectionConfig { + return albsdk.UpdateLoadBalancerAttributeModificationProtectionConfig{ + Reason: mpc.Reason, + Status: mpc.Status, + } +} + +func (m *ALBProvider) updateAlbLoadBalancerAttribute(ctx context.Context, resLB *alb.AlbLoadBalancer, sdkLB *albsdk.LoadBalancer) error { + traceID := ctx.Value(util.TraceID) + + var ( + isModificationProtectionConfigModifyNeedUpdate = false + isLoadBalancerNameNeedUpdate = false + ) + + if !isAlbLoadBalancerModificationProtectionStatusValid(resLB.Spec.ModificationProtectionConfig.Status) { + return fmt.Errorf("invalid load balancer modification protection config: %v", resLB.Spec.ModificationProtectionConfig) + } + modificationProtectionConfig := transModificationProtectionConfigToSDK(resLB.Spec.ModificationProtectionConfig) + if modificationProtectionConfig != sdkLB.ModificationProtectionConfig { + m.logger.V(util.MgrLogLevel).Info("ModificationProtectionConfig update", + "res", resLB.Spec.ModificationProtectionConfig, + "sdk", sdkLB.ModificationProtectionConfig, + "loadBalancerID", sdkLB.LoadBalancerId, + "traceID", traceID) + isModificationProtectionConfigModifyNeedUpdate = true + } + if resLB.Spec.LoadBalancerName != sdkLB.LoadBalancerName { + m.logger.V(util.MgrLogLevel).Info("LoadBalancerName update", + "res", resLB.Spec.LoadBalancerName, + "sdk", sdkLB.LoadBalancerName, + "loadBalancerID", sdkLB.LoadBalancerId, + "traceID", traceID) + isLoadBalancerNameNeedUpdate = true + } + + if !isLoadBalancerNameNeedUpdate && !isModificationProtectionConfigModifyNeedUpdate { + return nil + } + + updateLbReq := albsdk.CreateUpdateLoadBalancerAttributeRequest() + updateLbReq.LoadBalancerId = sdkLB.LoadBalancerId + if isModificationProtectionConfigModifyNeedUpdate { + updateLbReq.ModificationProtectionConfig = transSDKModificationProtectionConfigToUpdateLb(resLB.Spec.ModificationProtectionConfig) + } + if isLoadBalancerNameNeedUpdate { + updateLbReq.LoadBalancerName = resLB.Spec.LoadBalancerName + } + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("updating loadBalancer attribute", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", sdkLB.LoadBalancerId, + "startTime", startTime, + util.Action, util.UpdateALBLoadBalancerAttribute) + updateLbResp, err := m.auth.ALB.UpdateLoadBalancerAttribute(updateLbReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("updating loadBalancer attribute", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", sdkLB.LoadBalancerId, + "requestID", updateLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.UpdateALBLoadBalancerAttribute) + + return nil +} + +func (m *ALBProvider) updateAlbLoadBalancerDeletionProtection(ctx context.Context, resLB *alb.AlbLoadBalancer, sdkLB *albsdk.LoadBalancer) error { + traceID := ctx.Value(util.TraceID) + + var ( + isDeletionProtectionNeedUpdate = false + ) + + if resLB.Spec.DeletionProtectionConfig.Enabled != sdkLB.DeletionProtectionConfig.Enabled { + m.logger.V(util.MgrLogLevel).Info("DeletionProtectionConfig update", + "res", resLB.Spec.DeletionProtectionConfig.Enabled, + "sdk", sdkLB.DeletionProtectionConfig.Enabled, + "loadBalancerID", sdkLB.LoadBalancerId, + "traceID", traceID) + isDeletionProtectionNeedUpdate = true + } + if !isDeletionProtectionNeedUpdate { + return nil + } + + if resLB.Spec.DeletionProtectionConfig.Enabled && !sdkLB.DeletionProtectionConfig.Enabled { + _, err := enableALBDeletionProtectionFunc(ctx, sdkLB.LoadBalancerId, m.auth, m.logger) + if err != nil { + return err + } + } else if !resLB.Spec.DeletionProtectionConfig.Enabled && sdkLB.DeletionProtectionConfig.Enabled { + _, err := disableALBDeletionProtectionFunc(ctx, sdkLB.LoadBalancerId, m.auth, m.logger) + if err != nil { + return err + } + } + + return nil +} + +func reCorrectRegion(region string) string { + switch region { + case "cn-shenzhen-finance-1": + return "cn-shenzhen-finance" + } + return region +} + +func (m *ALBProvider) DissociateAccessLogFromALB(ctx context.Context, lbID string, resLB *alb.AlbLoadBalancer) error { + traceID := ctx.Value(util.TraceID) + + updateLbReq := albsdk.CreateDisableLoadBalancerAccessLogRequest() + updateLbReq.LoadBalancerId = lbID + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("disabling loadBalancer access log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.DisableALBLoadBalancerAccessLog) + updateLbResp, err := m.auth.ALB.DisableLoadBalancerAccessLog(updateLbReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("disabled loadBalancer access log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", lbID, + "requestID", updateLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DisableALBLoadBalancerAccessLog) + return nil +} + +func (m *ALBProvider) AnalyzeAndAssociateAccessLogToALB(ctx context.Context, lbID string, resLB *alb.AlbLoadBalancer) error { + traceID := ctx.Value(util.TraceID) + + logProject := resLB.Spec.AccessLogConfig.LogProject + logStore := resLB.Spec.AccessLogConfig.LogStore + + if !isLogProjectNameValid(logProject) || !isLogStoreNameValid(logStore) { + return fmt.Errorf("invalid name of logProject: %s or logStore: %s", logProject, logStore) + } + + logReq := sls.CreateAnalyzeProductLogRequest() + region, err := m.auth.Meta.Region() + if err != nil { + return err + } + logReq.Region = reCorrectRegion(region) + logReq.Logstore = logStore + logReq.Project = logProject + logReq.AcceptFormat = util.DefaultLogAcceptFormat + logReq.CloudProduct = util.DefaultLogCloudProduct + logReq.Lang = util.DefaultLogLang + logReq.Domain = fmt.Sprintf("%s%s", logReq.Region, util.DefaultLogDomainSuffix) + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("analyzing product log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "request", logReq, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.AnalyzeProductLog) + logResp, err := m.auth.SLS.AnalyzeProductLog(logReq) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("analyzing product log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "loadBalancerID", lbID, + "traceID", traceID, + "requestID", logResp.RequestId, + "error", err.Error(), + util.Action, util.AnalyzeProductLog) + return err + } + m.logger.V(util.MgrLogLevel).Info("analyzed product log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "loadBalancerID", lbID, + "traceID", traceID, + "requestID", logResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.AnalyzeProductLog) + + lbReq := albsdk.CreateEnableLoadBalancerAccessLogRequest() + lbReq.LoadBalancerId = lbID + lbReq.LogProject = logProject + lbReq.LogStore = logStore + startTime = time.Now() + m.logger.V(util.MgrLogLevel).Info("enabling loadBalancer access log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", lbID, + "startTime", startTime, + util.Action, util.EnableALBLoadBalancerAccessLog) + lbResp, err := m.auth.ALB.EnableLoadBalancerAccessLog(lbReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("enabled loadBalancer access log", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "loadBalancerID", lbID, + "traceID", traceID, + "requestID", lbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.EnableALBLoadBalancerAccessLog) + return nil +} + +func (m *ALBProvider) updateAlbLoadBalancerAccessLogConfig(ctx context.Context, resLB *alb.AlbLoadBalancer, sdkLB *albsdk.LoadBalancer) error { + traceID := ctx.Value(util.TraceID) + + var ( + isAccessLogConfigNeedUpdate = false + ) + accessLogConfig := transAccessLogConfigToSDK(resLB.Spec.AccessLogConfig) + if accessLogConfig != sdkLB.AccessLogConfig { + m.logger.Info("LoadBalancer AccessLogConfig update", + "res", resLB.Spec.AccessLogConfig, + "sdk", sdkLB.AccessLogConfig, + "traceID", traceID) + isAccessLogConfigNeedUpdate = true + } + if !isAccessLogConfigNeedUpdate { + return nil + } + + if len(sdkLB.AccessLogConfig.LogProject) != 0 && len(sdkLB.AccessLogConfig.LogStore) != 0 { + if err := m.DissociateAccessLogFromALB(ctx, sdkLB.LoadBalancerId, resLB); err != nil { + return err + } + } + + if len(resLB.Spec.AccessLogConfig.LogProject) != 0 && len(resLB.Spec.AccessLogConfig.LogStore) != 0 { + if err := m.AnalyzeAndAssociateAccessLogToALB(ctx, sdkLB.LoadBalancerId, resLB); err != nil { + return err + } + } + return nil +} + +func (m *ALBProvider) updateAlbLoadBalancerEdition(ctx context.Context, resLB *alb.AlbLoadBalancer, sdkLB *albsdk.LoadBalancer) error { + traceID := ctx.Value(util.TraceID) + + var ( + isLoadBalancerEditionNeedUpdate = false + ) + + if !isAlbLoadBalancerEditionValid(resLB.Spec.LoadBalancerEdition) { + return fmt.Errorf("invalid load balancer edition: %s", resLB.Spec.LoadBalancerEdition) + } + if strings.EqualFold(resLB.Spec.LoadBalancerEdition, util.LoadBalancerEditionBasic) && + strings.EqualFold(sdkLB.LoadBalancerEdition, util.LoadBalancerEditionStandard) { + return errors.New("downgrade not allowed for alb from standard to basic") + } + if !strings.EqualFold(resLB.Spec.LoadBalancerEdition, sdkLB.LoadBalancerEdition) { + m.logger.V(util.MgrLogLevel).Info("LoadBalancer Edition update", + "res", resLB.Spec.LoadBalancerEdition, + "sdk", sdkLB.LoadBalancerEdition, + "loadBalancerID", sdkLB.LoadBalancerId, + "traceID", traceID) + isLoadBalancerEditionNeedUpdate = true + } + if !isLoadBalancerEditionNeedUpdate { + return nil + } + + updateLbReq := albsdk.CreateUpdateLoadBalancerEditionRequest() + updateLbReq.LoadBalancerId = sdkLB.LoadBalancerId + updateLbReq.LoadBalancerEdition = resLB.Spec.LoadBalancerEdition + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("updating loadBalancer edition", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "startTime", startTime, + "traceID", traceID, + "loadBalancerID", sdkLB.LoadBalancerId, + util.Action, util.UpdateALBLoadBalancerEdition) + updateLbResp, err := m.auth.ALB.UpdateLoadBalancerEdition(updateLbReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("updated loadBalancer edition", + "stackID", resLB.Stack().StackID(), + "resourceID", resLB.ID(), + "traceID", traceID, + "loadBalancerID", sdkLB.LoadBalancerId, + "requestID", updateLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.UpdateALBLoadBalancerEdition) + + return nil +} + +func transTagMapToSDKTagResourcesTagList(tagMap map[string]string) []albsdk.TagResourcesTag { + tagList := make([]albsdk.TagResourcesTag, 0) + for k, v := range tagMap { + tagList = append(tagList, albsdk.TagResourcesTag{ + Key: k, + Value: v, + }) + } + return tagList +} + +func transTagListToMap(tagList []alb.ALBTag) map[string]string { + tagMap := make(map[string]string, 0) + for _, tag := range tagList { + tagMap[tag.Key] = tag.Value + } + return tagMap +} + +func transSDKTagListToMap(tagList []albsdk.Tag) map[string]string { + tagMap := make(map[string]string, 0) + for _, tag := range tagList { + tagMap[tag.Key] = tag.Value + } + return tagMap +} +func buildResAlbLoadBalancerStatus(lbID, DNSName string) alb.LoadBalancerStatus { + return alb.LoadBalancerStatus{ + LoadBalancerID: lbID, + DNSName: DNSName, + } +} + +func isAlbLoadBalancerAddressTypeValid(addressType string) bool { + if strings.EqualFold(addressType, util.LoadBalancerAddressTypeInternet) || + strings.EqualFold(addressType, util.LoadBalancerAddressTypeIntranet) { + return true + } + return false +} + +func isAlbLoadBalancerModificationProtectionStatusValid(modificationProtectionStatus string) bool { + if strings.EqualFold(modificationProtectionStatus, util.LoadBalancerModificationProtectionStatusNonProtection) || + strings.EqualFold(modificationProtectionStatus, util.LoadBalancerModificationProtectionStatusConsoleProtection) { + return true + } + return false +} + +func isLoadBalancerAddressAllocatedModeValid(addressAllocatedMode string) bool { + if strings.EqualFold(addressAllocatedMode, util.LoadBalancerAddressAllocatedModeFixed) || + strings.EqualFold(addressAllocatedMode, util.LoadBalancerAddressAllocatedModeDynamic) { + return true + } + return false +} + +func (p ALBProvider) TagALBResources(request *albsdk.TagResourcesRequest) (response *albsdk.TagResourcesResponse, err error) { + return p.auth.ALB.TagResources(request) +} +func (p ALBProvider) DescribeALBZones(request *albsdk.DescribeZonesRequest) (response *albsdk.DescribeZonesResponse, err error) { + return p.auth.ALB.DescribeZones(request) +} + +func isAlbLoadBalancerEditionValid(edition string) bool { + if strings.EqualFold(edition, util.LoadBalancerEditionBasic) || + strings.EqualFold(edition, util.LoadBalancerEditionStandard) { + return true + } + return false +} + +func isAlbLoadBalancerLoadBalancerPayTypeValid(payType string) bool { + if strings.EqualFold(payType, util.LoadBalancerPayTypePostPay) { + return true + } + return false +} + +func isLogProjectNameValid(logProject string) bool { + if len(logProject) < util.MinLogProjectNameLen || len(logProject) > util.MaxLogProjectNameLen { + return false + } + return true +} + +func isLogStoreNameValid(logStore string) bool { + if len(logStore) < util.MinLogStoreNameLen || len(logStore) > util.MaxLogStoreNameLen { + return false + } + return true +} +func transAccessLogConfigToSDK(a alb.AccessLogConfig) albsdk.AccessLogConfig { + return albsdk.AccessLogConfig{ + LogProject: a.LogProject, + LogStore: a.LogStore, + } +} +func transModificationProtectionConfigToSDK(m alb.ModificationProtectionConfig) albsdk.ModificationProtectionConfig { + return albsdk.ModificationProtectionConfig{ + Reason: m.Reason, + Status: m.Status, + } +} diff --git a/pkg/provider/alibaba/alb/listener.go b/pkg/provider/alibaba/alb/listener.go new file mode 100644 index 000000000..97badf946 --- /dev/null +++ b/pkg/provider/alibaba/alb/listener.go @@ -0,0 +1,984 @@ +package alb + +import ( + "context" + "fmt" + "reflect" + "strconv" + "strings" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + + "k8s.io/apimachinery/pkg/util/sets" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/go-logr/logr" + "github.com/pkg/errors" +) + +func (m *ALBProvider) CreateALBListener(ctx context.Context, resLS *albmodel.Listener) (albmodel.ListenerStatus, error) { + traceID := ctx.Value(util.TraceID) + + createLsReq, err := buildSDKCreateListenerRequest(resLS.Spec) + if err != nil { + return albmodel.ListenerStatus{}, err + } + + var createLsResp *albsdk.CreateListenerResponse + if err := util.RetryImmediateOnError(m.waitLSExistencePollInterval, m.waitLSExistenceTimeout, isIncorrectStatusLoadBalancerError, func() error { + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("creating listener", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerPort", resLS.Spec.ListenerPort, + "listenerProtocol", resLS.Spec.ListenerProtocol, + "startTime", startTime, + util.Action, util.CreateALBListener) + createLsResp, err = m.auth.ALB.CreateListener(createLsReq) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("creating listener", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerID", createLsResp.ListenerId, + "requestID", createLsResp.RequestId, + "error", err.Error(), + util.Action, util.CreateALBListener) + return err + } + m.logger.V(util.MgrLogLevel).Info("created listener", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerID", createLsResp.ListenerId, + "requestID", createLsResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.CreateALBListener) + return nil + }); err != nil { + return albmodel.ListenerStatus{}, errors.Wrap(err, "failed to create listener") + } + + asynchronousStartTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("creating listener asynchronous", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerID", createLsResp.ListenerId, + "startTime", asynchronousStartTime, + util.Action, util.CreateALBListenerAsynchronous) + var getLsResp *albsdk.GetListenerAttributeResponse + for i := 0; i < util.CreateListenerWaitRunningMaxRetryTimes; i++ { + time.Sleep(util.CreateListenerWaitRunningRetryInterval) + + getLsResp, err = getALBListenerAttributeFunc(ctx, createLsResp.ListenerId, m.auth, m.logger) + if err != nil { + return albmodel.ListenerStatus{}, err + } + if isListenerListenerStatusRunning(getLsResp.ListenerStatus) { + break + } + } + m.logger.V(util.MgrLogLevel).Info("created listener asynchronous", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerID", createLsResp.ListenerId, + "listenerStatus", getLsResp.ListenerStatus, + "requestID", getLsResp.RequestId, + "elapsedTime", time.Since(asynchronousStartTime).Milliseconds(), + util.Action, util.CreateALBListenerAsynchronous) + + if isHTTPSListenerProtocol(resLS.Spec.ListenerProtocol) { + if err := util.RetryImmediateOnError(m.waitLSExistencePollInterval, m.waitLSExistenceTimeout, isIncorrectStatusListenerError, func() error { + if err := m.updateListenerExtraCertificates(ctx, createLsResp.ListenerId, resLS); err != nil { + return err + } + return nil + }); err != nil { + return albmodel.ListenerStatus{}, errors.Wrap(err, "failed to update listener extra certificates") + } + } + return buildResListenerStatus(createLsResp.ListenerId), nil +} + +func isListenerListenerStatusRunning(status string) bool { + return strings.EqualFold(status, util.ListenerStatusRunning) +} + +var getALBListenerAttributeFunc = func(ctx context.Context, lsID string, auth *base.ClientMgr, logger logr.Logger) (*albsdk.GetListenerAttributeResponse, error) { + traceID := ctx.Value(util.TraceID) + + getLsReq := albsdk.CreateGetListenerAttributeRequest() + getLsReq.ListenerId = lsID + startTime := time.Now() + logger.V(util.MgrLogLevel).Info("getting listener attribute", + "traceID", traceID, + "listenerID", lsID, + "startTime", startTime, + util.Action, util.GetALBListenerAttribute) + getLsResp, err := auth.ALB.GetListenerAttribute(getLsReq) + if err != nil { + return nil, err + } + logger.V(util.MgrLogLevel).Info("got listener attribute", + "traceID", traceID, + "listenerID", lsID, + "listenerStatus", getLsResp.ListenerStatus, + "requestID", getLsResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.GetALBListenerAttribute) + return getLsResp, nil +} + +func (m *ALBProvider) listListenerCerts(ctx context.Context, lsID string) ([]albsdk.CertificateModel, error) { + traceID := ctx.Value(util.TraceID) + + var ( + nextToken string + certificateModels []albsdk.CertificateModel + ) + listLsCertificateReq := albsdk.CreateListListenerCertificatesRequest() + listLsCertificateReq.ListenerId = lsID + for { + listLsCertificateReq.NextToken = nextToken + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("listing listener Certificates", + "traceID", traceID, + "listenerID", lsID, + "startTime", startTime, + util.Action, util.ListALBListenerCertificates) + listLsCertificateResp, err := m.auth.ALB.ListListenerCertificates(listLsCertificateReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("listed listener Certificates", + "traceID", traceID, + "listenerID", lsID, + "certificates", listLsCertificateResp.Certificates, + "requestID", listLsCertificateResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ListALBListenerCertificates) + + certificateModels = append(certificateModels, listLsCertificateResp.Certificates...) + + if len(listLsCertificateResp.NextToken) == 0 { + break + } else { + nextToken = listLsCertificateResp.NextToken + } + } + + return certificateModels, nil +} + +func (m *ALBProvider) UpdateALBListener(ctx context.Context, resLS *albmodel.Listener, sdkLS *albsdk.Listener) (albmodel.ListenerStatus, error) { + if isHTTPSListenerProtocol(sdkLS.ListenerProtocol) { + certs, err := m.listListenerCerts(ctx, sdkLS.ListenerId) + if err != nil { + return albmodel.ListenerStatus{}, err + } + m.sdkCerts = certs + } + + if err := m.updateListenerAttribute(ctx, resLS, sdkLS); err != nil { + return albmodel.ListenerStatus{}, err + } + + if isHTTPSListenerProtocol(sdkLS.ListenerProtocol) { + if err := m.updateListenerExtraCertificates(ctx, sdkLS.ListenerId, resLS); err != nil { + return albmodel.ListenerStatus{}, err + } + } + + return buildResListenerStatus(sdkLS.ListenerId), nil +} + +func (m *ALBProvider) DeleteALBListener(ctx context.Context, sdkLSId string) error { + traceID := ctx.Value(util.TraceID) + + deleteLsReq := albsdk.CreateDeleteListenerRequest() + deleteLsReq.ListenerId = sdkLSId + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("deleting listener", + "listenerID", sdkLSId, + "traceID", traceID, + "startTime", startTime, + util.Action, util.DeleteALBListener) + deleteLsResp, err := m.auth.ALB.DeleteListener(deleteLsReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("deleted listener", + "listenerID", sdkLSId, + "traceID", traceID, + "requestID", deleteLsResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DeleteALBListener) + return nil +} + +func (m *ALBProvider) ListALBListeners(ctx context.Context, lbID string) ([]albsdk.Listener, error) { + traceID := ctx.Value(util.TraceID) + + if len(lbID) == 0 { + return nil, fmt.Errorf("invalid load balancer id: %s for listing listeners", lbID) + } + + var ( + nextToken string + listeners []albsdk.Listener + ) + + listLsReq := albsdk.CreateListListenersRequest() + listLsReq.LoadBalancerIds = &[]string{lbID} + + for { + listLsReq.NextToken = nextToken + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("listing listeners", + "loadBalancerID", lbID, + "traceID", traceID, + "startTime", startTime, + util.Action, util.ListALBListeners) + listLsResp, err := m.auth.ALB.ListListeners(listLsReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("listed listeners", + "loadBalancerID", lbID, + "traceID", traceID, + "requestID", listLsResp.RequestId, + "listeners", listLsResp.Listeners, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ListALBListeners) + + listeners = append(listeners, listLsResp.Listeners...) + + if len(listLsResp.NextToken) == 0 { + break + } else { + nextToken = listLsResp.NextToken + } + } + + return listeners, nil +} + +func transSDKCertificateToAssociate(certs []albsdk.Certificate) *[]albsdk.AssociateAdditionalCertificatesWithListenerCertificates { + associateCerts := make([]albsdk.AssociateAdditionalCertificatesWithListenerCertificates, 0) + for _, cert := range certs { + associateCerts = append(associateCerts, albsdk.AssociateAdditionalCertificatesWithListenerCertificates{ + CertificateId: cert.CertificateId, + }) + } + return &associateCerts +} + +func (m *ALBProvider) AssociateALBAdditionalCertificatesWithListener(lsID string, certs []albsdk.Certificate) (*albsdk.AssociateAdditionalCertificatesWithListenerResponse, error) { + lsReq := albsdk.CreateAssociateAdditionalCertificatesWithListenerRequest() + lsReq.ListenerId = lsID + lsReq.Certificates = transSDKCertificateToAssociate(certs) + resp, err := m.auth.ALB.AssociateAdditionalCertificatesWithListener(lsReq) + if err != nil { + return nil, err + } + return resp, nil +} + +func transSDKCertificateToDissociate(certs []albsdk.Certificate) *[]albsdk.DissociateAdditionalCertificatesFromListenerCertificates { + dissociateCerts := make([]albsdk.DissociateAdditionalCertificatesFromListenerCertificates, 0) + for _, cert := range certs { + dissociateCerts = append(dissociateCerts, albsdk.DissociateAdditionalCertificatesFromListenerCertificates{ + CertificateId: cert.CertificateId, + }) + } + return &dissociateCerts +} + +func (m *ALBProvider) DissociateALBAdditionalCertificatesFromListener(lsID string, certs []albsdk.Certificate) (*albsdk.DissociateAdditionalCertificatesFromListenerResponse, error) { + lsReq := albsdk.CreateDissociateAdditionalCertificatesFromListenerRequest() + lsReq.ListenerId = lsID + lsReq.Certificates = transSDKCertificateToDissociate(certs) + lsResp, err := m.auth.ALB.DissociateAdditionalCertificatesFromListener(lsReq) + if err != nil { + return nil, err + } + return lsResp, nil +} + +func buildSDKCreateListenerRequest(lsSpec albmodel.ListenerSpec) (*albsdk.CreateListenerRequest, error) { + ctx := context.Background() + lbID, err := lsSpec.LoadBalancerID.Resolve(ctx) + if err != nil { + return nil, err + } + + createLsReq := albsdk.CreateCreateListenerRequest() + + createLsReq.LoadBalancerId = lbID + + if !isListenerProtocolValid(lsSpec.ListenerProtocol) { + return nil, fmt.Errorf("invalid listener protocol: %s", lsSpec.ListenerProtocol) + } + createLsReq.ListenerProtocol = lsSpec.ListenerProtocol + + if !isListenerPortValid(lsSpec.ListenerPort) { + return nil, fmt.Errorf("invalid listener port: %d", lsSpec.ListenerPort) + } + createLsReq.ListenerPort = requests.NewInteger(lsSpec.ListenerPort) + + createLsReq.ListenerDescription = lsSpec.ListenerDescription + + if !isListenerRequestTimeoutValid(lsSpec.RequestTimeout) { + return nil, fmt.Errorf("invalid listener RequestTimeout: %d", lsSpec.RequestTimeout) + } + createLsReq.RequestTimeout = requests.NewInteger(lsSpec.RequestTimeout) + + if !isListenerIdleTimeoutValid(lsSpec.IdleTimeout) { + return nil, fmt.Errorf("invalid listener IdleTimeout: %d", lsSpec.IdleTimeout) + } + createLsReq.IdleTimeout = requests.NewInteger(lsSpec.IdleTimeout) + + createLsReq.GzipEnabled = requests.NewBoolean(lsSpec.GzipEnabled) + createLsReq.QuicConfig = transSDKQuicConfigToCreateLs(lsSpec.QuicConfig) + + if len(lsSpec.DefaultActions) == 0 { + return nil, fmt.Errorf("empty listener default actions: %v", lsSpec.DefaultActions) + } + defaultActions, err := transModelActionToSDKCreateLs(lsSpec.DefaultActions) + if err != nil { + return nil, err + } + if len(*defaultActions) == 0 { + return nil, fmt.Errorf("empty listener default actions: %v", *defaultActions) + } + createLsReq.DefaultActions = defaultActions + + createLsReq.XForwardedForConfig = transSDKXForwardedForConfigToCreateLs(lsSpec.XForwardedForConfig) + + if isHTTPSListenerProtocol(lsSpec.ListenerProtocol) { + if len(lsSpec.SecurityPolicyId) == 0 { + return nil, fmt.Errorf("invalid https listener SecurityPolicyId: %s", lsSpec.SecurityPolicyId) + } + createLsReq.SecurityPolicyId = lsSpec.SecurityPolicyId + + createLsReq.CaCertificates = transSDKCaCertificatesToCreateLs(lsSpec.CaCertificates) + + if len(lsSpec.Certificates) == 0 { + return nil, fmt.Errorf("empty https listener default certs ") + } + defaultCerts, _ := buildSDKCertificates(lsSpec.Certificates) + if len(defaultCerts) != 1 { + return nil, fmt.Errorf("empty https listener default certs") + } + createLsReq.Certificates = transSDKCertificatesToCreateLs(defaultCerts) + + createLsReq.Http2Enabled = requests.NewBoolean(lsSpec.Http2Enabled) + } + + return createLsReq, nil +} + +func (m *ALBProvider) updateListenerExtraCertificates(ctx context.Context, lsID string, resLs *albmodel.Listener) error { + traceID := ctx.Value(util.TraceID) + + desiredExtraCertIDs := sets.NewString() + _, desiredExtraCerts := buildSDKCertificates(resLs.Spec.Certificates) + for _, cert := range desiredExtraCerts { + desiredExtraCertIDs.Insert(cert.CertificateId) + } + + currentExtraCertIDs := sets.NewString() + _, currentExtraCerts := buildSDKCertificatesModel(m.sdkCerts) + for _, cert := range currentExtraCerts { + currentExtraCertIDs.Insert(cert.CertificateId) + } + + unmatchedResCerts := desiredExtraCertIDs.Difference(currentExtraCertIDs).List() + if len(unmatchedResCerts) != 0 { + certs := make([]albsdk.Certificate, 0) + for _, unmatchedResCert := range unmatchedResCerts { + certs = append(certs, albsdk.Certificate{ + CertificateId: unmatchedResCert, + }) + } + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("associating additional certificates to listener", + "stackID", resLs.Stack().StackID(), + "resourceID", resLs.ID(), + "listenerID", lsID, + "traceID", traceID, + "certificates", certs, + "startTime", startTime, + util.Action, util.AssociateALBAdditionalCertificatesWithListener) + resp, err := m.AssociateALBAdditionalCertificatesWithListener(lsID, certs) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("associating additional certificates to listener", + "stackID", resLs.Stack().StackID(), + "resourceID", resLs.ID(), + "listenerID", lsID, + "traceID", traceID, + "error", err.Error(), + util.Action, util.AssociateALBAdditionalCertificatesWithListener) + return err + } + m.logger.V(util.MgrLogLevel).Info("associated additional certificates to listener", + "stackID", resLs.Stack().StackID(), + "resourceID", resLs.ID(), + "listenerID", lsID, + "traceID", traceID, + "certificates", certs, + "requestID", resp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.AssociateALBAdditionalCertificatesWithListener) + } + + unmatchedSDKCerts := currentExtraCertIDs.Difference(desiredExtraCertIDs).List() + if len(unmatchedSDKCerts) != 0 { + certs := make([]albsdk.Certificate, 0) + for _, unmatchedSDKCert := range unmatchedSDKCerts { + certs = append(certs, albsdk.Certificate{ + CertificateId: unmatchedSDKCert, + }) + } + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("dissociating additional certificates from listener", + "stackID", resLs.Stack().StackID(), + "resourceID", resLs.ID(), + "listenerID", lsID, + "traceID", traceID, + "certificates", certs, + "startTime", startTime, + util.Action, util.DissociateALBAdditionalCertificatesFromListener) + resp, err := m.DissociateALBAdditionalCertificatesFromListener(lsID, certs) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("dissociated additional certificates from listener", + "stackID", resLs.Stack().StackID(), + "resourceID", resLs.ID(), + "listenerID", lsID, + "traceID", traceID, + "certificates", certs, + "requestID", resp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DissociateALBAdditionalCertificatesFromListener) + } + return nil +} + +func (m *ALBProvider) updateListenerAttribute(ctx context.Context, resLS *albmodel.Listener, sdkLs *albsdk.Listener) error { + traceID := ctx.Value(util.TraceID) + + var ( + isGzipEnabledNeedUpdate, + isQuicConfigUpdate, + isHttp2EnabledNeedUpdate, + isDefaultActionsNeedUpdate, + isRequestTimeoutNeedUpdate, + isXForwardedForConfigNeedUpdate, + isSecurityPolicyIdNeedUpdate, + isIdleTimeoutNeedUpdate, + isListenerDescriptionNeedUpdate, + isCertificatesNeedUpdate bool + ) + + if resLS.Spec.GzipEnabled != sdkLs.GzipEnabled { + m.logger.V(util.MgrLogLevel).Info("GzipEnabled update", + "res", resLS.Spec.GzipEnabled, + "sdk", sdkLs.GzipEnabled, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isGzipEnabledNeedUpdate = true + } + quicConfig := transQuicConfigToSDK(resLS.Spec.QuicConfig) + if quicConfig != sdkLs.QuicConfig { + m.logger.V(util.MgrLogLevel).Info("QuicConfig update", + "res", resLS.Spec.QuicConfig, + "sdk", sdkLs.QuicConfig, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isQuicConfigUpdate = true + } + if len(resLS.Spec.DefaultActions) == 0 { + return fmt.Errorf("empty listener default action: %v", resLS.Spec.DefaultActions) + } + resAction, err := transModelActionsToSDKLs(resLS.Spec.DefaultActions) + if err != nil { + return err + } + if len(*resAction) == 0 { + return fmt.Errorf("empty listener default action: %v", *resAction) + } + if !reflect.DeepEqual((*resAction)[0], sdkLs.DefaultActions[0]) { + m.logger.V(util.MgrLogLevel).Info("DefaultActions update", + "res", (*resAction)[0], + "sdk", sdkLs.DefaultActions[0], + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isDefaultActionsNeedUpdate = true + } + + if !isListenerRequestTimeoutValid(resLS.Spec.RequestTimeout) { + return fmt.Errorf("invalid listener RequestTimeout: %d", resLS.Spec.RequestTimeout) + } + if resLS.Spec.RequestTimeout != sdkLs.RequestTimeout { + m.logger.V(util.MgrLogLevel).Info("RequestTimeout update", + "res", resLS.Spec.RequestTimeout, + "sdk", sdkLs.RequestTimeout, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isRequestTimeoutNeedUpdate = true + } + xForwardedForConfig := transXForwardedForConfigToSDK(resLS.Spec.XForwardedForConfig) + if xForwardedForConfig != sdkLs.XForwardedForConfig { + m.logger.V(util.MgrLogLevel).Info("XForwardedForConfig update", + "res", resLS.Spec.XForwardedForConfig, + "sdk", sdkLs.XForwardedForConfig, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isXForwardedForConfigNeedUpdate = true + } + + if !isListenerIdleTimeoutValid(resLS.Spec.IdleTimeout) { + return fmt.Errorf("invalid listener IdleTimeout: %d", resLS.Spec.IdleTimeout) + } + if resLS.Spec.IdleTimeout != sdkLs.IdleTimeout { + m.logger.V(util.MgrLogLevel).Info("IdleTimeout update", + "res", resLS.Spec.IdleTimeout, + "sdk", sdkLs.IdleTimeout, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isIdleTimeoutNeedUpdate = true + } + if resLS.Spec.ListenerDescription != sdkLs.ListenerDescription { + m.logger.V(util.MgrLogLevel).Info("ListenerDescription update", + "res", resLS.Spec.ListenerDescription, + "sdk", sdkLs.ListenerDescription, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isListenerDescriptionNeedUpdate = true + } + + if isHTTPSListenerProtocol(sdkLs.ListenerProtocol) { + if len(resLS.Spec.SecurityPolicyId) == 0 { + return fmt.Errorf("invalid https listener SecurityPolicyId: %s", resLS.Spec.SecurityPolicyId) + } + if resLS.Spec.SecurityPolicyId != sdkLs.SecurityPolicyId { + m.logger.V(util.MgrLogLevel).Info("SecurityPolicyId update", + "res", resLS.Spec.SecurityPolicyId, + "sdk", sdkLs.SecurityPolicyId, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isSecurityPolicyIdNeedUpdate = true + } + + desiredDefaultCerts, _ := buildSDKCertificates(resLS.Spec.Certificates) + if len(desiredDefaultCerts) != 1 { + return fmt.Errorf("invalid res https listener default certs len: %d", len(desiredDefaultCerts)) + } + currentDefaultCerts, _ := buildSDKCertificatesModel(m.sdkCerts) + if len(currentDefaultCerts) != 1 { + return fmt.Errorf("invalid sdk https listener default certs len: %d", len(currentDefaultCerts)) + } + if desiredDefaultCerts[0].CertificateId != currentDefaultCerts[0].CertificateId { + m.logger.V(util.MgrLogLevel).Info("DefaultCerts update", + "res", desiredDefaultCerts[0], + "sdk", currentDefaultCerts[0], + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isCertificatesNeedUpdate = true + } + + if resLS.Spec.Http2Enabled != sdkLs.Http2Enabled { + m.logger.V(util.MgrLogLevel).Info("Http2Enabled update", + "res", resLS.Spec.Http2Enabled, + "sdk", sdkLs.Http2Enabled, + "listenerID", sdkLs.ListenerId, + "traceID", traceID) + isHttp2EnabledNeedUpdate = true + } + } + + if !isGzipEnabledNeedUpdate && !isQuicConfigUpdate && !isHttp2EnabledNeedUpdate && + !isDefaultActionsNeedUpdate && !isRequestTimeoutNeedUpdate && !isXForwardedForConfigNeedUpdate && + !isSecurityPolicyIdNeedUpdate && !isIdleTimeoutNeedUpdate && !isListenerDescriptionNeedUpdate && + !isCertificatesNeedUpdate { + return nil + } + + updateLsReq := albsdk.CreateUpdateListenerAttributeRequest() + updateLsReq.ListenerId = sdkLs.ListenerId + + if isGzipEnabledNeedUpdate { + updateLsReq.GzipEnabled = requests.NewBoolean(resLS.Spec.GzipEnabled) + } + if isQuicConfigUpdate { + updateLsReq.QuicConfig = transSDKQuicConfigToUpdateLs(resLS.Spec.QuicConfig) + } + if isHttp2EnabledNeedUpdate { + updateLsReq.Http2Enabled = requests.NewBoolean(resLS.Spec.Http2Enabled) + } + if isDefaultActionsNeedUpdate { + defaultAction, err := transModelActionToSDKUpdateLs(resLS.Spec.DefaultActions) + if err != nil { + return err + } + updateLsReq.DefaultActions = defaultAction + } + if isRequestTimeoutNeedUpdate { + updateLsReq.RequestTimeout = requests.NewInteger(resLS.Spec.RequestTimeout) + } + if isXForwardedForConfigNeedUpdate { + updateLsReq.XForwardedForConfig = transSDKXForwardedForConfigToUpdateLs(resLS.Spec.XForwardedForConfig) + } + if isSecurityPolicyIdNeedUpdate { + updateLsReq.SecurityPolicyId = resLS.Spec.SecurityPolicyId + } + if isIdleTimeoutNeedUpdate { + updateLsReq.IdleTimeout = requests.NewInteger(resLS.Spec.IdleTimeout) + } + if isListenerDescriptionNeedUpdate { + updateLsReq.ListenerDescription = resLS.Spec.ListenerDescription + } + if isCertificatesNeedUpdate { + updateLsReq.Certificates = transSDKCertificatesToUpdateLs(resLS.Spec.Certificates) + } + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("updating listener attribute", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerID", sdkLs.ListenerId, + "startTime", startTime, + util.Action, util.UpdateALBListenerAttribute) + updateLsResp, err := m.auth.ALB.UpdateListenerAttribute(updateLsReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("updated listener attribute", + "stackID", resLS.Stack().StackID(), + "resourceID", resLS.ID(), + "traceID", traceID, + "listenerID", sdkLs.ListenerId, + "requestID", updateLsResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.UpdateALBListenerAttribute) + + return nil +} + +func transModelActionToSDKCreateLs(actions []albmodel.Action) (*[]albsdk.CreateListenerDefaultActions, error) { + createLsActions := make([]albsdk.CreateListenerDefaultActions, 0) + for _, action := range actions { + sgTuples, err := transModelServerGroupTupleToSDKCreateLs(action.ForwardConfig.ServerGroups) + if err != nil { + return nil, err + } + createLsAction := albsdk.CreateListenerDefaultActions{ + ForwardGroupConfig: albsdk.CreateListenerDefaultActionsForwardGroupConfig{ + ServerGroupTuples: sgTuples, + }, + Type: action.Type, + } + createLsActions = append(createLsActions, createLsAction) + } + return &createLsActions, nil +} + +func transModelActionToSDKUpdateLs(actions []albmodel.Action) (*[]albsdk.UpdateListenerAttributeDefaultActions, error) { + updateLsActions := make([]albsdk.UpdateListenerAttributeDefaultActions, 0) + + for _, action := range actions { + sgTuples, err := transModelServerGroupTupleToSDKUpdateLs(action.ForwardConfig.ServerGroups) + if err != nil { + return nil, err + } + updateLsAction := albsdk.UpdateListenerAttributeDefaultActions{ + ForwardGroupConfig: albsdk.UpdateListenerAttributeDefaultActionsForwardGroupConfig{ + ServerGroupTuples: sgTuples, + }, + Type: action.Type, + } + updateLsActions = append(updateLsActions, updateLsAction) + } + return &updateLsActions, nil +} + +func transModelServerGroupTuplesToSDKLs(ms []albmodel.ServerGroupTuple) (*[]albsdk.ServerGroupTuple, error) { + var updateRuleServerGroupTuples []albsdk.ServerGroupTuple + if len(ms) != 0 { + updateRuleServerGroupTuples = make([]albsdk.ServerGroupTuple, 0) + for _, m := range ms { + serverGroupID, err := m.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + updateRuleServerGroupTuples = append(updateRuleServerGroupTuples, albsdk.ServerGroupTuple{ + ServerGroupId: serverGroupID, + }) + } + } + return &updateRuleServerGroupTuples, nil +} + +func transModelActionsToSDKLs(actions []albmodel.Action) (*[]albsdk.DefaultAction, error) { + lsActions := make([]albsdk.DefaultAction, 0) + + for _, action := range actions { + sgTuples, err := transModelServerGroupTuplesToSDKLs(action.ForwardConfig.ServerGroups) + if err != nil { + return nil, err + } + updateLsAction := albsdk.DefaultAction{ + ForwardGroupConfig: albsdk.ForwardGroupConfig{ + ServerGroupTuples: *sgTuples, + }, + Type: action.Type, + } + lsActions = append(lsActions, updateLsAction) + } + return &lsActions, nil +} + +func transModelServerGroupTupleToSDKCreateLs(serverGroupTuples []albmodel.ServerGroupTuple) (*[]albsdk.CreateListenerDefaultActionsForwardGroupConfigServerGroupTuplesItem, error) { + createLsServerGroupTuples := make([]albsdk.CreateListenerDefaultActionsForwardGroupConfigServerGroupTuplesItem, 0) + + for _, serverGroupTuple := range serverGroupTuples { + serverGroupID, err := serverGroupTuple.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + createServerGroupTuple := albsdk.CreateListenerDefaultActionsForwardGroupConfigServerGroupTuplesItem{ + ServerGroupId: serverGroupID, + } + createLsServerGroupTuples = append(createLsServerGroupTuples, createServerGroupTuple) + } + return &createLsServerGroupTuples, nil +} + +func transModelServerGroupTupleToSDKUpdateLs(serverGroupTuples []albmodel.ServerGroupTuple) (*[]albsdk.UpdateListenerAttributeDefaultActionsForwardGroupConfigServerGroupTuplesItem, error) { + updateLsServerGroupTuples := make([]albsdk.UpdateListenerAttributeDefaultActionsForwardGroupConfigServerGroupTuplesItem, 0) + + for _, serverGroupTuple := range serverGroupTuples { + serverGroupID, err := serverGroupTuple.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + createServerGroupTuple := albsdk.UpdateListenerAttributeDefaultActionsForwardGroupConfigServerGroupTuplesItem{ + ServerGroupId: serverGroupID, + } + updateLsServerGroupTuples = append(updateLsServerGroupTuples, createServerGroupTuple) + } + return &updateLsServerGroupTuples, nil +} + +func transSDKQuicConfigToCreateLs(c albmodel.QuicConfig) albsdk.CreateListenerQuicConfig { + return albsdk.CreateListenerQuicConfig{ + QuicUpgradeEnabled: strconv.FormatBool(c.QuicUpgradeEnabled), + QuicListenerId: c.QuicListenerId, + } +} +func transQuicConfigToSDK(c albmodel.QuicConfig) albsdk.QuicConfig { + return albsdk.QuicConfig{ + QuicUpgradeEnabled: c.QuicUpgradeEnabled, + QuicListenerId: c.QuicListenerId, + } +} +func transSDKQuicConfigToUpdateLs(c albmodel.QuicConfig) albsdk.UpdateListenerAttributeQuicConfig { + return albsdk.UpdateListenerAttributeQuicConfig{ + QuicUpgradeEnabled: strconv.FormatBool(c.QuicUpgradeEnabled), + QuicListenerId: c.QuicListenerId, + } +} + +func transSDKCaCertificatesToCreateLs(certificates []albmodel.Certificate) *[]albsdk.CreateListenerCaCertificates { + createListenerAttributeCaCertificates := make([]albsdk.CreateListenerCaCertificates, 0) + for _, certificate := range certificates { + createListenerAttributeCaCertificates = append(createListenerAttributeCaCertificates, albsdk.CreateListenerCaCertificates{ + CertificateId: certificate.CertificateId, + }) + } + return &createListenerAttributeCaCertificates +} + +func transSDKCertificatesToCreateLs(certificates []albsdk.Certificate) *[]albsdk.CreateListenerCertificates { + createListenerAttributeCertificates := make([]albsdk.CreateListenerCertificates, 0) + for _, certificate := range certificates { + createListenerAttributeCertificates = append(createListenerAttributeCertificates, albsdk.CreateListenerCertificates{ + CertificateId: certificate.CertificateId, + }) + } + return &createListenerAttributeCertificates +} + +func transSDKCertificatesToUpdateLs(certificates []albmodel.Certificate) *[]albsdk.UpdateListenerAttributeCertificates { + updateListenerAttributeCertificates := make([]albsdk.UpdateListenerAttributeCertificates, 0) + for _, certificate := range certificates { + updateListenerAttributeCertificates = append(updateListenerAttributeCertificates, albsdk.UpdateListenerAttributeCertificates{ + CertificateId: certificate.CertificateId, + }) + } + return &updateListenerAttributeCertificates +} + +func transSDKXForwardedForConfigToCreateLs(c albmodel.XForwardedForConfig) albsdk.CreateListenerXForwardedForConfig { + return albsdk.CreateListenerXForwardedForConfig{ + XForwardedForClientCertSubjectDNAlias: c.XForwardedForClientCertIssuerDNAlias, + XForwardedForClientCertIssuerDNEnabled: strconv.FormatBool(c.XForwardedForClientCertIssuerDNEnabled), + XForwardedForClientCertFingerprintEnabled: strconv.FormatBool(c.XForwardedForClientCertFingerprintEnabled), + XForwardedForClientCertIssuerDNAlias: c.XForwardedForClientCertIssuerDNAlias, + XForwardedForProtoEnabled: strconv.FormatBool(c.XForwardedForProtoEnabled), + XForwardedForClientCertFingerprintAlias: c.XForwardedForClientCertFingerprintAlias, + XForwardedForClientCertClientVerifyEnabled: strconv.FormatBool(c.XForwardedForClientCertClientVerifyEnabled), + XForwardedForSLBPortEnabled: strconv.FormatBool(c.XForwardedForSLBPortEnabled), + XForwardedForClientCertSubjectDNEnabled: strconv.FormatBool(c.XForwardedForClientCertSubjectDNEnabled), + XForwardedForClientCertClientVerifyAlias: c.XForwardedForClientCertClientVerifyAlias, + XForwardedForClientSrcPortEnabled: strconv.FormatBool(c.XForwardedForClientSrcPortEnabled), + XForwardedForEnabled: strconv.FormatBool(c.XForwardedForEnabled), + XForwardedForSLBIdEnabled: strconv.FormatBool(c.XForwardedForSLBIdEnabled), + } +} + +func transXForwardedForConfigToSDK(c albmodel.XForwardedForConfig) albsdk.XForwardedForConfig { + return albsdk.XForwardedForConfig{ + XForwardedForClientCertSubjectDNAlias: c.XForwardedForClientCertIssuerDNAlias, + XForwardedForClientCertIssuerDNEnabled: c.XForwardedForClientCertIssuerDNEnabled, + XForwardedForClientCertFingerprintEnabled: c.XForwardedForClientCertFingerprintEnabled, + XForwardedForClientCertIssuerDNAlias: c.XForwardedForClientCertIssuerDNAlias, + XForwardedForProtoEnabled: c.XForwardedForProtoEnabled, + XForwardedForClientCertFingerprintAlias: c.XForwardedForClientCertFingerprintAlias, + XForwardedForClientCertClientVerifyEnabled: c.XForwardedForClientCertClientVerifyEnabled, + XForwardedForSLBPortEnabled: c.XForwardedForSLBPortEnabled, + XForwardedForClientCertSubjectDNEnabled: c.XForwardedForClientCertSubjectDNEnabled, + XForwardedForClientCertClientVerifyAlias: c.XForwardedForClientCertClientVerifyAlias, + XForwardedForClientSrcPortEnabled: c.XForwardedForClientSrcPortEnabled, + XForwardedForEnabled: c.XForwardedForEnabled, + XForwardedForSLBIdEnabled: c.XForwardedForSLBIdEnabled, + } +} + +func transSDKXForwardedForConfigToUpdateLs(c albmodel.XForwardedForConfig) albsdk.UpdateListenerAttributeXForwardedForConfig { + return albsdk.UpdateListenerAttributeXForwardedForConfig{ + XForwardedForClientCertSubjectDNAlias: c.XForwardedForClientCertIssuerDNAlias, + XForwardedForClientCertIssuerDNEnabled: strconv.FormatBool(c.XForwardedForClientCertIssuerDNEnabled), + XForwardedForClientCertFingerprintEnabled: strconv.FormatBool(c.XForwardedForClientCertFingerprintEnabled), + XForwardedForClientCertIssuerDNAlias: c.XForwardedForClientCertIssuerDNAlias, + XForwardedForProtoEnabled: strconv.FormatBool(c.XForwardedForProtoEnabled), + XForwardedForClientCertFingerprintAlias: c.XForwardedForClientCertFingerprintAlias, + XForwardedForClientCertClientVerifyEnabled: strconv.FormatBool(c.XForwardedForClientCertClientVerifyEnabled), + XForwardedForSLBPortEnabled: strconv.FormatBool(c.XForwardedForSLBPortEnabled), + XForwardedForClientCertSubjectDNEnabled: strconv.FormatBool(c.XForwardedForClientCertSubjectDNEnabled), + XForwardedForClientCertClientVerifyAlias: c.XForwardedForClientCertClientVerifyAlias, + XForwardedForClientSrcPortEnabled: strconv.FormatBool(c.XForwardedForClientSrcPortEnabled), + XForwardedForEnabled: strconv.FormatBool(c.XForwardedForEnabled), + XForwardedForSLBIdEnabled: strconv.FormatBool(c.XForwardedForSLBIdEnabled), + } +} + +func buildSDKCertificatesModel(modelCerts []albsdk.CertificateModel) ([]albsdk.CertificateModel, []albsdk.CertificateModel) { + if len(modelCerts) == 0 { + return nil, nil + } + + var defaultSDKCerts []albsdk.CertificateModel + var extraSDKCerts []albsdk.CertificateModel + for _, cert := range modelCerts { + if cert.IsDefault { + defaultSDKCerts = append(defaultSDKCerts, cert) + } else { + extraSDKCerts = append(extraSDKCerts, cert) + } + } + return defaultSDKCerts, extraSDKCerts +} + +func buildSDKCertificates(modelCerts []albmodel.Certificate) ([]albsdk.Certificate, []albsdk.Certificate) { + if len(modelCerts) == 0 { + return nil, nil + } + + var defaultSDKCerts []albsdk.Certificate + var extraSDKCerts []albsdk.Certificate + for _, cert := range modelCerts { + if cert.IsDefault { + defaultSDKCerts = append(defaultSDKCerts, albsdk.Certificate{ + IsDefault: cert.IsDefault, + CertificateId: cert.CertificateId, + Status: cert.Status, + }) + } else { + extraSDKCerts = append(extraSDKCerts, albsdk.Certificate{ + IsDefault: cert.IsDefault, + CertificateId: cert.CertificateId, + Status: cert.Status, + }) + } + } + return defaultSDKCerts, extraSDKCerts +} + +func isIncorrectStatusLoadBalancerError(err error) bool { + if strings.Contains(err.Error(), "IncorrectStatus.LoadBalancer") { + return true + } + return false +} + +func isIncorrectStatusListenerError(err error) bool { + if strings.Contains(err.Error(), "IncorrectStatus.Listener") { + return true + } + return false +} + +func isHTTPSListenerProtocol(protocol string) bool { + return strings.EqualFold(protocol, util.ListenerProtocolHTTPS) +} + +func isListenerProtocolValid(protocol string) bool { + if strings.EqualFold(protocol, util.ListenerProtocolHTTP) || + strings.EqualFold(protocol, util.ListenerProtocolHTTPS) || + strings.EqualFold(protocol, util.ListenerProtocolQUIC) { + return true + } + return false +} + +func isListenerPortValid(port int) bool { + if port < 1 || port > 65535 { + return false + } + return true +} + +func isListenerRequestTimeoutValid(requestTimeout int) bool { + if requestTimeout < 1 || requestTimeout > 180 { + return false + } + return true +} + +func isListenerIdleTimeoutValid(idleTimeout int) bool { + if idleTimeout < 1 || idleTimeout > 60 { + return false + } + return true +} + +func buildResListenerStatus(lsID string) albmodel.ListenerStatus { + return albmodel.ListenerStatus{ + ListenerID: lsID, + } +} diff --git a/pkg/provider/alibaba/alb/rule.go b/pkg/provider/alibaba/alb/rule.go new file mode 100644 index 000000000..aa9995145 --- /dev/null +++ b/pkg/provider/alibaba/alb/rule.go @@ -0,0 +1,1441 @@ +package alb + +import ( + "context" + "fmt" + "reflect" + "strconv" + "strings" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/pkg/errors" +) + +func (m *ALBProvider) CreateALBListenerRule(ctx context.Context, resLR *alb.ListenerRule) (alb.ListenerRuleStatus, error) { + traceID := ctx.Value(util.TraceID) + + createRuleReq, err := buildSDKCreateListenerRuleRequest(resLR.Spec) + if err != nil { + return alb.ListenerRuleStatus{}, err + } + + var createRuleResp *albsdk.CreateRuleResponse + if err := util.RetryImmediateOnError(m.waitLSExistencePollInterval, m.waitLSExistenceTimeout, isVipStatusNotSupportError, func() error { + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("creating rule", + "stackID", resLR.Stack().StackID(), + "resourceID", resLR.ID(), + "listenerID", createRuleReq.ListenerId, + "traceID", traceID, + "startTime", startTime, + util.Action, util.CreateALBRule) + createRuleResp, err = m.auth.ALB.CreateRule(createRuleReq) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("creating rule", + "stackID", resLR.Stack().StackID(), + "resourceID", resLR.ID(), + "listenerID", createRuleReq.ListenerId, + "traceID", traceID, + "error", err.Error(), + util.Action, util.CreateALBRule) + return err + } + m.logger.V(util.MgrLogLevel).Info("created rule", + "stackID", resLR.Stack().StackID(), + "resourceID", resLR.ID(), + "listenerID", createRuleReq.ListenerId, + "traceID", traceID, + "ruleID", createRuleResp.RuleId, + "requestID", createRuleResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.CreateALBRule) + return nil + }); err != nil { + return alb.ListenerRuleStatus{}, errors.Wrap(err, "failed to create listener rule") + } + + return buildResListenerRuleStatus(createRuleResp.RuleId), nil +} + +func (m *ALBProvider) UpdateALBListenerRule(ctx context.Context, resLR *alb.ListenerRule, sdkLR *albsdk.Rule) (alb.ListenerRuleStatus, error) { + updateAnalyzer := new(ListenerRuleUpdateAnalyzer) + if err := updateAnalyzer.analysis(ctx, resLR, sdkLR); err != nil { + return alb.ListenerRuleStatus{}, err + } + if !updateAnalyzer.needUpdate { + return buildResListenerRuleStatus(sdkLR.RuleId), nil + } + + _, err := m.updateALBRuleAttribute(ctx, resLR, sdkLR, *updateAnalyzer) + if err != nil { + return alb.ListenerRuleStatus{}, err + } + + return buildResListenerRuleStatus(sdkLR.RuleId), nil +} + +func (m *ALBProvider) DeleteALBListenerRule(ctx context.Context, sdkLRId string) error { + traceID := ctx.Value(util.TraceID) + + deleteRuleReq := albsdk.CreateDeleteRuleRequest() + deleteRuleReq.RuleId = sdkLRId + + if err := util.RetryImmediateOnError(m.waitLSExistencePollInterval, m.waitLSExistenceTimeout, isVipStatusNotSupportError, func() error { + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("deleting rule", + "ruleID", sdkLRId, + "traceID", traceID, + "startTime", startTime, + util.Action, util.DeleteALBRule) + deleteRuleResp, err := m.auth.ALB.DeleteRule(deleteRuleReq) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("deleting rule", + "ruleID", sdkLRId, + "traceID", traceID, + "error", err.Error(), + util.Action, util.DeleteALBRule) + return err + } + m.logger.V(util.MgrLogLevel).Info("deleted rule", + "ruleID", sdkLRId, + "traceID", traceID, + "requestID", deleteRuleResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DeleteALBRule) + return nil + }); err != nil { + return errors.Wrap(err, "failed to delete listener rule") + } + + return nil +} + +func (m *ALBProvider) ListALBListenerRules(ctx context.Context, lsID string) ([]albsdk.Rule, error) { + traceID := ctx.Value(util.TraceID) + + if len(lsID) == 0 { + return nil, fmt.Errorf("invalid listener id: %s for listing rules", lsID) + } + + var ( + nextToken string + rules []albsdk.Rule + ) + + listRuleReq := albsdk.CreateListRulesRequest() + listRuleReq.ListenerId = lsID + + for { + listRuleReq.NextToken = nextToken + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("listing rules", + "listenerID", lsID, + "traceID", traceID, + "startTime", startTime, + util.Action, util.ListALBRules) + listRuleResp, err := m.auth.ALB.ListRules(listRuleReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("listed rules", + "listenerID", lsID, + "traceID", traceID, + "requestID", listRuleResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ListALBRules) + + rules = append(rules, listRuleResp.Rules...) + + if listRuleResp.NextToken == "" { + break + } else { + nextToken = listRuleResp.NextToken + } + } + + return rules, nil +} + +func (m *ALBProvider) updateALBRuleAttribute(ctx context.Context, resLR *alb.ListenerRule, sdkLR *albsdk.Rule, judger ListenerRuleUpdateAnalyzer) (*albsdk.UpdateRuleAttributeResponse, error) { + traceID := ctx.Value(util.TraceID) + + ruleReq := albsdk.CreateUpdateRuleAttributeRequest() + ruleReq.RuleId = sdkLR.RuleId + + if judger.ruleNameNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("RuleName update", + "res", resLR.Spec.RuleName, + "sdk", sdkLR.RuleName, + "ruleID", sdkLR.RuleId, + "traceID", traceID) + ruleReq.RuleName = resLR.Spec.RuleName + } + if judger.ruleActionsNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("Actions update", + "res", resLR.Spec.RuleActions, + "sdk", sdkLR.RuleActions, + "ruleID", sdkLR.RuleId, + "traceID", traceID) + actions, err := transModelActionsToSDKUpdateRule(resLR.Spec.RuleActions) + if err != nil { + return nil, err + } + ruleReq.RuleActions = actions + } + if judger.ruleConditionsNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("Conditions update", + "res", resLR.Spec.RuleConditions, + "sdk", sdkLR.RuleConditions, + "ruleID", sdkLR.RuleId, + "traceID", traceID) + ruleReq.RuleConditions = transSDKConditionsToUpdateRule(resLR.Spec.RuleConditions) + } + if judger.priorityNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("Priority update", + "res", resLR.Spec.Priority, + "sdk", sdkLR.Priority, + "ruleID", sdkLR.RuleId, + "traceID", traceID) + ruleReq.Priority = requests.NewInteger(resLR.Spec.Priority) + } + + var updateRuleResp *albsdk.UpdateRuleAttributeResponse + if err := util.RetryImmediateOnError(m.waitLSExistencePollInterval, m.waitLSExistenceTimeout, isVipStatusNotSupportError, func() error { + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("updating rule attribute", + "stackID", resLR.Stack().StackID(), + "resourceID", resLR.ID(), + "traceID", traceID, + "ruleID", sdkLR.RuleId, + "startTime", startTime, + util.Action, util.UpdateALBRuleAttribute) + var err error + updateRuleResp, err = m.auth.ALB.UpdateRuleAttribute(ruleReq) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("updating rule attribute", + "stackID", resLR.Stack().StackID(), + "resourceID", resLR.ID(), + "traceID", traceID, + "ruleID", sdkLR.RuleId, + "error", err.Error(), + "requestID", updateRuleResp.RequestId, + "startTime", startTime, + util.Action, util.UpdateALBRuleAttribute) + return err + } + m.logger.V(util.MgrLogLevel).Info("updated rule attribute", + "stackID", resLR.Stack().StackID(), + "resourceID", resLR.ID(), + "traceID", traceID, + "ruleID", sdkLR.RuleId, + "requestID", updateRuleResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.UpdateALBRuleAttribute) + return nil + }); err != nil { + return nil, errors.Wrap(err, "failed to update listener rule") + } + + return updateRuleResp, nil +} + +func transModelServerGroupTuplesToSDKCreateRules(sgpTuples []alb.ServerGroupTuple) (*[]albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem, error) { + var createRulesServerGroupTuples []albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem + if len(sgpTuples) != 0 { + createRulesServerGroupTuples = make([]albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem, 0) + for _, m := range sgpTuples { + serverGroupID, err := m.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + createRulesServerGroupTuples = append(createRulesServerGroupTuples, albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem{ + ServerGroupId: serverGroupID, + Weight: strconv.Itoa(m.Weight), + }) + } + } + return &createRulesServerGroupTuples, nil +} +func transModelServerGroupTuplesToSDKUpdateRules(sgpTuples []alb.ServerGroupTuple) (*[]albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem, error) { + var updateRulesServerGroupTuples []albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem + if len(sgpTuples) != 0 { + updateRulesServerGroupTuples = make([]albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem, 0) + for _, m := range sgpTuples { + serverGroupID, err := m.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + updateRulesServerGroupTuples = append(updateRulesServerGroupTuples, albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem{ + ServerGroupId: serverGroupID, + Weight: strconv.Itoa(m.Weight), + }) + } + } + return &updateRulesServerGroupTuples, nil +} +func transModelServerGroupTuplesToSDKCreateRule(sgpTuples []alb.ServerGroupTuple) (*[]albsdk.CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem, error) { + var createRuleServerGroupTuples []albsdk.CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem + if len(sgpTuples) != 0 { + createRuleServerGroupTuples = make([]albsdk.CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem, 0) + for _, m := range sgpTuples { + serverGroupID, err := m.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + createRuleServerGroupTuples = append(createRuleServerGroupTuples, albsdk.CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem{ + ServerGroupId: serverGroupID, + Weight: strconv.Itoa(m.Weight), + }) + } + } + return &createRuleServerGroupTuples, nil +} +func transModelServerGroupTuplesToSDKUpdateRule(sgpTuples []alb.ServerGroupTuple) (*[]albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem, error) { + var updateRuleServerGroupTuples []albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem + if len(sgpTuples) != 0 { + updateRuleServerGroupTuples = make([]albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem, 0) + for _, m := range sgpTuples { + serverGroupID, err := m.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + updateRuleServerGroupTuples = append(updateRuleServerGroupTuples, albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem{ + ServerGroupId: serverGroupID, + Weight: strconv.Itoa(m.Weight), + }) + } + } + return &updateRuleServerGroupTuples, nil +} +func transModelServerGroupTuplesToSDKRule(sgpTuples []alb.ServerGroupTuple) (*[]albsdk.ServerGroupTuple, error) { + var sdkServerGroupTuples []albsdk.ServerGroupTuple + if len(sgpTuples) != 0 { + sdkServerGroupTuples = make([]albsdk.ServerGroupTuple, 0) + for _, m := range sgpTuples { + serverGroupID, err := m.ServerGroupID.Resolve(context.Background()) + if err != nil { + return nil, err + } + sdkServerGroupTuples = append(sdkServerGroupTuples, albsdk.ServerGroupTuple{ + ServerGroupId: serverGroupID, + Weight: m.Weight, + }) + } + } + return &sdkServerGroupTuples, nil +} +func transSDKFixedResponseConfigToCreateRules(fixedRespConf alb.FixedResponseConfig) albsdk.CreateRulesRulesRuleActionsItemFixedResponseConfig { + return albsdk.CreateRulesRulesRuleActionsItemFixedResponseConfig{ + HttpCode: fixedRespConf.HttpCode, + Content: fixedRespConf.Content, + ContentType: fixedRespConf.ContentType, + } +} +func transSDKFixedResponseConfigToUpdateRules(fixedRespConf alb.FixedResponseConfig) albsdk.UpdateRulesAttributeRulesRuleActionsItemFixedResponseConfig { + return albsdk.UpdateRulesAttributeRulesRuleActionsItemFixedResponseConfig{ + HttpCode: fixedRespConf.HttpCode, + Content: fixedRespConf.Content, + ContentType: fixedRespConf.ContentType, + } +} +func transSDKFixedResponseConfigToCreateRule(fixedRespConf alb.FixedResponseConfig) albsdk.CreateRuleRuleActionsFixedResponseConfig { + return albsdk.CreateRuleRuleActionsFixedResponseConfig{ + HttpCode: fixedRespConf.HttpCode, + Content: fixedRespConf.Content, + ContentType: fixedRespConf.ContentType, + } +} +func transSDKFixedResponseConfigToUpdateRule(fixedRespConf alb.FixedResponseConfig) albsdk.UpdateRuleAttributeRuleActionsFixedResponseConfig { + return albsdk.UpdateRuleAttributeRuleActionsFixedResponseConfig{ + HttpCode: fixedRespConf.HttpCode, + Content: fixedRespConf.Content, + ContentType: fixedRespConf.ContentType, + } +} +func transSDKRedirectConfigToCreateRules(redirectConf alb.RedirectConfig) albsdk.CreateRulesRulesRuleActionsItemRedirectConfig { + return albsdk.CreateRulesRulesRuleActionsItemRedirectConfig{ + Path: redirectConf.Path, + Protocol: redirectConf.Protocol, + Port: redirectConf.Port, + Query: redirectConf.Query, + Host: redirectConf.Host, + HttpCode: redirectConf.HttpCode, + } +} +func transSDKRedirectConfigToUpdateRules(redirectConf alb.RedirectConfig) albsdk.UpdateRulesAttributeRulesRuleActionsItemRedirectConfig { + return albsdk.UpdateRulesAttributeRulesRuleActionsItemRedirectConfig{ + Path: redirectConf.Path, + Protocol: redirectConf.Protocol, + Port: redirectConf.Port, + Query: redirectConf.Query, + Host: redirectConf.Host, + HttpCode: redirectConf.HttpCode, + } +} +func transSDKRedirectConfigToCreateRule(redirectConf alb.RedirectConfig) albsdk.CreateRuleRuleActionsRedirectConfig { + return albsdk.CreateRuleRuleActionsRedirectConfig{ + Path: redirectConf.Path, + Protocol: redirectConf.Protocol, + Port: redirectConf.Port, + Query: redirectConf.Query, + Host: redirectConf.Host, + HttpCode: redirectConf.HttpCode, + } +} +func transSDKRedirectConfigToUpdateRule(redirectConf alb.RedirectConfig) albsdk.UpdateRuleAttributeRuleActionsRedirectConfig { + return albsdk.UpdateRuleAttributeRuleActionsRedirectConfig{ + Path: redirectConf.Path, + Protocol: redirectConf.Protocol, + Port: redirectConf.Port, + Query: redirectConf.Query, + Host: redirectConf.Host, + HttpCode: redirectConf.HttpCode, + } +} +func transModelForwardActionConfigToSDKCreateRules(forwardActionConf alb.ForwardActionConfig) (*albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfig, error) { + sdkSGPs, err := transModelServerGroupTuplesToSDKCreateRules(forwardActionConf.ServerGroups) + if err != nil { + return nil, err + } + r := &albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfig{ + ServerGroupTuples: sdkSGPs, + } + if forwardActionConf.ServerGroupStickySession != nil { + r.ServerGroupStickySession = albsdk.CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupStickySession{ + Enabled: strconv.FormatBool(forwardActionConf.ServerGroupStickySession.Enabled), + Timeout: strconv.Itoa(forwardActionConf.ServerGroupStickySession.Timeout), + } + } + return r, nil +} +func transModelForwardActionConfigToSDKUpdateRules(forwardActionConf alb.ForwardActionConfig) (*albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfig, error) { + sdkSGPs, err := transModelServerGroupTuplesToSDKUpdateRules(forwardActionConf.ServerGroups) + if err != nil { + return nil, err + } + r := &albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfig{ + ServerGroupTuples: sdkSGPs, + } + if forwardActionConf.ServerGroupStickySession != nil { + r.ServerGroupStickySession = albsdk.UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupStickySession{ + Enabled: strconv.FormatBool(forwardActionConf.ServerGroupStickySession.Enabled), + Timeout: strconv.Itoa(forwardActionConf.ServerGroupStickySession.Timeout), + } + } + return r, nil +} +func transModelForwardActionConfigToSDKCreateRule(forwardActionConf alb.ForwardActionConfig) (*albsdk.CreateRuleRuleActionsForwardGroupConfig, error) { + sdkSGPs, err := transModelServerGroupTuplesToSDKCreateRule(forwardActionConf.ServerGroups) + if err != nil { + return nil, err + } + r := &albsdk.CreateRuleRuleActionsForwardGroupConfig{ + ServerGroupTuples: sdkSGPs, + } + if forwardActionConf.ServerGroupStickySession != nil { + r.ServerGroupStickySession = albsdk.CreateRuleRuleActionsForwardGroupConfigServerGroupStickySession{ + Enabled: strconv.FormatBool(forwardActionConf.ServerGroupStickySession.Enabled), + Timeout: strconv.Itoa(forwardActionConf.ServerGroupStickySession.Timeout), + } + } + return r, nil +} +func transModelForwardActionConfigToSDKUpdateRule(forwardActionConf alb.ForwardActionConfig) (*albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfig, error) { + sdkSGPs, err := transModelServerGroupTuplesToSDKUpdateRule(forwardActionConf.ServerGroups) + if err != nil { + return nil, err + } + r := &albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfig{ + ServerGroupTuples: sdkSGPs, + } + if forwardActionConf.ServerGroupStickySession != nil { + r.ServerGroupStickySession = albsdk.UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupStickySession{ + Enabled: strconv.FormatBool(forwardActionConf.ServerGroupStickySession.Enabled), + Timeout: strconv.Itoa(forwardActionConf.ServerGroupStickySession.Timeout), + } + } + return r, nil +} +func transModelForwardActionConfigToSDKRule(forwardActionConf alb.ForwardActionConfig) (*albsdk.ForwardGroupConfigInListRules, error) { + sdkSGPs, err := transModelServerGroupTuplesToSDKRule(forwardActionConf.ServerGroups) + if err != nil { + return nil, err + } + r := &albsdk.ForwardGroupConfigInListRules{ + ServerGroupTuples: *sdkSGPs, + } + if forwardActionConf.ServerGroupStickySession != nil { + r.ServerGroupStickySession = albsdk.ServerGroupStickySession{ + Enabled: forwardActionConf.ServerGroupStickySession.Enabled, + Timeout: forwardActionConf.ServerGroupStickySession.Timeout, + } + } + return r, nil +} + +func transModelActionToSDKCreateRules(action alb.Action) (*albsdk.CreateRulesRulesRuleActionsItem, error) { + sdkObj := &albsdk.CreateRulesRulesRuleActionsItem{} + sdkObj.Type = action.Type + sdkObj.Order = strconv.Itoa(action.Order) + switch sdkObj.Type { + case util.RuleActionTypeFixedResponse: + sdkObj.FixedResponseConfig = transSDKFixedResponseConfigToCreateRules(*action.FixedResponseConfig) + case util.RuleActionTypeRedirect: + sdkObj.RedirectConfig = transSDKRedirectConfigToCreateRules(*action.RedirectConfig) + case util.RuleActionTypeForward: + forwardActionConfig, err := transModelForwardActionConfigToSDKCreateRules(*action.ForwardConfig) + if err != nil { + return nil, err + } + sdkObj.ForwardGroupConfig = *forwardActionConfig + } + return sdkObj, nil +} +func transModelActionToSDKUpdateRules(action alb.Action) (*albsdk.UpdateRulesAttributeRulesRuleActionsItem, error) { + sdkObj := &albsdk.UpdateRulesAttributeRulesRuleActionsItem{} + sdkObj.Type = action.Type + sdkObj.Order = strconv.Itoa(action.Order) + switch sdkObj.Type { + case util.RuleActionTypeFixedResponse: + sdkObj.FixedResponseConfig = transSDKFixedResponseConfigToUpdateRules(*action.FixedResponseConfig) + case util.RuleActionTypeRedirect: + sdkObj.RedirectConfig = transSDKRedirectConfigToUpdateRules(*action.RedirectConfig) + case util.RuleActionTypeForward: + forwardActionConfig, err := transModelForwardActionConfigToSDKUpdateRules(*action.ForwardConfig) + if err != nil { + return nil, err + } + sdkObj.ForwardGroupConfig = *forwardActionConfig + } + return sdkObj, nil +} +func transModelActionToSDKCreateRule(action alb.Action) (*albsdk.CreateRuleRuleActions, error) { + sdkObj := &albsdk.CreateRuleRuleActions{} + sdkObj.Type = action.Type + sdkObj.Order = strconv.Itoa(action.Order) + switch sdkObj.Type { + case util.RuleActionTypeFixedResponse: + sdkObj.FixedResponseConfig = transSDKFixedResponseConfigToCreateRule(*action.FixedResponseConfig) + case util.RuleActionTypeRedirect: + sdkObj.RedirectConfig = transSDKRedirectConfigToCreateRule(*action.RedirectConfig) + case util.RuleActionTypeForward: + forwardActionConfig, err := transModelForwardActionConfigToSDKCreateRule(*action.ForwardConfig) + if err != nil { + return nil, err + } + sdkObj.ForwardGroupConfig = *forwardActionConfig + } + return sdkObj, nil +} +func transModelActionToSDKUpdateRule(action alb.Action) (*albsdk.UpdateRuleAttributeRuleActions, error) { + sdkObj := &albsdk.UpdateRuleAttributeRuleActions{} + sdkObj.Type = action.Type + sdkObj.Order = strconv.Itoa(action.Order) + switch sdkObj.Type { + case util.RuleActionTypeFixedResponse: + sdkObj.FixedResponseConfig = transSDKFixedResponseConfigToUpdateRule(*action.FixedResponseConfig) + case util.RuleActionTypeRedirect: + sdkObj.RedirectConfig = transSDKRedirectConfigToUpdateRule(*action.RedirectConfig) + case util.RuleActionTypeForward: + forwardActionConfig, err := transModelForwardActionConfigToSDKUpdateRule(*action.ForwardConfig) + if err != nil { + return nil, err + } + sdkObj.ForwardGroupConfig = *forwardActionConfig + } + return sdkObj, nil +} +func transModelActionsToSDKCreateRules(actions []alb.Action) (*[]albsdk.CreateRulesRulesRuleActionsItem, error) { + var createRulesActions []albsdk.CreateRulesRulesRuleActionsItem + if len(actions) != 0 { + createRulesActions = make([]albsdk.CreateRulesRulesRuleActionsItem, 0) + for index, m := range actions { + m.Order = index + 1 + action, err := transModelActionToSDKCreateRules(m) + if err != nil { + return nil, err + } + createRulesActions = append(createRulesActions, *action) + } + } + return &createRulesActions, nil +} +func transModelActionsToSDKUpdateRules(actions []alb.Action) (*[]albsdk.UpdateRulesAttributeRulesRuleActionsItem, error) { + var updateRulesActions []albsdk.UpdateRulesAttributeRulesRuleActionsItem + if len(actions) != 0 { + updateRulesActions = make([]albsdk.UpdateRulesAttributeRulesRuleActionsItem, 0) + for index, m := range actions { + m.Order = index + 1 + action, err := transModelActionToSDKUpdateRules(m) + if err != nil { + return nil, err + } + updateRulesActions = append(updateRulesActions, *action) + } + } + return &updateRulesActions, nil +} +func transModelActionsToSDKCreateRule(actions []alb.Action) (*[]albsdk.CreateRuleRuleActions, error) { + var createRuleActions []albsdk.CreateRuleRuleActions + if len(actions) != 0 { + createRuleActions = make([]albsdk.CreateRuleRuleActions, 0) + for index, m := range actions { + m.Order = index + 1 + createRuleAction, err := transModelActionToSDKCreateRule(m) + if err != nil { + return nil, err + } + createRuleActions = append(createRuleActions, *createRuleAction) + } + } + return &createRuleActions, nil +} +func transModelActionsToSDKUpdateRule(actions []alb.Action) (*[]albsdk.UpdateRuleAttributeRuleActions, error) { + var updateRuleActions []albsdk.UpdateRuleAttributeRuleActions + if len(actions) != 0 { + updateRuleActions = make([]albsdk.UpdateRuleAttributeRuleActions, 0) + for index, m := range actions { + m.Order = index + 1 + updateRuleAction, err := transModelActionToSDKUpdateRule(m) + if err != nil { + return nil, err + } + updateRuleActions = append(updateRuleActions, *updateRuleAction) + } + } + + return &updateRuleActions, nil +} +func transModelActionToSDK(action alb.Action) (*albsdk.Action, error) { + sdkObj := &albsdk.Action{} + sdkObj.Type = action.Type + sdkObj.Order = action.Order + switch sdkObj.Type { + case util.RuleActionTypeFixedResponse: + sdkObj.FixedResponseConfig = albsdk.FixedResponseConfig{ + HttpCode: action.FixedResponseConfig.HttpCode, + Content: action.FixedResponseConfig.Content, + ContentType: action.FixedResponseConfig.ContentType, + } + case util.RuleActionTypeRedirect: + sdkObj.RedirectConfig = albsdk.RedirectConfig{ + HttpCode: action.RedirectConfig.HttpCode, + Host: action.RedirectConfig.Host, + Path: action.RedirectConfig.Path, + Protocol: action.RedirectConfig.Protocol, + Port: action.RedirectConfig.Port, + Query: action.RedirectConfig.Query, + } + case util.RuleActionTypeForward: + forwardActionConfig, err := transModelForwardActionConfigToSDKRule(*action.ForwardConfig) + if err != nil { + return nil, err + } + sdkObj.ForwardGroupConfig = *forwardActionConfig + } + return sdkObj, nil +} +func transModelActionsToSDK(actions []alb.Action) (*[]albsdk.Action, error) { + var sdkActions []albsdk.Action + if len(actions) != 0 { + sdkActions = make([]albsdk.Action, 0) + for index, m := range actions { + m.Order = index + 1 + ruleAction, err := transModelActionToSDK(m) + if err != nil { + return nil, err + } + sdkActions = append(sdkActions, *ruleAction) + } + } + + return &sdkActions, nil +} + +func transSDKQueryStringConfigValueToCreateRule(value alb.Value) *albsdk.CreateRuleRuleConditionsQueryStringConfigValuesItem { + return &albsdk.CreateRuleRuleConditionsQueryStringConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKQueryStringConfigValueToUpdateRule(value alb.Value) *albsdk.UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem { + return &albsdk.UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKQueryStringConfigValuesToCreateRule(values []alb.Value) *[]albsdk.CreateRuleRuleConditionsQueryStringConfigValuesItem { + r := make([]albsdk.CreateRuleRuleConditionsQueryStringConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKQueryStringConfigValueToCreateRule(v)) + } + return &r +} +func transSDKQueryStringConfigValuesToUpdateRule(values []alb.Value) *[]albsdk.UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem { + r := make([]albsdk.UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKQueryStringConfigValueToUpdateRule(v)) + } + return &r +} +func transSDKQueryStringConfigToCreateRule(queryStringConf alb.QueryStringConfig) albsdk.CreateRuleRuleConditionsQueryStringConfig { + return albsdk.CreateRuleRuleConditionsQueryStringConfig{ + Values: transSDKQueryStringConfigValuesToCreateRule(queryStringConf.Values), + } +} +func transSDKQueryStringConfigToUpdateRule(queryStringConf alb.QueryStringConfig) albsdk.UpdateRuleAttributeRuleConditionsQueryStringConfig { + return albsdk.UpdateRuleAttributeRuleConditionsQueryStringConfig{ + Values: transSDKQueryStringConfigValuesToUpdateRule(queryStringConf.Values), + } +} +func transSDKQueryStringConfigValuesToCreateRules(values []alb.Value) *[]albsdk.CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem { + r := make([]albsdk.CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKQueryStringConfigValueToCreateRules(v)) + } + return &r +} +func transSDKQueryStringConfigValuesToUpdateRules(values []alb.Value) *[]albsdk.UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem { + r := make([]albsdk.UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKQueryStringConfigValueToUpdateRules(v)) + } + return &r +} +func transSDKQueryStringConfigValueToCreateRules(value alb.Value) *albsdk.CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem { + return &albsdk.CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKQueryStringConfigValueToUpdateRules(value alb.Value) *albsdk.UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem { + return &albsdk.UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKQueryStringConfigToCreateRules(queryStringConf alb.QueryStringConfig) albsdk.CreateRulesRulesRuleConditionsItemQueryStringConfig { + return albsdk.CreateRulesRulesRuleConditionsItemQueryStringConfig{ + Values: transSDKQueryStringConfigValuesToCreateRules(queryStringConf.Values), + } +} +func transSDKQueryStringConfigToUpdateRules(queryStringConf alb.QueryStringConfig) albsdk.UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfig { + return albsdk.UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfig{ + Values: transSDKQueryStringConfigValuesToUpdateRules(queryStringConf.Values), + } +} + +func transSDKCookieConfigValueToCreateRules(value alb.Value) *albsdk.CreateRulesRulesRuleConditionsItemCookieConfigValuesItem { + return &albsdk.CreateRulesRulesRuleConditionsItemCookieConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKCookieConfigValueToUpdateRules(value alb.Value) *albsdk.UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem { + return &albsdk.UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKCookieConfigValueToCreateRule(values alb.Value) *albsdk.CreateRuleRuleConditionsCookieConfigValuesItem { + return &albsdk.CreateRuleRuleConditionsCookieConfigValuesItem{ + Value: values.Value, + Key: values.Key, + } +} +func transSDKCookieConfigValueToUpdateRule(value alb.Value) *albsdk.UpdateRuleAttributeRuleConditionsCookieConfigValuesItem { + return &albsdk.UpdateRuleAttributeRuleConditionsCookieConfigValuesItem{ + Value: value.Value, + Key: value.Key, + } +} +func transSDKCookieConfigValuesToCreateRules(values []alb.Value) *[]albsdk.CreateRulesRulesRuleConditionsItemCookieConfigValuesItem { + r := make([]albsdk.CreateRulesRulesRuleConditionsItemCookieConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKCookieConfigValueToCreateRules(v)) + } + return &r +} +func transSDKCookieConfigValuesToUpdateRules(values []alb.Value) *[]albsdk.UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem { + r := make([]albsdk.UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKCookieConfigValueToUpdateRules(v)) + } + return &r +} +func transSDKCookieConfigValuesToCreateRule(values []alb.Value) *[]albsdk.CreateRuleRuleConditionsCookieConfigValuesItem { + r := make([]albsdk.CreateRuleRuleConditionsCookieConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKCookieConfigValueToCreateRule(v)) + } + return &r +} +func transSDKCookieConfigValuesToUpdateRule(values []alb.Value) *[]albsdk.UpdateRuleAttributeRuleConditionsCookieConfigValuesItem { + r := make([]albsdk.UpdateRuleAttributeRuleConditionsCookieConfigValuesItem, 0) + for _, v := range values { + r = append(r, *transSDKCookieConfigValueToUpdateRule(v)) + } + return &r +} +func transSDKCookieConfigToCreateRules(cookieConfig alb.CookieConfig) albsdk.CreateRulesRulesRuleConditionsItemCookieConfig { + return albsdk.CreateRulesRulesRuleConditionsItemCookieConfig{ + Values: transSDKCookieConfigValuesToCreateRules(cookieConfig.Values), + } +} +func transSDKCookieConfigToUpdateRules(cookieConfig alb.CookieConfig) albsdk.UpdateRulesAttributeRulesRuleConditionsItemCookieConfig { + return albsdk.UpdateRulesAttributeRulesRuleConditionsItemCookieConfig{ + Values: transSDKCookieConfigValuesToUpdateRules(cookieConfig.Values), + } +} +func transSDKCookieConfigToCreateRule(cookieConfig alb.CookieConfig) albsdk.CreateRuleRuleConditionsCookieConfig { + return albsdk.CreateRuleRuleConditionsCookieConfig{ + Values: transSDKCookieConfigValuesToCreateRule(cookieConfig.Values), + } +} +func transSDKCookieConfigToUpdateRule(cookieConfig alb.CookieConfig) albsdk.UpdateRuleAttributeRuleConditionsCookieConfig { + return albsdk.UpdateRuleAttributeRuleConditionsCookieConfig{ + Values: transSDKCookieConfigValuesToUpdateRule(cookieConfig.Values), + } +} + +func transSDKHostConfigToCreateRules(hostConf alb.HostConfig) albsdk.CreateRulesRulesRuleConditionsItemHostConfig { + return albsdk.CreateRulesRulesRuleConditionsItemHostConfig{ + Values: &hostConf.Values, + } +} +func transSDKHostConfigToUpdateRules(hostConf alb.HostConfig) albsdk.UpdateRulesAttributeRulesRuleConditionsItemHostConfig { + return albsdk.UpdateRulesAttributeRulesRuleConditionsItemHostConfig{ + Values: &hostConf.Values, + } +} +func transSDKHostConfigToCreateRule(hostConf alb.HostConfig) albsdk.CreateRuleRuleConditionsHostConfig { + return albsdk.CreateRuleRuleConditionsHostConfig{ + Values: &hostConf.Values, + } +} +func transSDKHostConfigToUpdateRule(hostConf alb.HostConfig) albsdk.UpdateRuleAttributeRuleConditionsHostConfig { + return albsdk.UpdateRuleAttributeRuleConditionsHostConfig{ + Values: &hostConf.Values, + } +} + +func transSDKHeaderConfigToCreateRules(headerConfig alb.HeaderConfig) albsdk.CreateRulesRulesRuleConditionsItemHeaderConfig { + return albsdk.CreateRulesRulesRuleConditionsItemHeaderConfig{ + Values: &headerConfig.Values, + Key: headerConfig.Key, + } +} +func transSDKHeaderConfigToUpdateRules(headerConfig alb.HeaderConfig) albsdk.UpdateRulesAttributeRulesRuleConditionsItemHeaderConfig { + return albsdk.UpdateRulesAttributeRulesRuleConditionsItemHeaderConfig{ + Values: &headerConfig.Values, + Key: headerConfig.Key, + } +} +func transSDKHeaderConfigToCreateRule(headerConfig alb.HeaderConfig) albsdk.CreateRuleRuleConditionsHeaderConfig { + return albsdk.CreateRuleRuleConditionsHeaderConfig{ + Values: &headerConfig.Values, + Key: headerConfig.Key, + } +} +func transSDKHeaderConfigToUpdateRule(headerConfig alb.HeaderConfig) albsdk.UpdateRuleAttributeRuleConditionsHeaderConfig { + return albsdk.UpdateRuleAttributeRuleConditionsHeaderConfig{ + Values: &headerConfig.Values, + Key: headerConfig.Key, + } +} + +func transSDKMethodConfigToCreateRules(methodConfig alb.MethodConfig) albsdk.CreateRulesRulesRuleConditionsItemMethodConfig { + return albsdk.CreateRulesRulesRuleConditionsItemMethodConfig{ + Values: &methodConfig.Values, + } +} +func transSDKMethodConfigToCreateRule(methodConfig alb.MethodConfig) albsdk.CreateRuleRuleConditionsMethodConfig { + return albsdk.CreateRuleRuleConditionsMethodConfig{ + Values: &methodConfig.Values, + } +} +func transSDKMethodConfigToUpdateRules(methodConfig alb.MethodConfig) albsdk.UpdateRulesAttributeRulesRuleConditionsItemMethodConfig { + return albsdk.UpdateRulesAttributeRulesRuleConditionsItemMethodConfig{ + Values: &methodConfig.Values, + } +} +func transSDKMethodConfigToUpdateRule(methodConfig alb.MethodConfig) albsdk.UpdateRuleAttributeRuleConditionsMethodConfig { + return albsdk.UpdateRuleAttributeRuleConditionsMethodConfig{ + Values: &methodConfig.Values, + } +} + +func transSDKPathConfigToCreateRules(pathConfig alb.PathConfig) albsdk.CreateRulesRulesRuleConditionsItemPathConfig { + return albsdk.CreateRulesRulesRuleConditionsItemPathConfig{ + Values: &pathConfig.Values, + } +} +func transSDKPathConfigToUpdateRules(pathConfig alb.PathConfig) albsdk.UpdateRulesAttributeRulesRuleConditionsItemPathConfig { + return albsdk.UpdateRulesAttributeRulesRuleConditionsItemPathConfig{ + Values: &pathConfig.Values, + } +} +func transSDKPathConfigToCreateRule(pathConfig alb.PathConfig) albsdk.CreateRuleRuleConditionsPathConfig { + return albsdk.CreateRuleRuleConditionsPathConfig{ + Values: &pathConfig.Values, + } +} +func transSDKPathConfigToUpdateRule(pathConfig alb.PathConfig) albsdk.UpdateRuleAttributeRuleConditionsPathConfig { + return albsdk.UpdateRuleAttributeRuleConditionsPathConfig{ + Values: &pathConfig.Values, + } +} +func transSDKConditionToCreateRules(condition alb.Condition) *albsdk.CreateRulesRulesRuleConditionsItem { + resCondition := &albsdk.CreateRulesRulesRuleConditionsItem{} + resCondition.Type = condition.Type + + switch condition.Type { + case util.RuleConditionFieldHost: + resCondition.HostConfig = transSDKHostConfigToCreateRules(condition.HostConfig) + case util.RuleConditionFieldHeader: + resCondition.HeaderConfig = transSDKHeaderConfigToCreateRules(condition.HeaderConfig) + case util.RuleConditionFieldMethod: + resCondition.MethodConfig = transSDKMethodConfigToCreateRules(condition.MethodConfig) + case util.RuleConditionFieldPath: + resCondition.PathConfig = transSDKPathConfigToCreateRules(condition.PathConfig) + case util.RuleConditionFieldQueryString: + resCondition.QueryStringConfig = transSDKQueryStringConfigToCreateRules(condition.QueryStringConfig) + case util.RuleConditionFieldCookie: + resCondition.CookieConfig = transSDKCookieConfigToCreateRules(condition.CookieConfig) + } + + return resCondition +} +func transSDKConditionToUpdateRules(condition alb.Condition) *albsdk.UpdateRulesAttributeRulesRuleConditionsItem { + resCondition := &albsdk.UpdateRulesAttributeRulesRuleConditionsItem{} + resCondition.Type = condition.Type + + switch condition.Type { + case util.RuleConditionFieldHost: + resCondition.HostConfig = transSDKHostConfigToUpdateRules(condition.HostConfig) + case util.RuleConditionFieldHeader: + resCondition.HeaderConfig = transSDKHeaderConfigToUpdateRules(condition.HeaderConfig) + case util.RuleConditionFieldMethod: + resCondition.MethodConfig = transSDKMethodConfigToUpdateRules(condition.MethodConfig) + case util.RuleConditionFieldPath: + resCondition.PathConfig = transSDKPathConfigToUpdateRules(condition.PathConfig) + case util.RuleConditionFieldQueryString: + resCondition.QueryStringConfig = transSDKQueryStringConfigToUpdateRules(condition.QueryStringConfig) + case util.RuleConditionFieldCookie: + resCondition.CookieConfig = transSDKCookieConfigToUpdateRules(condition.CookieConfig) + } + + return resCondition +} + +func transSDKConditionToCreateRule(condition alb.Condition) *albsdk.CreateRuleRuleConditions { + resCondition := &albsdk.CreateRuleRuleConditions{} + resCondition.Type = condition.Type + + switch condition.Type { + case util.RuleConditionFieldHost: + resCondition.HostConfig = transSDKHostConfigToCreateRule(condition.HostConfig) + case util.RuleConditionFieldHeader: + resCondition.HeaderConfig = transSDKHeaderConfigToCreateRule(condition.HeaderConfig) + case util.RuleConditionFieldMethod: + resCondition.MethodConfig = transSDKMethodConfigToCreateRule(condition.MethodConfig) + case util.RuleConditionFieldPath: + resCondition.PathConfig = transSDKPathConfigToCreateRule(condition.PathConfig) + case util.RuleConditionFieldQueryString: + resCondition.QueryStringConfig = transSDKQueryStringConfigToCreateRule(condition.QueryStringConfig) + case util.RuleConditionFieldCookie: + resCondition.CookieConfig = transSDKCookieConfigToCreateRule(condition.CookieConfig) + } + + return resCondition +} +func transSDKConditionToUpdateRule(condition alb.Condition) *albsdk.UpdateRuleAttributeRuleConditions { + resCondition := &albsdk.UpdateRuleAttributeRuleConditions{} + resCondition.Type = condition.Type + + switch condition.Type { + case util.RuleConditionFieldHost: + resCondition.HostConfig = transSDKHostConfigToUpdateRule(condition.HostConfig) + case util.RuleConditionFieldHeader: + resCondition.HeaderConfig = transSDKHeaderConfigToUpdateRule(condition.HeaderConfig) + case util.RuleConditionFieldMethod: + resCondition.MethodConfig = transSDKMethodConfigToUpdateRule(condition.MethodConfig) + case util.RuleConditionFieldPath: + resCondition.PathConfig = transSDKPathConfigToUpdateRule(condition.PathConfig) + case util.RuleConditionFieldQueryString: + resCondition.QueryStringConfig = transSDKQueryStringConfigToUpdateRule(condition.QueryStringConfig) + case util.RuleConditionFieldCookie: + resCondition.CookieConfig = transSDKCookieConfigToUpdateRule(condition.CookieConfig) + } + + return resCondition +} + +func transSDKConditionsToCreateRules(conditions []alb.Condition) *[]albsdk.CreateRulesRulesRuleConditionsItem { + var createRuleConditions []albsdk.CreateRulesRulesRuleConditionsItem + if len(conditions) != 0 { + createRuleConditions = make([]albsdk.CreateRulesRulesRuleConditionsItem, 0) + for _, condition := range conditions { + createRuleCondition := transSDKConditionToCreateRules(condition) + createRuleConditions = append(createRuleConditions, *createRuleCondition) + } + } + return &createRuleConditions +} +func transSDKConditionsToUpdateRules(conditions []alb.Condition) *[]albsdk.UpdateRulesAttributeRulesRuleConditionsItem { + var updateRulesConditions []albsdk.UpdateRulesAttributeRulesRuleConditionsItem + if len(conditions) != 0 { + updateRulesConditions = make([]albsdk.UpdateRulesAttributeRulesRuleConditionsItem, 0) + for _, condition := range conditions { + updateRuleCondition := transSDKConditionToUpdateRules(condition) + updateRulesConditions = append(updateRulesConditions, *updateRuleCondition) + } + } + return &updateRulesConditions +} + +func transSDKConditionsToCreateRule(conditions []alb.Condition) *[]albsdk.CreateRuleRuleConditions { + var createRuleConditions []albsdk.CreateRuleRuleConditions + if len(conditions) != 0 { + createRuleConditions = make([]albsdk.CreateRuleRuleConditions, 0) + for _, condition := range conditions { + createRuleCondition := transSDKConditionToCreateRule(condition) + createRuleConditions = append(createRuleConditions, *createRuleCondition) + } + } + return &createRuleConditions +} +func transSDKConditionsToUpdateRule(conditions []alb.Condition) *[]albsdk.UpdateRuleAttributeRuleConditions { + var updateRuleConditions []albsdk.UpdateRuleAttributeRuleConditions + if len(conditions) != 0 { + updateRuleConditions = make([]albsdk.UpdateRuleAttributeRuleConditions, 0) + for _, condition := range conditions { + updateRuleCondition := transSDKConditionToUpdateRule(condition) + updateRuleConditions = append(updateRuleConditions, *updateRuleCondition) + } + } + return &updateRuleConditions +} + +func buildSDKCreateListenerRuleRequest(lrSpec alb.ListenerRuleSpec) (*albsdk.CreateRuleRequest, error) { + lsID, err := lrSpec.ListenerID.Resolve(context.Background()) + if err != nil { + return nil, err + } + + ruleReq := albsdk.CreateCreateRuleRequest() + ruleReq.RuleName = lrSpec.RuleName + ruleReq.ListenerId = lsID + ruleReq.RuleConditions = transSDKConditionsToCreateRule(lrSpec.RuleConditions) + actions, err := transModelActionsToSDKCreateRule(lrSpec.RuleActions) + if err != nil { + return nil, err + } + ruleReq.RuleActions = actions + ruleReq.Priority = requests.NewInteger(lrSpec.Priority) + + return ruleReq, nil +} + +func isVipStatusNotSupportError(err error) bool { + if strings.Contains(err.Error(), "IncorrectStatus.Listener") || + strings.Contains(err.Error(), "VipStatusNotSupport") || + strings.Contains(err.Error(), "IncorrectStatus.Rule") { + return true + } + return false +} + +func buildResListenerRuleStatus(ruleID string) alb.ListenerRuleStatus { + return alb.ListenerRuleStatus{ + RuleID: ruleID, + } +} + +type ListenerRuleUpdateAnalyzer struct { + ruleNameNeedUpdate bool + ruleActionsNeedUpdate bool + ruleConditionsNeedUpdate bool + priorityNeedUpdate bool + needUpdate bool +} + +func (r *ListenerRuleUpdateAnalyzer) isNeedUpdate() bool { + if !r.ruleNameNeedUpdate && + !r.ruleActionsNeedUpdate && + !r.ruleConditionsNeedUpdate && + !r.priorityNeedUpdate { + return false + } + return true +} + +func (r *ListenerRuleUpdateAnalyzer) analysis(_ context.Context, resLR *alb.ListenerRule, sdkLR *albsdk.Rule) error { + if resLR.Spec.RuleName != sdkLR.RuleName { + r.ruleNameNeedUpdate = true + } + + if resLR.Spec.Priority != sdkLR.Priority { + r.priorityNeedUpdate = true + } + + resActions, err := transModelActionsToSDK(resLR.Spec.RuleActions) + if err != nil { + return err + } + if !reflect.DeepEqual(*resActions, sdkLR.RuleActions) { + r.ruleActionsNeedUpdate = true + } + + if !reflect.DeepEqual(resLR.Spec.RuleConditions, sdkLR.RuleConditions) { + r.ruleConditionsNeedUpdate = true + } + + r.needUpdate = r.isNeedUpdate() + + return nil +} + +var createRulesFunc = func(ctx context.Context, ruleMgr *ALBProvider, lsID string, rules []albsdk.CreateRulesRules) ([]albsdk.RuleId, error) { + if len(rules) == 0 { + return nil, nil + } + + traceID := ctx.Value(util.TraceID) + + createRulesReq := albsdk.CreateCreateRulesRequest() + createRulesReq.ListenerId = lsID + createRulesReq.Rules = &rules + + var createRuleResp *albsdk.CreateRulesResponse + if err := util.RetryImmediateOnError(ruleMgr.waitLSExistencePollInterval, ruleMgr.waitLSExistenceTimeout, isVipStatusNotSupportError, func() error { + startTime := time.Now() + ruleMgr.logger.V(util.MgrLogLevel).Info("creating rules", + "listenerID", lsID, + "rules", rules, + "traceID", traceID, + "startTime", startTime, + util.Action, util.CreateALBRules) + var err error + createRuleResp, err = ruleMgr.auth.ALB.CreateRules(createRulesReq) + if err != nil { + ruleMgr.logger.V(util.MgrLogLevel).Info("creating rules", + "listenerID", createRulesReq.ListenerId, + "traceID", traceID, + "error", err.Error(), + util.Action, util.CreateALBRules) + return err + } + ruleMgr.logger.V(util.MgrLogLevel).Info("created rules", + "listenerID", createRulesReq.ListenerId, + "traceID", traceID, + "rules", createRuleResp.RuleIds, + "requestID", createRuleResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.CreateALBRules) + return nil + }); err != nil { + return nil, errors.Wrap(err, "failed to create listener rules") + } + + return createRuleResp.RuleIds, nil +} + +type BatchCreateRulesFunc func(context.Context, *ALBProvider, string, []albsdk.CreateRulesRules) ([]albsdk.RuleId, error) + +func BatchCreateRules(ctx context.Context, ruleMgr *ALBProvider, lsID string, rules []albsdk.CreateRulesRules, cnt int, batch BatchCreateRulesFunc) ([]albsdk.RuleId, error) { + if cnt <= 0 || cnt >= util.BatchCreateDeleteUpdateRulesMaxNum { + cnt = util.BatchCreateRulesDefaultNum + } + + var resRules []albsdk.RuleId + + for len(rules) > cnt { + resp, err := batch(ctx, ruleMgr, lsID, rules[0:cnt]) + if err != nil { + return nil, err + } + resRules = append(resRules, resp...) + rules = rules[cnt:] + } + if len(rules) <= 0 { + return resRules, nil + } + + resp, err := batch(ctx, ruleMgr, lsID, rules) + if err != nil { + return nil, err + } + resRules = append(resRules, resp...) + + return resRules, nil +} + +func transModelRulesToSDKCreateRules(resLRs []*alb.ListenerRule) ([]albsdk.CreateRulesRules, error) { + creatRules := make([]albsdk.CreateRulesRules, 0) + for _, resLR := range resLRs { + actions, err := transModelActionsToSDKCreateRules(resLR.Spec.RuleActions) + if err != nil { + return nil, err + } + creatRules = append(creatRules, albsdk.CreateRulesRules{ + RuleConditions: transSDKConditionsToCreateRules(resLR.Spec.RuleConditions), + RuleName: resLR.Spec.RuleName, + Priority: strconv.Itoa(resLR.Spec.Priority), + RuleActions: actions, + }) + } + return creatRules, nil +} + +func (m *ALBProvider) CreateALBListenerRules(ctx context.Context, resLRs []*alb.ListenerRule) (map[int]alb.ListenerRuleStatus, error) { + if len(resLRs) == 0 { + return nil, nil + } + + lsID, err := (*resLRs[0]).Spec.ListenerID.Resolve(ctx) + if err != nil { + return nil, err + } + + rules, err := transModelRulesToSDKCreateRules(resLRs) + if err != nil { + return nil, err + } + + createdRules, err := BatchCreateRules(ctx, m, lsID, rules, util.BatchCreateRulesDefaultNum, createRulesFunc) + if err != nil { + return nil, err + } + + priorityToStatus := make(map[int]alb.ListenerRuleStatus) + for _, createdRule := range createdRules { + priorityToStatus[createdRule.Priority] = alb.ListenerRuleStatus{ + RuleID: createdRule.RuleId, + } + } + return priorityToStatus, nil +} + +var updateRulesFunc = func(ctx context.Context, ruleMgr *ALBProvider, rules []albsdk.UpdateRulesAttributeRules) error { + if len(rules) == 0 { + return nil + } + + traceID := ctx.Value(util.TraceID) + + updateRulesReq := albsdk.CreateUpdateRulesAttributeRequest() + updateRulesReq.Rules = &rules + + if err := util.RetryImmediateOnError(ruleMgr.waitLSExistencePollInterval, ruleMgr.waitLSExistenceTimeout, isVipStatusNotSupportError, func() error { + startTime := time.Now() + ruleMgr.logger.V(util.MgrLogLevel).Info("updating rules attribute", + "rules", rules, + "traceID", traceID, + "startTime", startTime, + util.Action, util.UpdateALBRulesAttribute) + updateRulesResp, err := ruleMgr.auth.ALB.UpdateRulesAttribute(updateRulesReq) + if err != nil { + ruleMgr.logger.V(util.MgrLogLevel).Info("updated rules attribute", + "traceID", traceID, + "requestID", updateRulesResp.RequestId, + "error", err.Error(), + util.Action, util.UpdateALBRulesAttribute) + return err + } + ruleMgr.logger.V(util.MgrLogLevel).Info("updated rules attribute", + "traceID", traceID, + "requestID", updateRulesResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.UpdateALBRulesAttribute) + return nil + }); err != nil { + return errors.Wrap(err, "failed to update listener rules") + } + + return nil +} + +type BatchUpdateRulesFunc func(context.Context, *ALBProvider, []albsdk.UpdateRulesAttributeRules) error + +func BatchUpdateRules(ctx context.Context, ruleMgr *ALBProvider, rules []albsdk.UpdateRulesAttributeRules, cnt int, batch BatchUpdateRulesFunc) error { + if cnt <= 0 || cnt >= util.BatchCreateDeleteUpdateRulesMaxNum { + cnt = util.BatchUpdateRulesDefaultNum + } + + for len(rules) > cnt { + if err := batch(ctx, ruleMgr, rules[0:cnt]); err != nil { + return err + } + rules = rules[cnt:] + } + if len(rules) <= 0 { + return nil + } + + return batch(ctx, ruleMgr, rules) +} + +func (m *ALBProvider) transRulePairsToSDKUpdateRules(ctx context.Context, rulePairs []alb.ResAndSDKListenerRulePair) ([]albsdk.UpdateRulesAttributeRules, error) { + if len(rulePairs) == 0 { + return nil, nil + } + + traceID := ctx.Value(util.TraceID) + + rules := make([]albsdk.UpdateRulesAttributeRules, 0) + + for _, rulePair := range rulePairs { + updateAnalyzer := new(ListenerRuleUpdateAnalyzer) + if err := updateAnalyzer.analysis(ctx, rulePair.ResLR, rulePair.SdkLR); err != nil { + return nil, err + } + + if !updateAnalyzer.needUpdate { + continue + } + + var rule albsdk.UpdateRulesAttributeRules + rule.RuleId = rulePair.SdkLR.RuleId + + if updateAnalyzer.ruleNameNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("RuleName update", + "res", rulePair.ResLR.Spec.RuleName, + "sdk", rulePair.SdkLR.RuleName, + "ruleID", rulePair.SdkLR.RuleId, + "traceID", traceID) + rule.RuleName = rulePair.ResLR.Spec.RuleName + } + if updateAnalyzer.ruleActionsNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("Actions update", + "res", rulePair.ResLR.Spec.RuleActions, + "sdk", rulePair.SdkLR.RuleActions, + "ruleID", rulePair.SdkLR.RuleId, + "traceID", traceID) + actions, err := transModelActionsToSDKUpdateRules(rulePair.ResLR.Spec.RuleActions) + if err != nil { + return nil, err + } + rule.RuleActions = actions + } + if updateAnalyzer.ruleConditionsNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("Conditions update", + "res", rulePair.ResLR.Spec.RuleConditions, + "sdk", rulePair.SdkLR.RuleConditions, + "ruleID", rulePair.SdkLR.RuleId, + "traceID", traceID) + rule.RuleConditions = transSDKConditionsToUpdateRules(rulePair.ResLR.Spec.RuleConditions) + } + if updateAnalyzer.priorityNeedUpdate { + m.logger.V(util.MgrLogLevel).Info("Priority update", + "res", rulePair.ResLR.Spec.Priority, + "sdk", rulePair.SdkLR.Priority, + "ruleID", rulePair.SdkLR.RuleId, + "traceID", traceID) + rule.Priority = strconv.Itoa(rulePair.ResLR.Spec.Priority) + } + + rules = append(rules, rule) + } + + return rules, nil +} + +func (m *ALBProvider) UpdateALBListenerRules(ctx context.Context, rulePairs []alb.ResAndSDKListenerRulePair) error { + if len(rulePairs) == 0 { + return nil + } + + updateRules, err := m.transRulePairsToSDKUpdateRules(ctx, rulePairs) + if err != nil { + return err + } + + if len(updateRules) == 0 { + return nil + } + + if err := BatchUpdateRules(ctx, m, updateRules, util.BatchUpdateRulesDefaultNum, updateRulesFunc); err != nil { + return err + } + + return nil +} + +var deleteRulesFunc = func(ctx context.Context, ruleMgr *ALBProvider, ruleIDs []string) error { + if len(ruleIDs) == 0 { + return nil + } + + traceID := ctx.Value(util.TraceID) + + deleteRulesReq := albsdk.CreateDeleteRulesRequest() + deleteRulesReq.RuleIds = &ruleIDs + + if err := util.RetryImmediateOnError(ruleMgr.waitLSExistencePollInterval, ruleMgr.waitLSExistenceTimeout, isVipStatusNotSupportError, func() error { + startTime := time.Now() + ruleMgr.logger.V(util.MgrLogLevel).Info("deleting rules", + "ruleIDs", ruleIDs, + "traceID", traceID, + "startTime", startTime, + util.Action, util.DeleteALBRules) + deleteRulesResp, err := ruleMgr.auth.ALB.DeleteRules(deleteRulesReq) + if err != nil { + ruleMgr.logger.V(util.MgrLogLevel).Info("deleting rules", + "ruleIDs", ruleIDs, + "traceID", traceID, + "error", err.Error(), + util.Action, util.DeleteALBRules) + return err + } + ruleMgr.logger.V(util.MgrLogLevel).Info("deleted rules", + "traceID", traceID, + "requestID", deleteRulesResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DeleteALBRules) + return nil + }); err != nil { + return errors.Wrap(err, "failed to delete listener rules") + } + + return nil +} + +type BatchDeleteRulesFunc func(context.Context, *ALBProvider, []string) error + +func BatchDeleteRules(ctx context.Context, ruleMgr *ALBProvider, ruleIDs []string, cnt int, batch BatchDeleteRulesFunc) error { + if cnt <= 0 || cnt >= util.BatchCreateDeleteUpdateRulesMaxNum { + cnt = util.BatchDeleteRulesDefaultNum + } + + for len(ruleIDs) > cnt { + if err := batch(ctx, ruleMgr, ruleIDs[0:cnt]); err != nil { + return err + } + ruleIDs = ruleIDs[cnt:] + } + if len(ruleIDs) <= 0 { + return nil + } + + return batch(ctx, ruleMgr, ruleIDs) +} + +func (m *ALBProvider) DeleteALBListenerRules(ctx context.Context, sdkLRIds []string) error { + if len(sdkLRIds) == 0 { + return nil + } + + if err := BatchDeleteRules(ctx, m, sdkLRIds, util.BatchDeleteRulesDefaultNum, deleteRulesFunc); err != nil { + return err + } + + return nil +} diff --git a/pkg/provider/alibaba/alb/server.go b/pkg/provider/alibaba/alb/server.go new file mode 100644 index 000000000..f09724324 --- /dev/null +++ b/pkg/provider/alibaba/alb/server.go @@ -0,0 +1,705 @@ +package alb + +import ( + "context" + "fmt" + "strconv" + "strings" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" +) + +var registerServersFunc = func(ctx context.Context, serverMgr *ALBProvider, sgpID string, servers []albsdk.AddServersToServerGroupServers) error { + if len(servers) == 0 { + return nil + } + + traceID := ctx.Value(util.TraceID) + + addServerToSgpReq := albsdk.CreateAddServersToServerGroupRequest() + addServerToSgpReq.ServerGroupId = sgpID + addServerToSgpReq.Servers = &servers + + startTime := time.Now() + serverMgr.logger.V(util.MgrLogLevel).Info("adding server to server group", + "serverGroupID", sgpID, + "servers", servers, + "traceID", traceID, + "startTime", startTime, + util.Action, util.AddALBServersToServerGroup) + addServerToSgpResp, err := serverMgr.auth.ALB.AddServersToServerGroup(addServerToSgpReq) + if err != nil { + return err + } + serverMgr.logger.V(util.MgrLogLevel).Info("added server to server group", + "serverGroupID", sgpID, + "traceID", traceID, + "requestID", addServerToSgpResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.AddALBServersToServerGroup) + + if util.IsWaitServersAsynchronousComplete { + asynchronousStartTime := time.Now() + serverMgr.logger.V(util.MgrLogLevel).Info("adding server to server group asynchronous", + "serverGroupID", sgpID, + "servers", servers, + "traceID", traceID, + "startTime", asynchronousStartTime, + util.Action, util.AddALBServersToServerGroupAsynchronous) + for i := 0; i < util.AddALBServersToServerGroupWaitAvailableMaxRetryTimes; i++ { + time.Sleep(util.AddALBServersToServerGroupWaitAvailableRetryInterval) + + isCompleted, err := isRegisterServersCompleted(ctx, serverMgr, sgpID, servers) + if err != nil { + serverMgr.logger.V(util.MgrLogLevel).Error(err, "failed to add server to server group asynchronous", + "serverGroupID", sgpID, + "servers", servers, + "traceID", traceID, + util.Action, util.AddALBServersToServerGroupAsynchronous) + return err + } + if isCompleted { + break + } + } + serverMgr.logger.V(util.MgrLogLevel).Info("added server to server group asynchronous", + "serverGroupID", sgpID, + "traceID", traceID, + "requestID", addServerToSgpResp.RequestId, + "elapsedTime", time.Since(asynchronousStartTime).Milliseconds(), + util.Action, util.AddALBServersToServerGroupAsynchronous) + } + + return nil +} + +type BatchRegisterServersFunc func(context.Context, *ALBProvider, string, []albsdk.AddServersToServerGroupServers) error + +func BatchRegisterServers(ctx context.Context, serverMgr *ALBProvider, sgpID string, servers []albsdk.AddServersToServerGroupServers, cnt int, batch BatchRegisterServersFunc) error { + if cnt <= 0 || cnt >= util.BatchRegisterDeregisterServersMaxNum { + cnt = util.BatchRegisterServersDefaultNum + } + + for len(servers) > cnt { + if err := batch(ctx, serverMgr, sgpID, servers[0:cnt]); err != nil { + return err + } + servers = servers[cnt:] + } + if len(servers) <= 0 { + return nil + } + + return batch(ctx, serverMgr, sgpID, servers) +} + +func (m *ALBProvider) RegisterALBServers(ctx context.Context, serverGroupID string, resServers []alb.BackendItem) error { + if len(serverGroupID) == 0 { + return fmt.Errorf("empty server group id when register servers error") + } + + if len(resServers) == 0 { + return nil + } + + serversToAdd, err := transModelBackendsToSDKAddServersToServerGroupServers(resServers) + if err != nil { + return err + } + + return BatchRegisterServers(ctx, m, serverGroupID, serversToAdd, util.BatchRegisterServersDefaultNum, registerServersFunc) +} + +var deregisterServersFunc = func(ctx context.Context, serverMgr *ALBProvider, sgpID string, servers []albsdk.RemoveServersFromServerGroupServers) error { + if len(servers) == 0 { + return nil + } + + traceID := ctx.Value(util.TraceID) + + removeServerFromSgpReq := albsdk.CreateRemoveServersFromServerGroupRequest() + removeServerFromSgpReq.ServerGroupId = sgpID + removeServerFromSgpReq.Servers = &servers + + startTime := time.Now() + serverMgr.logger.V(util.MgrLogLevel).Info("removing server from server group", + "serverGroupID", sgpID, + "traceID", traceID, + "servers", servers, + "startTime", startTime, + util.Action, util.RemoveALBServersFromServerGroup) + removeServerFromSgpResp, err := serverMgr.auth.ALB.RemoveServersFromServerGroup(removeServerFromSgpReq) + if err != nil { + return err + } + serverMgr.logger.V(util.MgrLogLevel).Info("removed server from server group", + "serverGroupID", sgpID, + "traceID", traceID, + "requestID", removeServerFromSgpResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.RemoveALBServersFromServerGroup) + + if util.IsWaitServersAsynchronousComplete { + asynchronousStartTime := time.Now() + serverMgr.logger.V(util.MgrLogLevel).Info("removing server from server group asynchronous", + "serverGroupID", sgpID, + "traceID", traceID, + "servers", servers, + "startTime", startTime, + util.Action, util.RemoveALBServersFromServerGroupAsynchronous) + for i := 0; i < util.RemoveALBServersFromServerGroupMaxRetryTimes; i++ { + time.Sleep(util.RemoveALBServersFromServerGroupRetryInterval) + + isCompleted, err := isDeregisterServersCompleted(ctx, serverMgr, sgpID, servers) + if err != nil { + serverMgr.logger.V(util.MgrLogLevel).Error(err, "failed to remove server from server group asynchronous", + "serverGroupID", sgpID, + "traceID", traceID, + "requestID", removeServerFromSgpResp.RequestId, + "elapsedTime", time.Since(asynchronousStartTime).Milliseconds(), + util.Action, util.RemoveALBServersFromServerGroupAsynchronous) + return err + } + if isCompleted { + break + } + } + serverMgr.logger.V(util.MgrLogLevel).Info("removed server from server group asynchronous", + "serverGroupID", sgpID, + "traceID", traceID, + "requestID", removeServerFromSgpResp.RequestId, + "elapsedTime", time.Since(asynchronousStartTime).Milliseconds(), + util.Action, util.RemoveALBServersFromServerGroupAsynchronous) + } + + return nil +} + +type DeregisterServersFunc func(context.Context, *ALBProvider, string, []albsdk.RemoveServersFromServerGroupServers) error + +func BatchDeregisterServers(ctx context.Context, serverMgr *ALBProvider, sgpID string, servers []albsdk.RemoveServersFromServerGroupServers, cnt int, batch DeregisterServersFunc) error { + if cnt <= 0 || cnt >= util.BatchRegisterDeregisterServersMaxNum { + cnt = util.BatchRegisterServersDefaultNum + } + + for len(servers) > cnt { + if err := batch(ctx, serverMgr, sgpID, servers[0:cnt]); err != nil { + return err + } + servers = servers[cnt:] + } + if len(servers) <= 0 { + return nil + } + + return batch(ctx, serverMgr, sgpID, servers) +} + +func (m *ALBProvider) DeregisterALBServers(ctx context.Context, serverGroupID string, sdkServers []albsdk.BackendServer) error { + if len(serverGroupID) == 0 { + return fmt.Errorf("empty server group id when deregister servers error") + } + + if len(sdkServers) == 0 { + return nil + } + + serversToRemove := make([]albsdk.RemoveServersFromServerGroupServers, 0) + for _, sdkServer := range sdkServers { + if isServerStatusRemoving(sdkServer.Status) { + continue + } + serverToRemove, err := transSDKBackendServerToRemoveServersFromServerGroupServer(sdkServer) + if err != nil { + return err + } + serversToRemove = append(serversToRemove, *serverToRemove) + } + + if len(serversToRemove) == 0 { + return nil + } + + return BatchDeregisterServers(ctx, m, serverGroupID, serversToRemove, util.BatchDeregisterServersDefaultNum, deregisterServersFunc) +} + +func (m *ALBProvider) ReplaceALBServers(ctx context.Context, serverGroupID string, resServers []alb.BackendItem, sdkServers []albsdk.BackendServer) error { + if len(serverGroupID) == 0 { + return fmt.Errorf("empty server group id when replace servers error") + } + + traceID := ctx.Value(util.TraceID) + + if len(resServers) == 0 && len(sdkServers) == 0 { + return nil + } + + addedServers, err := transModelBackendsToSDKReplaceServersInServerGroupAddedServers(resServers) + if err != nil { + return err + } + + removedServers := make([]albsdk.ReplaceServersInServerGroupRemovedServers, 0) + for _, sdkServer := range sdkServers { + if isServerStatusRemoving(sdkServer.Status) { + continue + } + serverToRemove, err := transSDKBackendServerToReplaceServersInServerGroupRemovedServer(sdkServer) + if err != nil { + return err + } + removedServers = append(removedServers, *serverToRemove) + } + + replaceServerFromSgpReq := albsdk.CreateReplaceServersInServerGroupRequest() + replaceServerFromSgpReq.ServerGroupId = serverGroupID + replaceServerFromSgpReq.AddedServers = &addedServers + replaceServerFromSgpReq.RemovedServers = &removedServers + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("replacing server in server group", + "serverGroupID", serverGroupID, + "traceID", traceID, + "addedServers", addedServers, + "removedServers", removedServers, + "startTime", startTime, + util.Action, util.ReplaceALBServersInServerGroup) + replaceServerFromSgpResp, err := m.auth.ALB.ReplaceServersInServerGroup(replaceServerFromSgpReq) + if err != nil { + return err + } + m.logger.V(util.MgrLogLevel).Info("replaced server in server group", + "serverGroupID", serverGroupID, + "traceID", traceID, + "requestID", replaceServerFromSgpResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ReplaceALBServersInServerGroup) + + if util.IsWaitServersAsynchronousComplete { + asynchronousStartTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("replacing server in server group asynchronous", + "serverGroupID", serverGroupID, + "traceID", traceID, + "addedServers", addedServers, + "removedServers", removedServers, + "startTime", startTime, + util.Action, util.ReplaceALBServersInServerGroupAsynchronous) + for i := 0; i < util.ReplaceALBServersInServerGroupMaxRetryTimes; i++ { + time.Sleep(util.ReplaceALBServersInServerGroupRetryInterval) + + isCompleted, err := isReplaceServersCompleted(ctx, m, serverGroupID, addedServers, removedServers) + if err != nil { + m.logger.V(util.MgrLogLevel).Error(err, "failed to replace server in server group asynchronous", + "serverGroupID", serverGroupID, + "traceID", traceID, + "requestID", replaceServerFromSgpResp.RequestId, + util.Action, util.ReplaceALBServersInServerGroupAsynchronous) + return err + } + if isCompleted { + break + } + } + m.logger.V(util.MgrLogLevel).Info("replaced server in server group asynchronous", + "serverGroupID", serverGroupID, + "traceID", traceID, + "requestID", replaceServerFromSgpResp.RequestId, + "elapsedTime", time.Since(asynchronousStartTime).Milliseconds(), + util.Action, util.ReplaceALBServersInServerGroupAsynchronous) + } + + return nil +} + +func (m *ALBProvider) ListALBServers(ctx context.Context, serverGroupID string) ([]albsdk.BackendServer, error) { + if len(serverGroupID) == 0 { + return nil, fmt.Errorf("empty server group id when list servers error") + } + + traceID := ctx.Value(util.TraceID) + + var ( + nextToken string + servers []albsdk.BackendServer + ) + + listSgpServersReq := albsdk.CreateListServerGroupServersRequest() + listSgpServersReq.ServerGroupId = serverGroupID + + for { + listSgpServersReq.NextToken = nextToken + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("listing servers", + "serverGroupID", serverGroupID, + "traceID", traceID, + "startTime", startTime, + util.Action, util.ListALBServerGroupServers) + listSgpServersResp, err := m.auth.ALB.ListServerGroupServers(listSgpServersReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("listed servers", + "serverGroupID", serverGroupID, + "traceID", traceID, + "servers", listSgpServersResp.Servers, + "requestID", listSgpServersResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ListALBServerGroupServers) + + servers = append(servers, listSgpServersResp.Servers...) + + if listSgpServersResp.NextToken == "" { + break + } else { + nextToken = listSgpServersResp.NextToken + } + } + + return servers, nil +} + +func isServerStatusRemoving(status string) bool { + return strings.EqualFold(status, util.ServerStatusRemoving) +} + +func transSDKBackendServerToRemoveServersFromServerGroupServer(server albsdk.BackendServer) (*albsdk.RemoveServersFromServerGroupServers, error) { + serverToRemove := new(albsdk.RemoveServersFromServerGroupServers) + + serverToRemove.ServerIp = server.ServerIp + if len(server.ServerId) == 0 { + return nil, fmt.Errorf("invalid server id for server: %v", server) + } + serverToRemove.ServerId = server.ServerId + + if !isServerPortValid(server.Port) { + return nil, fmt.Errorf("invalid server port for server: %v", server) + } + serverToRemove.Port = strconv.Itoa(server.Port) + + if !isServerTypeValid(server.ServerType) { + return nil, fmt.Errorf("invalid server type for server: %v", server) + } + serverToRemove.ServerType = server.ServerType + + return serverToRemove, nil +} + +func transSDKBackendServerToReplaceServersInServerGroupRemovedServer(server albsdk.BackendServer) (*albsdk.ReplaceServersInServerGroupRemovedServers, error) { + serverToRemove := new(albsdk.ReplaceServersInServerGroupRemovedServers) + + serverToRemove.ServerIp = server.ServerIp + if len(server.ServerId) == 0 { + return nil, fmt.Errorf("invalid server id for server: %v", server) + } + serverToRemove.ServerId = server.ServerId + + if !isServerPortValid(server.Port) { + return nil, fmt.Errorf("invalid server port for server: %v", server) + } + serverToRemove.Port = strconv.Itoa(server.Port) + + if !isServerTypeValid(server.ServerType) { + return nil, fmt.Errorf("invalid server type for server: %v", server) + } + serverToRemove.ServerType = server.ServerType + + return serverToRemove, nil +} + +func transModelBackendToSDKAddServersToServerGroupServer(server alb.BackendItem) (*albsdk.AddServersToServerGroupServers, error) { + serverToAdd := new(albsdk.AddServersToServerGroupServers) + + serverToAdd.ServerIp = server.ServerIp + + if len(server.ServerId) == 0 { + return nil, fmt.Errorf("invalid server id for server: %v", server) + } + serverToAdd.ServerId = server.ServerId + + if !isServerPortValid(server.Port) { + return nil, fmt.Errorf("invalid server port for server: %v", server) + } + serverToAdd.Port = strconv.Itoa(server.Port) + + if !isServerTypeValid(server.Type) { + return nil, fmt.Errorf("invalid server type for server: %v", server) + } + serverToAdd.ServerType = server.Type + + if !isServerWeightValid(server.Weight) { + return nil, fmt.Errorf("invalid server weight for server: %v", server) + } + serverToAdd.Weight = strconv.Itoa(server.Weight) + + return serverToAdd, nil +} + +func transModelBackendToSDKReplaceServersInServerGroupAddedServer(server alb.BackendItem) (*albsdk.ReplaceServersInServerGroupAddedServers, error) { + serverToAdd := new(albsdk.ReplaceServersInServerGroupAddedServers) + + serverToAdd.ServerIp = server.ServerIp + + if len(server.ServerId) == 0 { + return nil, fmt.Errorf("invalid server id for server: %v", server) + } + serverToAdd.ServerId = server.ServerId + + if !isServerPortValid(server.Port) { + return nil, fmt.Errorf("invalid server port for server: %v", server) + } + serverToAdd.Port = strconv.Itoa(server.Port) + + if !isServerTypeValid(server.Type) { + return nil, fmt.Errorf("invalid server type for server: %v", server) + } + serverToAdd.ServerType = server.Type + + if !isServerWeightValid(server.Weight) { + return nil, fmt.Errorf("invalid server weight for server: %v", server) + } + serverToAdd.Weight = strconv.Itoa(server.Weight) + + return serverToAdd, nil +} + +func transModelBackendsToSDKAddServersToServerGroupServers(servers []alb.BackendItem) ([]albsdk.AddServersToServerGroupServers, error) { + serversToAdd := make([]albsdk.AddServersToServerGroupServers, 0) + for _, resServer := range servers { + serverToAdd, err := transModelBackendToSDKAddServersToServerGroupServer(resServer) + if err != nil { + return nil, err + } + serversToAdd = append(serversToAdd, *serverToAdd) + } + return serversToAdd, nil +} + +func transModelBackendsToSDKReplaceServersInServerGroupAddedServers(servers []alb.BackendItem) ([]albsdk.ReplaceServersInServerGroupAddedServers, error) { + serversToAdd := make([]albsdk.ReplaceServersInServerGroupAddedServers, 0) + for _, resServer := range servers { + serverToAdd, err := transModelBackendToSDKReplaceServersInServerGroupAddedServer(resServer) + if err != nil { + return nil, err + } + serversToAdd = append(serversToAdd, *serverToAdd) + } + return serversToAdd, nil +} + +func isServerPortValid(port int) bool { + if port < 1 || port > 65535 { + return false + } + return true +} + +func isServerTypeValid(serverType string) bool { + if !strings.EqualFold(serverType, util.ServerTypeEcs) && + !strings.EqualFold(serverType, util.ServerTypeEni) && + !strings.EqualFold(serverType, util.ServerTypeEci) { + return false + } + + return true +} + +func isServerWeightValid(weight int) bool { + if weight < 0 || weight > 100 { + return false + } + return true +} + +func isRegisterServersCompleted(ctx context.Context, serverMgr *ALBProvider, sgpID string, servers []albsdk.AddServersToServerGroupServers) (bool, error) { + sdkServers, err := serverMgr.ListALBServers(ctx, sgpID) + if err != nil { + return false, err + } + + var isCompleted = true + for _, server := range servers { + var serverUID string + if len(server.ServerIp) == 0 { + serverUID = fmt.Sprintf("%v:%v", server.ServerId, server.Port) + } else { + serverUID = fmt.Sprintf("%v:%v:%v", server.ServerId, server.ServerIp, server.Port) + } + + isExist := false + var backendServer albsdk.BackendServer + for _, sdkServer := range sdkServers { + var sdkServerUID string + if len(server.ServerIp) == 0 { + sdkServerUID = fmt.Sprintf("%v:%v", sdkServer.ServerId, sdkServer.Port) + } else { + sdkServerUID = fmt.Sprintf("%v:%v:%v", sdkServer.ServerId, sdkServer.ServerIp, sdkServer.Port) + } + if strings.EqualFold(serverUID, sdkServerUID) { + isExist = true + backendServer = sdkServer + break + } + } + + if isExist && strings.EqualFold(backendServer.Status, util.ServerStatusAvailable) { + continue + } + + isCompleted = false + break + } + + if isCompleted { + return true, nil + } + + return false, nil +} + +func isDeregisterServersCompleted(ctx context.Context, serverMgr *ALBProvider, sgpID string, servers []albsdk.RemoveServersFromServerGroupServers) (bool, error) { + sdkServers, err := serverMgr.ListALBServers(ctx, sgpID) + if err != nil { + return false, err + } + + var isCompleted = true + for _, server := range servers { + var serverUID string + if len(server.ServerIp) == 0 { + serverUID = fmt.Sprintf("%v:%v", server.ServerId, server.Port) + } else { + serverUID = fmt.Sprintf("%v:%v:%v", server.ServerId, server.ServerIp, server.Port) + } + + isExist := false + for _, sdkServer := range sdkServers { + var sdkServerUID string + if len(server.ServerIp) == 0 { + sdkServerUID = fmt.Sprintf("%v:%v", sdkServer.ServerId, sdkServer.Port) + } else { + sdkServerUID = fmt.Sprintf("%v:%v:%v", sdkServer.ServerId, sdkServer.ServerIp, sdkServer.Port) + } + if strings.EqualFold(serverUID, sdkServerUID) { + isExist = true + break + } + } + + if isExist { + isCompleted = false + break + } + } + + if isCompleted { + return true, nil + } + + return false, nil +} + +func isRegisterServersForReplaceCompleted(sdkServers []albsdk.BackendServer, servers []albsdk.ReplaceServersInServerGroupAddedServers) (bool, error) { + var isCompleted = true + for _, server := range servers { + var serverUID string + if len(server.ServerIp) == 0 { + serverUID = fmt.Sprintf("%v:%v", server.ServerId, server.Port) + } else { + serverUID = fmt.Sprintf("%v:%v:%v", server.ServerId, server.ServerIp, server.Port) + } + + isExist := false + var backendServer albsdk.BackendServer + for _, sdkServer := range sdkServers { + var sdkServerUID string + if len(server.ServerIp) == 0 { + sdkServerUID = fmt.Sprintf("%v:%v", sdkServer.ServerId, sdkServer.Port) + } else { + sdkServerUID = fmt.Sprintf("%v:%v:%v", sdkServer.ServerId, sdkServer.ServerIp, sdkServer.Port) + } + if strings.EqualFold(serverUID, sdkServerUID) { + isExist = true + backendServer = sdkServer + break + } + } + + if isExist && strings.EqualFold(backendServer.Status, util.ServerStatusAvailable) { + continue + } + + isCompleted = false + break + } + + if isCompleted { + return true, nil + } + + return false, nil +} + +func isDeregisterServersForReplaceCompleted(sdkServers []albsdk.BackendServer, servers []albsdk.ReplaceServersInServerGroupRemovedServers) (bool, error) { + var isCompleted = true + for _, server := range servers { + var serverUID string + if len(server.ServerIp) == 0 { + serverUID = fmt.Sprintf("%v:%v", server.ServerId, server.Port) + } else { + serverUID = fmt.Sprintf("%v:%v:%v", server.ServerId, server.ServerIp, server.Port) + } + + isExist := false + for _, sdkServer := range sdkServers { + var sdkServerUID string + if len(server.ServerIp) == 0 { + sdkServerUID = fmt.Sprintf("%v:%v", sdkServer.ServerId, sdkServer.Port) + } else { + sdkServerUID = fmt.Sprintf("%v:%v:%v", sdkServer.ServerId, sdkServer.ServerIp, sdkServer.Port) + } + if strings.EqualFold(serverUID, sdkServerUID) { + isExist = true + break + } + } + + if isExist { + isCompleted = false + break + } + } + + if isCompleted { + return true, nil + } + + return false, nil +} + +func isReplaceServersCompleted(ctx context.Context, m *ALBProvider, serverGroupID string, registerServers []albsdk.ReplaceServersInServerGroupAddedServers, deregisterServers []albsdk.ReplaceServersInServerGroupRemovedServers) (bool, error) { + sdkServers, err := m.ListALBServers(ctx, serverGroupID) + if err != nil { + return false, err + } + + isRegisterComplete, err := isRegisterServersForReplaceCompleted(sdkServers, registerServers) + if err != nil { + return false, err + } + isDeregisterComplete, err := isDeregisterServersForReplaceCompleted(sdkServers, deregisterServers) + if err != nil { + return false, err + } + + if isRegisterComplete && isDeregisterComplete { + return true, nil + } + + return false, nil + +} diff --git a/pkg/provider/alibaba/alb/server_group.go b/pkg/provider/alibaba/alb/server_group.go new file mode 100644 index 000000000..e224c1085 --- /dev/null +++ b/pkg/provider/alibaba/alb/server_group.go @@ -0,0 +1,451 @@ +package alb + +import ( + "context" + "fmt" + "reflect" + "strconv" + "strings" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/pkg/errors" + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" +) + +func (m *ALBProvider) CreateALBServerGroup(ctx context.Context, resSGP *alb.ServerGroup, trackingProvider tracking.TrackingProvider) (alb.ServerGroupStatus, error) { + traceID := ctx.Value(util.TraceID) + + createSgpReq, err := buildSDKServerGroupCreateRequest(resSGP.Spec) + if err != nil { + return alb.ServerGroupStatus{}, err + } + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("creating server group", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "startTime", startTime, + util.Action, util.CreateALBServerGroup) + createSgpResp, err := m.auth.ALB.CreateServerGroup(createSgpReq) + if err != nil { + return alb.ServerGroupStatus{}, err + } + m.logger.V(util.MgrLogLevel).Info("created server group", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "serverGroupID", createSgpResp.ServerGroupId, + "requestID", createSgpResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.CreateALBServerGroup) + + sgpTags := trackingProvider.ResourceTags(resSGP.Stack(), resSGP, transTagListToMap(resSGP.Spec.Tags)) + tags := transTagMapToSDKTagResourcesTagList(sgpTags) + resIDs := make([]string, 0) + resIDs = append(resIDs, createSgpResp.ServerGroupId) + tagReq := albsdk.CreateTagResourcesRequest() + tagReq.Tag = &tags + tagReq.ResourceId = &resIDs + tagReq.ResourceType = util.ServerGroupResourceType + startTime = time.Now() + m.logger.V(util.MgrLogLevel).Info("tagging resource", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "serverGroupID", createSgpResp.ServerGroupId, + "startTime", startTime, + util.Action, util.TagALBResource) + tagResp, err := m.auth.ALB.TagResources(tagReq) + if err != nil { + if errTmp := m.DeleteALBServerGroup(ctx, createSgpResp.ServerGroupId); errTmp != nil { + m.logger.V(util.MgrLogLevel).Error(errTmp, "roll back server group failed", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "serverGroupID", createSgpResp.ServerGroupId, + util.Action, util.TagALBResource) + } + return alb.ServerGroupStatus{}, err + } + m.logger.V(util.MgrLogLevel).Info("tagged resource", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "serverGroupID", createSgpResp.ServerGroupId, + "requestID", tagResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.TagALBResource) + + return buildReServerGroupStatus(createSgpResp.ServerGroupId), nil +} + +func (m *ALBProvider) UpdateALBServerGroup(ctx context.Context, resSGP *alb.ServerGroup, sdkSGP alb.ServerGroupWithTags) (alb.ServerGroupStatus, error) { + _, err := m.updateServerGroupAttribute(ctx, resSGP, &sdkSGP.ServerGroup) + if err != nil { + return alb.ServerGroupStatus{}, err + } + return buildReServerGroupStatus(sdkSGP.ServerGroupId), nil +} + +func (m *ALBProvider) DeleteALBServerGroup(ctx context.Context, serverGroupID string) error { + traceID := ctx.Value(util.TraceID) + + deleteSgpReq := albsdk.CreateDeleteServerGroupRequest() + deleteSgpReq.ServerGroupId = serverGroupID + + if err := util.RetryImmediateOnError(m.waitSGPDeletionPollInterval, m.waitSGPDeletionTimeout, isServerGroupResourceInUseError, func() error { + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("deleting server group", + "serverGroupID", serverGroupID, + "traceID", traceID, + "startTime", startTime, + util.Action, util.DeleteALBServerGroup) + deleteSgpResp, err := m.auth.ALB.DeleteServerGroup(deleteSgpReq) + if err != nil { + m.logger.V(util.MgrLogLevel).Info("deleting server group", + "serverGroupID", serverGroupID, + "traceID", traceID, + "error", err.Error(), + util.Action, util.DeleteALBServerGroup) + return err + } + m.logger.V(util.MgrLogLevel).Info("deleted server group", + "serverGroupID", serverGroupID, + "traceID", traceID, + "requestID", deleteSgpResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.DeleteALBServerGroup) + return nil + }); err != nil { + return errors.Wrap(err, "failed to delete serverGroup") + } + + return nil +} + +func (m *ALBProvider) updateServerGroupAttribute(ctx context.Context, resSGP *alb.ServerGroup, sdkSGP *albsdk.ServerGroup) (*albsdk.UpdateServerGroupAttributeResponse, error) { + traceID := ctx.Value(util.TraceID) + + var ( + isHealthCheckConfigNeedUpdate, + isStickySessionConfigNeedUpdate, + isServerGroupNameNeedUpdate, + isSchedulerNeedUpdate bool + ) + if resSGP.Spec.ServerGroupName != sdkSGP.ServerGroupName { + m.logger.V(util.MgrLogLevel).Info("ServerGroupName update:", + "res", resSGP.Spec.ServerGroupName, + "sdk", sdkSGP.ServerGroupName, + "serverGroupID", sdkSGP.ServerGroupId, + "traceID", traceID) + isServerGroupNameNeedUpdate = true + } + if !isServerGroupSchedulerValid(resSGP.Spec.Scheduler) { + return nil, fmt.Errorf("invalid server group scheduler: %s", resSGP.Spec.Scheduler) + } + if !strings.EqualFold(resSGP.Spec.Scheduler, sdkSGP.Scheduler) { + m.logger.V(util.MgrLogLevel).Info("Scheduler update:", + "res", resSGP.Spec.Scheduler, + "sdk", sdkSGP.Scheduler, + "serverGroupID", sdkSGP.ServerGroupId, + "traceID", traceID) + isSchedulerNeedUpdate = true + } + + if err := checkHealthCheckConfigValid(resSGP.Spec.HealthCheckConfig); err != nil { + return nil, err + } + if resSGP.Spec.HealthCheckConfig.HealthCheckEnabled { + if !reflect.DeepEqual(resSGP.Spec.HealthCheckConfig, sdkSGP.HealthCheckConfig) { + m.logger.V(util.MgrLogLevel).Info("HealthCheckConfig update:", + "res", resSGP.Spec.HealthCheckConfig, + "sdk", sdkSGP.HealthCheckConfig, + "serverGroupID", sdkSGP.ServerGroupId, + "traceID", traceID) + isHealthCheckConfigNeedUpdate = true + } + } else if !resSGP.Spec.HealthCheckConfig.HealthCheckEnabled && sdkSGP.HealthCheckConfig.HealthCheckEnabled { + m.logger.V(util.MgrLogLevel).Info("HealthCheckConfig update:", + "res", resSGP.Spec.HealthCheckConfig, + "sdk", sdkSGP.HealthCheckConfig, + "serverGroupID", sdkSGP.ServerGroupId, + "traceID", traceID) + isHealthCheckConfigNeedUpdate = true + } + + if err := checkStickySessionConfigValid(resSGP.Spec.StickySessionConfig); err != nil { + return nil, err + } + if resSGP.Spec.StickySessionConfig.StickySessionEnabled { + if !reflect.DeepEqual(resSGP.Spec.StickySessionConfig, sdkSGP.StickySessionConfig) { + m.logger.V(util.MgrLogLevel).Info("StickySessionConfig update:", + "res", resSGP.Spec.StickySessionConfig, + "sdk", sdkSGP.StickySessionConfig, + "serverGroupID", sdkSGP.ServerGroupId, + "traceID", traceID) + isStickySessionConfigNeedUpdate = true + } + } else if !resSGP.Spec.StickySessionConfig.StickySessionEnabled && sdkSGP.StickySessionConfig.StickySessionEnabled { + m.logger.V(util.MgrLogLevel).Info("StickySessionConfig update:", + "res", resSGP.Spec.StickySessionConfig, + "sdk", sdkSGP.StickySessionConfig, + "serverGroupID", sdkSGP.ServerGroupId, + "traceID", traceID) + isStickySessionConfigNeedUpdate = true + } + + if !isServerGroupNameNeedUpdate && !isSchedulerNeedUpdate && + !isHealthCheckConfigNeedUpdate && !isStickySessionConfigNeedUpdate { + return nil, nil + } + + updateSgpReq := albsdk.CreateUpdateServerGroupAttributeRequest() + updateSgpReq.ServerGroupId = sdkSGP.ServerGroupId + + if isServerGroupNameNeedUpdate { + updateSgpReq.ServerGroupName = resSGP.Spec.ServerGroupName + } + if isSchedulerNeedUpdate { + updateSgpReq.Scheduler = resSGP.Spec.Scheduler + } + if isHealthCheckConfigNeedUpdate { + updateSgpReq.HealthCheckConfig = *transSDKHealthCheckConfigToUpdateSGP(resSGP.Spec.HealthCheckConfig) + } + if isStickySessionConfigNeedUpdate { + updateSgpReq.StickySessionConfig = *transSDKStickySessionConfigToUpdateSGP(resSGP.Spec.StickySessionConfig) + } + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("updating server group attribute", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "serverGroupID", sdkSGP.ServerGroupId, + "startTime", startTime, + util.Action, util.UpdateALBServerGroupAttribute) + updateSgpResp, err := m.auth.ALB.UpdateServerGroupAttribute(updateSgpReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("updated server group attribute", + "stackID", resSGP.Stack().StackID(), + "resourceID", resSGP.ID(), + "traceID", traceID, + "serverGroupID", sdkSGP.ServerGroupId, + "requestID", updateSgpResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.UpdateALBServerGroupAttribute) + + return updateSgpResp, nil +} + +func buildSDKServerGroupCreateRequest(sgpSpec alb.ServerGroupSpec) (*albsdk.CreateServerGroupRequest, error) { + sgpReq := albsdk.CreateCreateServerGroupRequest() + + sgpReq.ServerGroupName = sgpSpec.ServerGroupName + + if len(sgpSpec.VpcId) == 0 { + return nil, fmt.Errorf("invalid server group vpc id: %s", sgpSpec.VpcId) + } + sgpReq.VpcId = sgpSpec.VpcId + + if !isServerGroupSchedulerValid(sgpSpec.Scheduler) { + return nil, fmt.Errorf("invalid server group scheduler: %s", sgpSpec.Scheduler) + } + sgpReq.Scheduler = sgpSpec.Scheduler + + if !isServerGroupProtocolValid(sgpSpec.Protocol) { + return nil, fmt.Errorf("invalid server group protocol: %s", sgpSpec.Protocol) + } + sgpReq.Protocol = sgpSpec.Protocol + + sgpReq.ResourceGroupId = sgpSpec.ResourceGroupId + if err := checkHealthCheckConfigValid(sgpSpec.HealthCheckConfig); err != nil { + return nil, err + } + sgpReq.HealthCheckConfig = *transSDKHealthCheckConfigToCreateSGP(sgpSpec.HealthCheckConfig) + if err := checkStickySessionConfigValid(sgpSpec.StickySessionConfig); err != nil { + return nil, err + } + sgpReq.StickySessionConfig = *transSDKStickySessionConfigToCreateSGP(sgpSpec.StickySessionConfig) + sgpReq.ServerGroupType = sgpSpec.ServerGroupType + + return sgpReq, nil +} + +func checkHealthCheckConfigValid(conf alb.HealthCheckConfig) error { + if !conf.HealthCheckEnabled { + return nil + } + + if conf.HealthCheckConnectPort < 0 || conf.HealthCheckConnectPort > 65535 { + return fmt.Errorf("invalid server group HealthCheckConnectPort: %v", conf.HealthCheckConnectPort) + } + if !strings.EqualFold(conf.HealthCheckHttpVersion, util.ServerGroupHealthCheckHttpVersion10) && + !strings.EqualFold(conf.HealthCheckHttpVersion, util.ServerGroupHealthCheckHttpVersion11) { + return fmt.Errorf("invalid server group HealthCheckHttpVersion: %v", conf.HealthCheckHttpVersion) + } + if conf.HealthCheckInterval < 1 || conf.HealthCheckInterval > 50 { + return fmt.Errorf("invalid server group HealthCheckInterval: %v", conf.HealthCheckInterval) + } + if !strings.EqualFold(conf.HealthCheckMethod, util.ServerGroupHealthCheckMethodGET) && + !strings.EqualFold(conf.HealthCheckMethod, util.ServerGroupHealthCheckMethodHEAD) { + return fmt.Errorf("invalid server group HealthCheckMethod: %v", conf.HealthCheckMethod) + } + if !strings.EqualFold(conf.HealthCheckProtocol, util.ServerGroupHealthCheckProtocolHTTP) && + !strings.EqualFold(conf.HealthCheckProtocol, util.ServerGroupHealthCheckProtocolHTTPS) { + return fmt.Errorf("invalid server group HealthCheckProtocol: %v", conf.HealthCheckProtocol) + } + if conf.HealthCheckTimeout < 1 || conf.HealthCheckTimeout > 300 { + return fmt.Errorf("invalid server group HealthCheckTimeout: %v", conf.HealthCheckTimeout) + } + if conf.HealthyThreshold < 2 || conf.HealthyThreshold > 10 { + return fmt.Errorf("invalid server group HealthyThreshold: %v", conf.HealthyThreshold) + } + if conf.UnhealthyThreshold < 2 || conf.UnhealthyThreshold > 10 { + return fmt.Errorf("invalid server group UnhealthyThreshold: %v", conf.UnhealthyThreshold) + } + + return nil +} + +func checkStickySessionConfigValid(conf alb.StickySessionConfig) error { + if !conf.StickySessionEnabled { + return nil + } + + if !strings.EqualFold(conf.StickySessionType, util.ServerGroupStickySessionTypeInsert) && + !strings.EqualFold(conf.StickySessionType, util.ServerGroupStickySessionTypeServer) { + return fmt.Errorf("invalid server group StickySessionType: %v", conf.StickySessionType) + } + + if strings.EqualFold(conf.StickySessionType, util.ServerGroupStickySessionTypeInsert) { + if conf.CookieTimeout < 1 || conf.CookieTimeout > 86400 { + return fmt.Errorf("invalid server group CookieTimeout: %v", conf.CookieTimeout) + } + } + + if strings.EqualFold(conf.StickySessionType, util.ServerGroupStickySessionTypeServer) { + if len(conf.Cookie) == 0 { + return fmt.Errorf("invalid server group Cookie: %v", conf.Cookie) + } + } + + return nil +} + +func isServerGroupResourceInUseError(err error) bool { + if strings.Contains(err.Error(), "ResourceInUse.ServerGroup") || + strings.Contains(err.Error(), "IncorrectStatus.ServerGroup") { + return true + } + return false +} + +func isServerGroupSchedulerValid(scheduler string) bool { + if strings.EqualFold(scheduler, util.ServerGroupSchedulerWrr) || + strings.EqualFold(scheduler, util.ServerGroupSchedulerWlc) || + strings.EqualFold(scheduler, util.ServerGroupSchedulerSch) { + return true + } + return false +} +func isServerGroupProtocolValid(protocol string) bool { + if strings.EqualFold(protocol, util.ServerGroupProtocolHTTP) || + strings.EqualFold(protocol, util.ServerGroupProtocolHTTPS) { + return true + } + return false +} + +func buildReServerGroupStatus(serverGroupID string) alb.ServerGroupStatus { + return alb.ServerGroupStatus{ + ServerGroupID: serverGroupID, + } +} + +func transSDKHealthCheckConfigToCreateSGP(conf alb.HealthCheckConfig) *albsdk.CreateServerGroupHealthCheckConfig { + if !conf.HealthCheckEnabled { + return &albsdk.CreateServerGroupHealthCheckConfig{ + HealthCheckEnabled: strconv.FormatBool(conf.HealthCheckEnabled), + } + } + + return &albsdk.CreateServerGroupHealthCheckConfig{ + HealthCheckCodes: &conf.HealthCheckHttpCodes, + HealthCheckEnabled: strconv.FormatBool(conf.HealthCheckEnabled), + HealthCheckTimeout: strconv.Itoa(conf.HealthCheckTimeout), + HealthCheckMethod: conf.HealthCheckMethod, + HealthCheckHost: conf.HealthCheckHost, + HealthCheckProtocol: conf.HealthCheckProtocol, + UnhealthyThreshold: strconv.Itoa(conf.UnhealthyThreshold), + HealthyThreshold: strconv.Itoa(conf.HealthyThreshold), + HealthCheckTcpFastCloseEnabled: strconv.FormatBool(conf.HealthCheckTcpFastCloseEnabled), + HealthCheckPath: conf.HealthCheckPath, + HealthCheckInterval: strconv.Itoa(conf.HealthCheckInterval), + HealthCheckHttpCodes: &conf.HealthCheckHttpCodes, + HealthCheckHttpVersion: conf.HealthCheckHttpVersion, + HealthCheckConnectPort: strconv.Itoa(conf.HealthCheckConnectPort), + } +} + +func transSDKStickySessionConfigToCreateSGP(conf alb.StickySessionConfig) *albsdk.CreateServerGroupStickySessionConfig { + if !conf.StickySessionEnabled { + return &albsdk.CreateServerGroupStickySessionConfig{ + StickySessionEnabled: strconv.FormatBool(conf.StickySessionEnabled), + } + } + + return &albsdk.CreateServerGroupStickySessionConfig{ + StickySessionEnabled: strconv.FormatBool(conf.StickySessionEnabled), + Cookie: conf.Cookie, + CookieTimeout: strconv.Itoa(conf.CookieTimeout), + StickySessionType: conf.StickySessionType, + } +} + +func transSDKHealthCheckConfigToUpdateSGP(conf alb.HealthCheckConfig) *albsdk.UpdateServerGroupAttributeHealthCheckConfig { + if !conf.HealthCheckEnabled { + return &albsdk.UpdateServerGroupAttributeHealthCheckConfig{ + HealthCheckEnabled: strconv.FormatBool(conf.HealthCheckEnabled), + } + } + + return &albsdk.UpdateServerGroupAttributeHealthCheckConfig{ + HealthCheckCodes: &conf.HealthCheckHttpCodes, + HealthCheckEnabled: strconv.FormatBool(conf.HealthCheckEnabled), + HealthCheckTimeout: strconv.Itoa(conf.HealthCheckTimeout), + HealthCheckMethod: conf.HealthCheckMethod, + HealthCheckHost: conf.HealthCheckHost, + HealthCheckProtocol: conf.HealthCheckProtocol, + UnhealthyThreshold: strconv.Itoa(conf.UnhealthyThreshold), + HealthyThreshold: strconv.Itoa(conf.HealthyThreshold), + HealthCheckTcpFastCloseEnabled: strconv.FormatBool(conf.HealthCheckTcpFastCloseEnabled), + HealthCheckPath: conf.HealthCheckPath, + HealthCheckInterval: strconv.Itoa(conf.HealthCheckInterval), + HealthCheckHttpCodes: &conf.HealthCheckHttpCodes, + HealthCheckHttpVersion: conf.HealthCheckHttpVersion, + HealthCheckConnectPort: strconv.Itoa(conf.HealthCheckConnectPort), + } +} + +func transSDKStickySessionConfigToUpdateSGP(conf alb.StickySessionConfig) *albsdk.UpdateServerGroupAttributeStickySessionConfig { + if !conf.StickySessionEnabled { + return &albsdk.UpdateServerGroupAttributeStickySessionConfig{ + StickySessionEnabled: strconv.FormatBool(conf.StickySessionEnabled), + } + } + + return &albsdk.UpdateServerGroupAttributeStickySessionConfig{ + StickySessionEnabled: strconv.FormatBool(conf.StickySessionEnabled), + Cookie: conf.Cookie, + CookieTimeout: strconv.Itoa(conf.CookieTimeout), + StickySessionType: conf.StickySessionType, + } +} diff --git a/pkg/provider/alibaba/alb/tagging.go b/pkg/provider/alibaba/alb/tagging.go new file mode 100644 index 000000000..840544fd8 --- /dev/null +++ b/pkg/provider/alibaba/alb/tagging.go @@ -0,0 +1,213 @@ +package alb + +import ( + "context" + "fmt" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/util" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" +) + +func transTagFilterToListServerGroupTags(tagFilters map[string]string) []albsdk.ListServerGroupsTag { + listTags := make([]albsdk.ListServerGroupsTag, 0) + for k, v := range tagFilters { + listTags = append(listTags, albsdk.ListServerGroupsTag{ + Key: k, + Value: v, + }) + } + return listTags +} +func transTagFilterToListAlbLoadBalancersTags(tagFilters map[string]string) []albsdk.ListLoadBalancersTag { + listTags := make([]albsdk.ListLoadBalancersTag, 0) + for k, v := range tagFilters { + listTags = append(listTags, albsdk.ListLoadBalancersTag{ + Key: k, + Value: v, + }) + } + return listTags +} + +func (m *ALBProvider) ListALBServerGroupsByTag(ctx context.Context, tagFilters map[string]string) ([]albsdk.ServerGroup, error) { + traceID := ctx.Value(util.TraceID) + + if len(tagFilters) == 0 { + return nil, fmt.Errorf("invalid tag filter: %v for listing server groups", tagFilters) + } + + listTags := transTagFilterToListServerGroupTags(tagFilters) + + var ( + nextToken string + serverGroups []albsdk.ServerGroup + ) + + sgpReq := albsdk.CreateListServerGroupsRequest() + sgpReq.Tag = &listTags + + for { + sgpReq.NextToken = nextToken + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("listing server groups by tag", + "tags", listTags, + "traceID", traceID, + "startTime", startTime, + util.Action, util.ListALBServerGroups) + sgpResp, err := m.auth.ALB.ListServerGroups(sgpReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("listed server groups by tag", + "requestID", sgpResp.RequestId, + "traceID", traceID, + "serverGroups", sgpResp.ServerGroups, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ListALBServerGroups) + + serverGroups = append(serverGroups, sgpResp.ServerGroups...) + + if sgpResp.NextToken == "" { + break + } else { + nextToken = sgpResp.NextToken + } + } + + return serverGroups, nil +} +func (m *ALBProvider) ListAlbLoadBalancersByTag(ctx context.Context, tagFilters map[string]string) ([]albsdk.LoadBalancer, error) { + traceID := ctx.Value(util.TraceID) + + if len(tagFilters) == 0 { + return nil, fmt.Errorf("invalid tag filter: %v for listing load balancers", tagFilters) + } + + listTags := transTagFilterToListAlbLoadBalancersTags(tagFilters) + + var ( + nextToken string + loadBalancers []albsdk.LoadBalancer + ) + + lbReq := albsdk.CreateListLoadBalancersRequest() + lbReq.Tag = &listTags + + for { + lbReq.NextToken = nextToken + + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("listing loadBalancers by tag", + "tags", listTags, + "traceID", traceID, + "startTime", startTime, + util.Action, util.ListALBLoadBalancers) + lbResp, err := m.auth.ALB.ListLoadBalancers(lbReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("listed loadBalancers by tag", + "traceID", traceID, + "requestID", lbResp.RequestId, + "loadBalancers", lbResp.LoadBalancers, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.ListALBLoadBalancers) + + loadBalancers = append(loadBalancers, lbResp.LoadBalancers...) + + if lbResp.NextToken == "" { + break + } else { + nextToken = lbResp.NextToken + } + } + + return loadBalancers, nil +} + +func (m *ALBProvider) ListALBServerGroupsWithTags(ctx context.Context, tagFilters map[string]string) ([]alb.ServerGroupWithTags, error) { + serverGroups, err := m.ListALBServerGroupsByTag(ctx, tagFilters) + if err != nil { + return nil, err + } + + serverGroupsWithTags := make([]alb.ServerGroupWithTags, 0) + for _, serverGroup := range serverGroups { + tagMap := transSDKTagListToMap(serverGroup.Tags) + + serverGroupsWithTags = append(serverGroupsWithTags, alb.ServerGroupWithTags{ + ServerGroup: serverGroup, + Tags: tagMap, + }) + } + + return serverGroupsWithTags, nil +} +func (m *ALBProvider) ListALBsWithTags(ctx context.Context, tagFilters map[string]string) ([]alb.AlbLoadBalancerWithTags, error) { + traceID := ctx.Value(util.TraceID) + + lbs, err := m.ListAlbLoadBalancersByTag(ctx, tagFilters) + if err != nil { + return nil, err + } + + lbsWithTags := make([]alb.AlbLoadBalancerWithTags, 0) + for _, lb := range lbs { + getLbReq := albsdk.CreateGetLoadBalancerAttributeRequest() + getLbReq.LoadBalancerId = lb.LoadBalancerId + startTime := time.Now() + m.logger.V(util.MgrLogLevel).Info("getting loadBalancer attribute", + "loadBalancerID", lb.LoadBalancerId, + "traceID", traceID, + "startTime", startTime, + util.Action, util.GetALBLoadBalancerAttribute) + getLbResp, err := m.auth.ALB.GetLoadBalancerAttribute(getLbReq) + if err != nil { + return nil, err + } + m.logger.V(util.MgrLogLevel).Info("got loadBalancer attribute", + "loadBalancerID", lb.LoadBalancerId, + "traceID", traceID, + "requestID", getLbResp.RequestId, + "elapsedTime", time.Since(startTime).Milliseconds(), + util.Action, util.GetALBLoadBalancerAttribute) + + tagMap := transSDKTagListToMap(lb.Tags) + + lbsWithTags = append(lbsWithTags, alb.AlbLoadBalancerWithTags{ + LoadBalancer: *transSDKGetAlbLoadBalancerAttributeResponseToNormal(getLbResp), + Tags: tagMap, + }) + } + + return lbsWithTags, nil +} + +func transSDKGetAlbLoadBalancerAttributeResponseToNormal(resp *albsdk.GetLoadBalancerAttributeResponse) *albsdk.LoadBalancer { + return &albsdk.LoadBalancer{ + AddressAllocatedMode: resp.AddressAllocatedMode, + AddressType: resp.AddressType, + BandwidthCapacity: resp.BandwidthCapacity, + BandwidthPackageId: resp.BandwidthPackageId, + CreateTime: resp.CreateTime, + DNSName: resp.DNSName, + LoadBalancerBussinessStatus: resp.LoadBalancerStatus, + LoadBalancerEdition: resp.LoadBalancerEdition, + LoadBalancerId: resp.LoadBalancerId, + LoadBalancerName: resp.LoadBalancerName, + LoadBalancerStatus: resp.LoadBalancerStatus, + ResourceGroupId: resp.ResourceGroupId, + VpcId: resp.VpcId, + AccessLogConfig: resp.AccessLogConfig, + DeletionProtectionConfig: resp.DeletionProtectionConfig, + LoadBalancerBillingConfig: resp.LoadBalancerBillingConfig, + ModificationProtectionConfig: resp.ModificationProtectionConfig, + LoadBalancerOperationLocks: resp.LoadBalancerOperationLocks, + Tags: resp.Tags, + } +} diff --git a/pkg/provider/alibaba/alibabacloud.go b/pkg/provider/alibaba/alibabacloud.go index e3247ac35..28528f766 100644 --- a/pkg/provider/alibaba/alibabacloud.go +++ b/pkg/provider/alibaba/alibabacloud.go @@ -3,10 +3,13 @@ package alibaba import ( "fmt" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/alb" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/cas" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/ecs" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/pvtz" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/slb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/sls" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/vpc" "k8s.io/cloud-provider-alibaba-cloud/pkg/util/metric" "k8s.io/klog" @@ -33,6 +36,9 @@ func NewAlibabaCloud() prvd.Provider { SLBProvider: slb.NewLBProvider(mgr), PVTZProvider: pvtz.NewPVTZProvider(mgr), VPCProvider: vpc.NewVPCProvider(mgr), + ALBProvider: alb.NewALBProvider(mgr), + SLSProvider: sls.NewSLSProvider(mgr), + CASProvider: cas.NewCASProvider(mgr), } } @@ -43,5 +49,8 @@ type AlibabaCloud struct { *pvtz.PVTZProvider *vpc.VPCProvider *slb.SLBProvider + *alb.ALBProvider + *sls.SLSProvider + *cas.CASProvider prvd.IMetaData } diff --git a/pkg/provider/alibaba/base/clientMgr.go b/pkg/provider/alibaba/base/clientMgr.go index df4ebc5c3..3b20b1eac 100644 --- a/pkg/provider/alibaba/base/clientMgr.go +++ b/pkg/provider/alibaba/base/clientMgr.go @@ -21,15 +21,19 @@ import ( "encoding/json" "fmt" "io/ioutil" - "k8s.io/klog/klogr" "os" "path/filepath" "strings" "time" + "k8s.io/klog/klogr" + + "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/aliyun/alibaba-cloud-sdk-go/services/cas" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" "github.com/aliyun/alibaba-cloud-sdk-go/services/pvtz" "github.com/aliyun/alibaba-cloud-sdk-go/services/slb" + "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" "github.com/ghodss/yaml" "github.com/go-cmd/cmd" @@ -66,6 +70,9 @@ type ClientMgr struct { VPC *vpc.Client SLB *slb.Client PVTZ *pvtz.Client + ALB *alb.Client + SLS *sls.Client + CAS *cas.Client } // NewClientMgr return a new client manager @@ -106,6 +113,30 @@ func NewClientMgr() (*ClientMgr, error) { slbcli.AppendUserAgent(KubernetesCloudControllerManager, version.Version) slbcli.AppendUserAgent(AgentClusterId, CLUSTER_ID) + albcli, err := alb.NewClientWithStsToken( + region, "key", "secret", "") + if err != nil { + return nil, fmt.Errorf("initialize alibaba alb client: %s", err.Error()) + } + albcli.AppendUserAgent(KubernetesCloudControllerManager, version.Version) + albcli.AppendUserAgent(AgentClusterId, CLUSTER_ID) + + slscli, err := sls.NewClientWithStsToken( + region, "key", "secret", "") + if err != nil { + return nil, fmt.Errorf("initialize alibaba sls client: %s", err.Error()) + } + slscli.AppendUserAgent(KubernetesCloudControllerManager, version.Version) + slscli.AppendUserAgent(AgentClusterId, CLUSTER_ID) + + cascli, err := cas.NewClientWithStsToken( + region, "key", "secret", "") + if err != nil { + return nil, fmt.Errorf("initialize alibaba cas client: %s", err.Error()) + } + cascli.AppendUserAgent(KubernetesCloudControllerManager, version.Version) + cascli.AppendUserAgent(AgentClusterId, CLUSTER_ID) + pvtzcli, err := pvtz.NewClientWithStsToken( region, "key", "secret", "", ) @@ -121,6 +152,9 @@ func NewClientMgr() (*ClientMgr, error) { VPC: vpcli, SLB: slbcli, PVTZ: pvtzcli, + ALB: albcli, + SLS: slscli, + CAS: cascli, Region: region, stop: make(<-chan struct{}, 1), } @@ -223,6 +257,27 @@ func RefreshToken(mgr *ClientMgr, token *Token) error { return fmt.Errorf("init slb sts token config: %s", err.Error()) } + err = mgr.ALB.InitWithStsToken( + token.Region, token.AccessKey, token.AccessSecret, token.Token, + ) + if err != nil { + return fmt.Errorf("init alb sts token config: %s", err.Error()) + } + + err = mgr.SLS.InitWithStsToken( + token.Region, token.AccessKey, token.AccessSecret, token.Token, + ) + if err != nil { + return fmt.Errorf("init sls sts token config: %s", err.Error()) + } + + err = mgr.CAS.InitWithStsToken( + token.Region, token.AccessKey, token.AccessSecret, token.Token, + ) + if err != nil { + return fmt.Errorf("init cas sts token config: %s", err.Error()) + } + err = mgr.PVTZ.InitWithStsToken( token.Region, token.AccessKey, token.AccessSecret, token.Token, ) @@ -242,6 +297,9 @@ func setVPCEndpoint(mgr *ClientMgr) { mgr.VPC.Network = "vpc" mgr.SLB.Network = "vpc" mgr.PVTZ.Network = "vpc" + mgr.ALB.Network = "vpc" + mgr.SLS.Network = "vpc" + mgr.CAS.Network = "vpc" } // Token base Token info diff --git a/pkg/provider/alibaba/cas/cas_provider.go b/pkg/provider/alibaba/cas/cas_provider.go new file mode 100644 index 000000000..76591ec0d --- /dev/null +++ b/pkg/provider/alibaba/cas/cas_provider.go @@ -0,0 +1,30 @@ +package cas + +import ( + "context" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + + cassdk "github.com/aliyun/alibaba-cloud-sdk-go/services/cas" +) + +func NewCASProvider( + auth *base.ClientMgr, +) *CASProvider { + return &CASProvider{auth: auth} +} + +var _ prvd.ICAS = &CASProvider{} + +type CASProvider struct { + auth *base.ClientMgr +} + +func (c CASProvider) DescribeSSLCertificateList(ctx context.Context, request *cassdk.DescribeSSLCertificateListRequest) (*cassdk.DescribeSSLCertificateListResponse, error) { + return c.auth.CAS.DescribeSSLCertificateList(request) +} + +func (c CASProvider) DescribeSSLCertificatePublicKeyDetail(ctx context.Context, request *cassdk.DescribeSSLCertificatePublicKeyDetailRequest) (*cassdk.DescribeSSLCertificatePublicKeyDetailResponse, error) { + return c.auth.CAS.DescribeSSLCertificatePublicKeyDetail(request) +} diff --git a/pkg/provider/alibaba/sls/sls_provider.go b/pkg/provider/alibaba/sls/sls_provider.go new file mode 100644 index 000000000..f8f39ccd0 --- /dev/null +++ b/pkg/provider/alibaba/sls/sls_provider.go @@ -0,0 +1,24 @@ +package sls + +import ( + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + + "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" +) + +func NewSLSProvider( + auth *base.ClientMgr, +) *SLSProvider { + return &SLSProvider{auth: auth} +} + +var _ prvd.ISLS = &SLSProvider{} + +type SLSProvider struct { + auth *base.ClientMgr +} + +func (p SLSProvider) AnalyzeProductLog(request *sls.AnalyzeProductLogRequest) (response *sls.AnalyzeProductLogResponse, err error) { + return p.auth.SLS.AnalyzeProductLog(request) +} diff --git a/pkg/provider/alibaba/vpc/vpc.go b/pkg/provider/alibaba/vpc/vpc.go index 86ba1c802..09708d86b 100644 --- a/pkg/provider/alibaba/vpc/vpc.go +++ b/pkg/provider/alibaba/vpc/vpc.go @@ -226,3 +226,36 @@ func (r *VPCProvider) DescribeEipAddresses(ctx context.Context, instanceType str } return ips, nil } + +func (r *VPCProvider) DescribeVSwitches(ctx context.Context, vpcID string) ([]vpc.VSwitch, error) { + req := vpc.CreateDescribeVSwitchesRequest() + req.VpcId = vpcID + + var vSwitches []vpc.VSwitch + next := &util.Pagination{ + PageNumber: 1, + PageSize: 10, + } + + for { + req.PageSize = requests.NewInteger(next.PageSize) + req.PageNumber = requests.NewInteger(next.PageNumber) + resp, err := r.auth.VPC.DescribeVSwitches(req) + if err != nil { + return nil, err + } + + vSwitches = append(vSwitches, resp.VSwitches.VSwitch...) + + pageResult := &util.PaginationResult{ + PageNumber: resp.PageNumber, + PageSize: resp.PageSize, + TotalCount: resp.TotalCount, + } + next = pageResult.NextPage() + if next == nil { + break + } + } + return vSwitches, nil +} diff --git a/pkg/provider/dryrun/alb.go b/pkg/provider/dryrun/alb.go new file mode 100644 index 000000000..53d36167c --- /dev/null +++ b/pkg/provider/dryrun/alb.go @@ -0,0 +1,118 @@ +package dryrun + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/alb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" +) + +func NewDryRunALB( + auth *base.ClientMgr, alb *alb.ALBProvider, +) *DryRunALB { + return &DryRunALB{auth: auth, alb: alb} +} + +var _ prvd.IALB = &DryRunALB{} + +type DryRunALB struct { + auth *base.ClientMgr + alb *alb.ALBProvider +} + +func (p DryRunALB) TagALBResources(request *albsdk.TagResourcesRequest) (response *albsdk.TagResourcesResponse, err error) { + return p.auth.ALB.TagResources(request) +} + +func (p DryRunALB) DescribeALBZones(request *albsdk.DescribeZonesRequest) (response *albsdk.DescribeZonesResponse, err error) { + return nil, nil +} +func (p DryRunALB) CreateALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error) { + return albmodel.LoadBalancerStatus{}, nil +} +func (p DryRunALB) ReuseALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, lbID string, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error) { + return albmodel.LoadBalancerStatus{}, nil +} + +func (p DryRunALB) UpdateALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, sdkLB albsdk.LoadBalancer) (albmodel.LoadBalancerStatus, error) { + return albmodel.LoadBalancerStatus{}, nil +} +func (p DryRunALB) DeleteALB(ctx context.Context, lbID string) error { + return nil +} + +// ALB Listener +func (p DryRunALB) CreateALBListener(ctx context.Context, resLS *albmodel.Listener) (albmodel.ListenerStatus, error) { + return albmodel.ListenerStatus{}, nil +} +func (p DryRunALB) UpdateALBListener(ctx context.Context, resLS *albmodel.Listener, sdkLB *albsdk.Listener) (albmodel.ListenerStatus, error) { + return albmodel.ListenerStatus{}, nil +} +func (p DryRunALB) DeleteALBListener(ctx context.Context, lsID string) error { + return nil +} +func (p DryRunALB) ListALBListeners(ctx context.Context, lbID string) ([]albsdk.Listener, error) { + return nil, nil +} + +// ALB Listener Rule +func (p DryRunALB) CreateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule) (albmodel.ListenerRuleStatus, error) { + return albmodel.ListenerRuleStatus{}, nil +} +func (p DryRunALB) CreateALBListenerRules(ctx context.Context, resLR []*albmodel.ListenerRule) (map[int]albmodel.ListenerRuleStatus, error) { + return nil, nil +} +func (p DryRunALB) UpdateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule, sdkLR *albsdk.Rule) (albmodel.ListenerRuleStatus, error) { + return albmodel.ListenerRuleStatus{}, nil +} +func (p DryRunALB) UpdateALBListenerRules(ctx context.Context, matches []albmodel.ResAndSDKListenerRulePair) error { + return nil +} +func (p DryRunALB) DeleteALBListenerRule(ctx context.Context, sdkLRId string) error { + return nil +} +func (p DryRunALB) DeleteALBListenerRules(ctx context.Context, sdkLRIds []string) error { + return nil +} +func (p DryRunALB) ListALBListenerRules(ctx context.Context, lsID string) ([]albsdk.Rule, error) { + return nil, nil +} + +// ALB Server +func (p DryRunALB) RegisterALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem) error { + return nil +} +func (p DryRunALB) DeregisterALBServers(ctx context.Context, serverGroupID string, sdkServers []albsdk.BackendServer) error { + return nil +} +func (p DryRunALB) ReplaceALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem, sdkServers []albsdk.BackendServer) error { + return nil +} +func (p DryRunALB) ListALBServers(ctx context.Context, serverGroupID string) ([]albsdk.BackendServer, error) { + return nil, nil +} + +// ALB ServerGroup +func (p DryRunALB) CreateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, trackingProvider tracking.TrackingProvider) (albmodel.ServerGroupStatus, error) { + return albmodel.ServerGroupStatus{}, nil +} +func (p DryRunALB) UpdateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, sdkSGP albmodel.ServerGroupWithTags) (albmodel.ServerGroupStatus, error) { + return albmodel.ServerGroupStatus{}, nil +} +func (p DryRunALB) DeleteALBServerGroup(ctx context.Context, serverGroupID string) error { + return nil +} + +// ALB Tags +func (p DryRunALB) ListALBServerGroupsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.ServerGroupWithTags, error) { + return nil, nil +} +func (p DryRunALB) ListALBsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.AlbLoadBalancerWithTags, error) { + return nil, nil +} diff --git a/pkg/provider/dryrun/cas.go b/pkg/provider/dryrun/cas.go new file mode 100644 index 000000000..bb89649cc --- /dev/null +++ b/pkg/provider/dryrun/cas.go @@ -0,0 +1,32 @@ +package dryrun + +import ( + "context" + + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + casprvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/cas" + + cassdk "github.com/aliyun/alibaba-cloud-sdk-go/services/cas" +) + +func NewDryRunCAS( + auth *base.ClientMgr, cas *casprvd.CASProvider, +) *DryRunCAS { + return &DryRunCAS{auth: auth, cas: cas} +} + +var _ prvd.ICAS = &DryRunCAS{} + +type DryRunCAS struct { + auth *base.ClientMgr + cas *casprvd.CASProvider +} + +func (c DryRunCAS) DescribeSSLCertificateList(ctx context.Context, request *cassdk.DescribeSSLCertificateListRequest) (*cassdk.DescribeSSLCertificateListResponse, error) { + return c.auth.CAS.DescribeSSLCertificateList(request) +} + +func (c DryRunCAS) DescribeSSLCertificatePublicKeyDetail(ctx context.Context, request *cassdk.DescribeSSLCertificatePublicKeyDetailRequest) (*cassdk.DescribeSSLCertificatePublicKeyDetailResponse, error) { + return c.auth.CAS.DescribeSSLCertificatePublicKeyDetail(request) +} diff --git a/pkg/provider/dryrun/dryruncloud.go b/pkg/provider/dryrun/dryruncloud.go index fc80090e7..5b67c0f3e 100644 --- a/pkg/provider/dryrun/dryruncloud.go +++ b/pkg/provider/dryrun/dryruncloud.go @@ -4,10 +4,13 @@ import ( log "github.com/sirupsen/logrus" prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/alb" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/cas" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/ecs" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/pvtz" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/slb" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/sls" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/vpc" ) @@ -30,6 +33,9 @@ func NewDryRunCloud() prvd.Provider { SLBProvider: slb.NewLBProvider(auth), PVTZProvider: pvtz.NewPVTZProvider(auth), VPCProvider: vpc.NewVPCProvider(auth), + ALBProvider: alb.NewALBProvider(auth), + SLSProvider: sls.NewSLSProvider(auth), + CASProvider: cas.NewCASProvider(auth), } return &DryRunCloud{ @@ -38,6 +44,9 @@ func NewDryRunCloud() prvd.Provider { DryRunPVTZ: NewDryRunPVTZ(auth, cloud.PVTZProvider), DryRunVPC: NewDryRunVPC(auth, cloud.VPCProvider), DryRunSLB: NewDryRunSLB(auth, cloud.SLBProvider), + DryRunALB: NewDryRunALB(auth, cloud.ALBProvider), + DryRunSLS: NewDryRunSLS(auth, cloud.SLSProvider), + DryRunCAS: NewDryRunCAS(auth, cloud.CASProvider), } } @@ -48,5 +57,8 @@ type DryRunCloud struct { *DryRunPVTZ *DryRunVPC *DryRunSLB + *DryRunALB + *DryRunSLS + *DryRunCAS prvd.IMetaData } diff --git a/pkg/provider/dryrun/sls.go b/pkg/provider/dryrun/sls.go new file mode 100644 index 000000000..d484afeb5 --- /dev/null +++ b/pkg/provider/dryrun/sls.go @@ -0,0 +1,26 @@ +package dryrun + +import ( + prvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider" + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + slsprvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/sls" + + "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" +) + +func NewDryRunSLS( + auth *base.ClientMgr, sls *slsprvd.SLSProvider, +) *DryRunSLS { + return &DryRunSLS{auth: auth, sls: sls} +} + +var _ prvd.ISLS = &DryRunSLS{} + +type DryRunSLS struct { + auth *base.ClientMgr + sls *slsprvd.SLSProvider +} + +func (s DryRunSLS) AnalyzeProductLog(request *sls.AnalyzeProductLogRequest) (response *sls.AnalyzeProductLogResponse, err error) { + return s.auth.SLS.AnalyzeProductLog(request) +} diff --git a/pkg/provider/dryrun/vpc.go b/pkg/provider/dryrun/vpc.go index 2dd8d541a..ec72b0341 100644 --- a/pkg/provider/dryrun/vpc.go +++ b/pkg/provider/dryrun/vpc.go @@ -6,6 +6,8 @@ import ( "k8s.io/cloud-provider-alibaba-cloud/pkg/model" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/vpc" + + servicesvpc "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" ) func NewDryRunVPC( @@ -47,3 +49,7 @@ func (m *DryRunVPC) ListRouteTables(ctx context.Context, vpcID string) ([]string func (m *DryRunVPC) DescribeEipAddresses(ctx context.Context, instanceType string, instanceId string) ([]string, error) { return m.vpc.DescribeEipAddresses(ctx, instanceType, instanceId) } + +func (m *DryRunVPC) DescribeVSwitches(ctx context.Context, vpcID string) ([]servicesvpc.VSwitch, error) { + return m.vpc.DescribeVSwitches(ctx, vpcID) +} diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index ec05e9170..399e191e5 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -2,9 +2,18 @@ package prvd import ( "context" + "time" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + + "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + "github.com/aliyun/alibaba-cloud-sdk-go/services/cas" + "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" + "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" v1 "k8s.io/api/core/v1" "k8s.io/cloud-provider-alibaba-cloud/pkg/model" - "time" ) type Provider interface { @@ -13,6 +22,9 @@ type Provider interface { IVPC ILoadBalancer IPrivateZone + IALB + ISLS + ICAS } type RoleAuth struct { @@ -72,6 +84,7 @@ type IVPC interface { FindRoute(ctx context.Context, table, pvid, cidr string) (*model.Route, error) ListRouteTables(ctx context.Context, vpcID string) ([]string, error) DescribeEipAddresses(ctx context.Context, instanceType string, instanceId string) ([]string, error) + DescribeVSwitches(ctx context.Context, vpcID string) ([]vpc.VSwitch, error) } type ILoadBalancer interface { @@ -119,3 +132,51 @@ type IPrivateZone interface { UpdatePVTZ(ctx context.Context, ep *model.PvtzEndpoint) error DeletePVTZ(ctx context.Context, ep *model.PvtzEndpoint) error } + +type ISLS interface { + AnalyzeProductLog(request *sls.AnalyzeProductLogRequest) (response *sls.AnalyzeProductLogResponse, err error) +} + +type ICAS interface { + DescribeSSLCertificateList(ctx context.Context, request *cas.DescribeSSLCertificateListRequest) (*cas.DescribeSSLCertificateListResponse, error) + DescribeSSLCertificatePublicKeyDetail(ctx context.Context, request *cas.DescribeSSLCertificatePublicKeyDetailRequest) (*cas.DescribeSSLCertificatePublicKeyDetailResponse, error) +} + +type IALB interface { + DescribeALBZones(request *alb.DescribeZonesRequest) (response *alb.DescribeZonesResponse, err error) + TagALBResources(request *alb.TagResourcesRequest) (response *alb.TagResourcesResponse, err error) + // ApplicationLoadBalancer + CreateALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error) + ReuseALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, lbID string, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error) + UpdateALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, sdkLB alb.LoadBalancer) (albmodel.LoadBalancerStatus, error) + DeleteALB(ctx context.Context, lbID string) error + // ALB Listener + CreateALBListener(ctx context.Context, resLS *albmodel.Listener) (albmodel.ListenerStatus, error) + UpdateALBListener(ctx context.Context, resLS *albmodel.Listener, sdkLB *alb.Listener) (albmodel.ListenerStatus, error) + DeleteALBListener(ctx context.Context, lsID string) error + ListALBListeners(ctx context.Context, lbID string) ([]alb.Listener, error) + + // ALB Listener Rule + CreateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule) (albmodel.ListenerRuleStatus, error) + CreateALBListenerRules(ctx context.Context, resLR []*albmodel.ListenerRule) (map[int]albmodel.ListenerRuleStatus, error) + UpdateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule, sdkLR *alb.Rule) (albmodel.ListenerRuleStatus, error) + UpdateALBListenerRules(ctx context.Context, matches []albmodel.ResAndSDKListenerRulePair) error + DeleteALBListenerRule(ctx context.Context, sdkLRId string) error + DeleteALBListenerRules(ctx context.Context, sdkLRIds []string) error + ListALBListenerRules(ctx context.Context, lsID string) ([]alb.Rule, error) + + // ALB Server + RegisterALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem) error + DeregisterALBServers(ctx context.Context, serverGroupID string, sdkServers []alb.BackendServer) error + ReplaceALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem, sdkServers []alb.BackendServer) error + ListALBServers(ctx context.Context, serverGroupID string) ([]alb.BackendServer, error) + + // ALB ServerGroup + CreateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, trackingProvider tracking.TrackingProvider) (albmodel.ServerGroupStatus, error) + UpdateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, sdkSGP albmodel.ServerGroupWithTags) (albmodel.ServerGroupStatus, error) + DeleteALBServerGroup(ctx context.Context, serverGroupID string) error + + // ALB Tags + ListALBServerGroupsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.ServerGroupWithTags, error) + ListALBsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.AlbLoadBalancerWithTags, error) +} diff --git a/pkg/provider/vmock/albprd.go b/pkg/provider/vmock/albprd.go new file mode 100644 index 000000000..1ce3ad375 --- /dev/null +++ b/pkg/provider/vmock/albprd.go @@ -0,0 +1,113 @@ +package vmock + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/tracking" + + albsdk "github.com/aliyun/alibaba-cloud-sdk-go/services/alb" + albmodel "k8s.io/cloud-provider-alibaba-cloud/pkg/model/alb" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" +) + +func NewMockALB( + auth *base.ClientMgr, +) *MockALB { + return &MockALB{auth: auth} +} + +type MockALB struct { + auth *base.ClientMgr +} + +func (p MockALB) TagALBResources(request *albsdk.TagResourcesRequest) (response *albsdk.TagResourcesResponse, err error) { + return nil, nil +} + +func (p MockALB) DescribeALBZones(request *albsdk.DescribeZonesRequest) (response *albsdk.DescribeZonesResponse, err error) { + return nil, nil +} +func (p MockALB) CreateALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error) { + return albmodel.LoadBalancerStatus{}, nil +} +func (p MockALB) ReuseALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, lbID string, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error) { + return albmodel.LoadBalancerStatus{}, nil +} + +func (p MockALB) UpdateALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, sdkLB albsdk.LoadBalancer) (albmodel.LoadBalancerStatus, error) { + return albmodel.LoadBalancerStatus{}, nil +} +func (p MockALB) DeleteALB(ctx context.Context, lbID string) error { + return nil +} + +// ALB Listener +func (p MockALB) CreateALBListener(ctx context.Context, resLS *albmodel.Listener) (albmodel.ListenerStatus, error) { + return albmodel.ListenerStatus{}, nil +} +func (p MockALB) UpdateALBListener(ctx context.Context, resLS *albmodel.Listener, sdkLB *albsdk.Listener) (albmodel.ListenerStatus, error) { + return albmodel.ListenerStatus{}, nil +} +func (p MockALB) DeleteALBListener(ctx context.Context, lsID string) error { + return nil +} +func (p MockALB) ListALBListeners(ctx context.Context, lbID string) ([]albsdk.Listener, error) { + return nil, nil +} + +// ALB Listener Rule +func (p MockALB) CreateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule) (albmodel.ListenerRuleStatus, error) { + return albmodel.ListenerRuleStatus{}, nil +} +func (p MockALB) CreateALBListenerRules(ctx context.Context, resLR []*albmodel.ListenerRule) (map[int]albmodel.ListenerRuleStatus, error) { + return nil, nil +} +func (p MockALB) UpdateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule, sdkLR *albsdk.Rule) (albmodel.ListenerRuleStatus, error) { + return albmodel.ListenerRuleStatus{}, nil +} +func (p MockALB) UpdateALBListenerRules(ctx context.Context, matches []albmodel.ResAndSDKListenerRulePair) error { + return nil +} +func (p MockALB) DeleteALBListenerRule(ctx context.Context, sdkLRId string) error { + return nil +} +func (p MockALB) DeleteALBListenerRules(ctx context.Context, sdkLRIds []string) error { + return nil +} +func (p MockALB) ListALBListenerRules(ctx context.Context, lsID string) ([]albsdk.Rule, error) { + return nil, nil +} + +// ALB Server +func (p MockALB) RegisterALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem) error { + return nil +} +func (p MockALB) DeregisterALBServers(ctx context.Context, serverGroupID string, sdkServers []albsdk.BackendServer) error { + return nil +} +func (p MockALB) ReplaceALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem, sdkServers []albsdk.BackendServer) error { + return nil +} +func (p MockALB) ListALBServers(ctx context.Context, serverGroupID string) ([]albsdk.BackendServer, error) { + return nil, nil +} + +// ALB ServerGroup +func (p MockALB) CreateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, trackingProvider tracking.TrackingProvider) (albmodel.ServerGroupStatus, error) { + return albmodel.ServerGroupStatus{}, nil +} +func (p MockALB) UpdateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, sdkSGP albmodel.ServerGroupWithTags) (albmodel.ServerGroupStatus, error) { + return albmodel.ServerGroupStatus{}, nil +} +func (p MockALB) DeleteALBServerGroup(ctx context.Context, serverGroupID string) error { + return nil +} + +// ALB Tags +func (p MockALB) ListALBServerGroupsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.ServerGroupWithTags, error) { + return nil, nil +} +func (p MockALB) ListALBsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.AlbLoadBalancerWithTags, error) { + return nil, nil +} diff --git a/pkg/provider/vmock/cas.go b/pkg/provider/vmock/cas.go new file mode 100644 index 000000000..e98e2b473 --- /dev/null +++ b/pkg/provider/vmock/cas.go @@ -0,0 +1,29 @@ +package vmock + +import ( + "context" + + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + casprvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/cas" + + cassdk "github.com/aliyun/alibaba-cloud-sdk-go/services/cas" +) + +func NewMockCAS( + auth *base.ClientMgr, +) *MockCAS { + return &MockCAS{auth: auth} +} + +type MockCAS struct { + auth *base.ClientMgr + cas *casprvd.CASProvider +} + +func (c MockCAS) DescribeSSLCertificateList(ctx context.Context, request *cassdk.DescribeSSLCertificateListRequest) (*cassdk.DescribeSSLCertificateListResponse, error) { + return nil, nil +} + +func (c MockCAS) DescribeSSLCertificatePublicKeyDetail(ctx context.Context, request *cassdk.DescribeSSLCertificatePublicKeyDetailRequest) (*cassdk.DescribeSSLCertificatePublicKeyDetailResponse, error) { + return nil, nil +} diff --git a/pkg/provider/vmock/sls.go b/pkg/provider/vmock/sls.go new file mode 100644 index 000000000..d8bb96001 --- /dev/null +++ b/pkg/provider/vmock/sls.go @@ -0,0 +1,23 @@ +package vmock + +import ( + "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" + slsprvd "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/sls" + + "github.com/aliyun/alibaba-cloud-sdk-go/services/sls" +) + +func NewMockSLS( + auth *base.ClientMgr, +) *MockSLS { + return &MockSLS{auth: auth} +} + +type MockSLS struct { + auth *base.ClientMgr + sls *slsprvd.SLSProvider +} + +func (s MockSLS) AnalyzeProductLog(request *sls.AnalyzeProductLogRequest) (response *sls.AnalyzeProductLogResponse, err error) { + return nil, nil +} diff --git a/pkg/provider/vmock/vpc.go b/pkg/provider/vmock/vpc.go index 935b7e00d..c9a537f57 100644 --- a/pkg/provider/vmock/vpc.go +++ b/pkg/provider/vmock/vpc.go @@ -2,6 +2,7 @@ package vmock import ( "context" + servicesvpc "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" "k8s.io/cloud-provider-alibaba-cloud/pkg/model" "k8s.io/cloud-provider-alibaba-cloud/pkg/provider/alibaba/base" ) @@ -39,3 +40,6 @@ func (m *MockVPC) ListRouteTables(ctx context.Context, vpcID string) ([]string, func (m *MockVPC) DescribeEipAddresses(ctx context.Context, instanceType string, instanceId string) ([]string, error) { panic("implement me") } +func (m *MockVPC) DescribeVSwitches(ctx context.Context, vpcID string) ([]servicesvpc.VSwitch, error) { + panic("implement me") +} diff --git a/pkg/util/constant.go b/pkg/util/constant.go new file mode 100644 index 000000000..34942ff9f --- /dev/null +++ b/pkg/util/constant.go @@ -0,0 +1,323 @@ +package util + +import ( + "math/rand" + "time" +) + +const ( + Action = "action" + + CreateALBListener = "CreateALBListener" + CreateALBListenerAsynchronous = "CreateALBListenerAsynchronous" + DeleteALBListener = "DeleteALBListener" + UpdateALBListenerAttribute = "UpdateALBListenerAttribute" + ListALBListeners = "ListALBListeners" + GetALBListenerAttribute = "GetALBListenerAttribute" + ListALBListenerCertificates = "ListALBListenerCertificates" + AssociateALBAdditionalCertificatesWithListener = "AssociateALBAdditionalCertificatesWithListener" + DissociateALBAdditionalCertificatesFromListener = "DissociateALBAdditionalCertificatesFromListener" + + CreateALBLoadBalancer = "CreateALBLoadBalancer" + CreateALBLoadBalancerAsynchronous = "CreateALBLoadBalancerAsynchronous" + DeleteALBLoadBalancer = "DeleteALBLoadBalancer" + ListALBLoadBalancers = "ListALBLoadBalancers" + GetALBLoadBalancerAttribute = "GetALBLoadBalancerAttribute" + UpdateALBLoadBalancerAttribute = "UpdateALBLoadBalancerAttribute" + UpdateALBLoadBalancerEdition = "UpdateALBLoadBalancerEdition" + EnableALBLoadBalancerAccessLog = "EnableALBLoadBalancerAccessLog" + DisableALBLoadBalancerAccessLog = "DisableALBLoadBalancerAccessLog" + EnableALBDeletionProtection = "EnableALBDeletionProtection" + DisableALBDeletionProtection = "DisableALBDeletionProtection" + + TagALBResource = "TagALBResource" + AnalyzeProductLog = "AnalyzeProductLog" + + CreateALBRule = "CreateALBRule" + CreateALBRules = "CreateALBRules" + DeleteALBRule = "DeleteALBRule" + DeleteALBRules = "DeleteALBRules" + ListALBRules = "ListALBRules" + UpdateALBRuleAttribute = "UpdateALBRuleAttribute" + UpdateALBRulesAttribute = "UpdateALBRulesAttribute" + + CreateALBServerGroup = "CreateALBServerGroup" + DeleteALBServerGroup = "DeleteALBServerGroup" + UpdateALBServerGroupAttribute = "UpdateALBServerGroupAttribute" + ListALBServerGroups = "ListALBServerGroups" + ListALBServerGroupServers = "ListALBServerGroupServers" + AddALBServersToServerGroupAsynchronous = "AddALBServersToServerGroupAsynchronous" + AddALBServersToServerGroup = "AddALBServersToServerGroup" + RemoveALBServersFromServerGroupAsynchronous = "RemoveALBServersFromServerGroupAsynchronous" + RemoveALBServersFromServerGroup = "RemoveALBServersFromServerGroup" + ReplaceALBServersInServerGroupAsynchronous = "ReplaceALBServersInServerGroupAsynchronous" + ReplaceALBServersInServerGroup = "ReplaceALBServersInServerGroup" +) +const ( + // IngressClass + IngressClass = "kubernetes.io/ingress.class" + + // Ingress annotation suffixes + IngressSuffixAlbConfigName = "albconfig.name" + IngressSuffixAlbConfigOrder = "albconfig.order" + IngressSuffixListenPorts = "listen-ports" +) + +const ( + MgrLogLevel = ApplierManagerLogLevel +) + +const ( + BatchRegisterDeregisterServersMaxNum = 40 + BatchRegisterServersDefaultNum = 30 + BatchDeregisterServersDefaultNum = 30 + + ServerStatusAdding = "Adding" + ServerStatusAvailable = "Available" + ServerStatusConfiguring = "Configuring" + ServerStatusRemoving = "Removing" + + LoadBalancerStatusActive = "Active" + LoadBalancerStatusInactive = "Inactive" + LoadBalancerStatusProvisioning = "Provisioning" + LoadBalancerStatusConfiguring = "Configuring" + LoadBalancerStatusCreateFailed = "CreateFailed" + + ListenerStatusProvisioning = "Provisioning" + ListenerStatusRunning = "Running" + ListenerStatusConfiguring = "Configuring" + ListenerStatusStopped = "Stopped" +) + +const ( + BatchCreateDeleteUpdateRulesMaxNum = 10 + BatchCreateRulesDefaultNum = 9 + BatchDeleteRulesDefaultNum = 9 + BatchUpdateRulesDefaultNum = 9 +) + +const ( + CreateLoadBalancerWaitActiveMaxRetryTimes = 10 + CreateLoadBalancerWaitActiveRetryInterval = 2 * time.Second + + CreateListenerWaitRunningMaxRetryTimes = 15 + CreateListenerWaitRunningRetryInterval = 1 * time.Second +) + +const ( + DefaultLogAcceptFormat = "xml" + DefaultLogCloudProduct = "k8s-nginx-ingress" + DefaultLogLang = "cn" + DefaultLogDomainSuffix = "-intranet.log.aliyuncs.com/open-api" + + MinLogProjectNameLen = 4 + MaxLogProjectNameLen = 63 + MinLogStoreNameLen = 2 + MaxLogStoreNameLen = 64 +) + +const ( + ServerGroupResourceType = "ServerGroup" + LoadBalancerResourceType = "LoadBalancer" +) + +const ( + ServerTypeEcs = "Ecs" + ServerTypeEni = "Eni" + ServerTypeEci = "Eci" +) + +const ( + AddALBServersToServerGroupWaitAvailableMaxRetryTimes = 60 + AddALBServersToServerGroupWaitAvailableRetryInterval = time.Second + RemoveALBServersFromServerGroupMaxRetryTimes = 60 + RemoveALBServersFromServerGroupRetryInterval = time.Second + ReplaceALBServersInServerGroupMaxRetryTimes = 60 + ReplaceALBServersInServerGroupRetryInterval = time.Second +) + +const IsWaitServersAsynchronousComplete = true + +const ( + SynLogLevel = ApplierSynthesizerLogLevel +) + +const ( + BatchReplaceServersMaxNum = 40 +) + +const ( + TrafficPolicyEni = "eni" + TrafficPolicyLocal = "local" + TrafficPolicyCluster = "cluster" +) + +const ( + ServerGroupConcurrentNum = 5 + ListenerConcurrentNum = 5 +) + +const ( + LabelNodeRoleMaster = "node-role.kubernetes.io/master" + + LabelNodeExcludeApplicationLoadBalancer = "alpha.service-controller.kubernetes.io/exclude-alb" + + LabelNodeTypeVK = "virtual-kubelet" + + DefaultServerWeight = 100 +) +const ConcurrentMaxSleepMillisecondTime = 200 + +const IndexKeyServiceRefName = "spec.serviceRef.name" + +const ( + ClusterNameTagKey = "ack.aliyun.com" + ServiceNamespaceTagKey = IngressTagKeyPrefix + "/service_ns" + ServiceNameTagKey = IngressTagKeyPrefix + "/service_name" + ServicePortTagKey = IngressTagKeyPrefix + "/service_port" + IngressNameTagKey = IngressTagKeyPrefix + "/ingress_name" + + AlbConfigTagKey = "albconfig" +) + +const ( + IngressClassALB = "alb" +) + +const ( + IngressFinalizer = IngressTagKeyPrefix + "/resources" +) + +const ( + IngressTagKeyPrefix = "ingress.k8s.alibaba" +) + +const ( + DefaultListenerFlag = "-listener-" +) + +const ( + RuleActionTypeFixedResponse string = "FixedResponse" + RuleActionTypeRedirect string = "Redirect" + RuleActionTypeForward string = "ForwardGroup" +) + +const ( + RuleConditionFieldHost string = "Host" + RuleConditionFieldPath string = "Path" + RuleConditionFieldHeader string = "Header" + RuleConditionFieldQueryString string = "QueryString" + RuleConditionFieldMethod string = "Method" + RuleConditionFieldCookie string = "Cookie" +) + +const ( + DefaultServerGroupScheduler string = ServerGroupSchedulerWrr + DefaultServerGroupProtocol string = ServerGroupProtocolHTTP + DefaultServerGroupType string = "instance" + + DefaultServerGroupHealthCheckInterval = 2 // 1~50 + DefaultServerGroupHealthyThreshold = 3 // 2~10 + DefaultServerGroupHealthCheckHost = "$SERVER_IP" // GET OR HEAD + DefaultServerGroupHealthCheckPath = "/" // GET OR HEAD + DefaultServerGroupHealthCheckHttpVersion = ServerGroupHealthCheckHttpVersion11 // HTTP1.0 OR HTTP1.1 + DefaultServerGroupHealthCheckEnabled = false + DefaultServerGroupHealthCheckTimeout = 5 // 1~300 + DefaultServerGroupHealthCheckTcpFastCloseEnabled = false + DefaultServerGroupHealthCheckConnectPort = 0 // 0~65535 + DefaultServerGroupHealthCheckHTTPCodes = ServerGroupHealthCheckCodes2xx // http_2xx、http_3xx、http_4xx OR http_5xx + DefaultServerGroupHealthCheckCodes = ServerGroupHealthCheckCodes2xx // http_2xx、http_3xx、http_4xx OR http_5xx + DefaultServerGroupHealthCheckMethod = ServerGroupHealthCheckMethodHEAD // GET OR HEAD + DefaultServerGroupUnhealthyThreshold = 3 // 2~10 + DefaultServerGroupHealthCheckProtocol = ServerGroupHealthCheckProtocolHTTP // HTTP、HTTPS + + // Cookie timeout period. Unit: second + // Value: 1~86400 + // Default value: 1000 + // Description: When StickySessionEnabled is true and StickySessionType is Insert, this parameter is mandatory. + DefaultServerGroupStickySessionCookieTimeout = 1000 + // Whether to enable session retention, value: true or false (default value). + DefaultServerGroupStickySessionEnabled = false + //Cookie processing method. Value: + //Insert (default value): Insert Cookie. + //When the client visits for the first time, the load balancer will implant a cookie in the return request (that is, insert the SERVERID in the HTTP or HTTPS response message), the next time the client visits with this cookie, the load balance service will direct the request Forward to the back-end server previously recorded. + //Server: Rewrite Cookie. + //The load balancer finds that the user has customized the cookie and will rewrite the original cookie. The next time the client visits with a new cookie, the load balancer service will direct the request to the back-end server that was previously recorded. + DefaultServerGroupStickySessionType = ServerGroupStickySessionTypeInsert + + DefaultLoadBalancerAddressType string = LoadBalancerAddressTypeInternet + DefaultLoadBalancerAddressAllocatedMode string = LoadBalancerAddressAllocatedModeDynamic + DefaultLoadBalancerEdition string = LoadBalancerEditionBasic + DefaultLoadBalancerBillingConfigPayType string = LoadBalancerPayTypePostPay + DefaultLoadBalancerDeletionProtectionConfigEnabled bool = true + DefaultLoadBalancerModificationProtectionConfigStatus string = LoadBalancerModificationProtectionStatusConsoleProtection + + DefaultListenerProtocol = ListenerProtocolHTTP + DefaultListenerPort = 80 + DefaultListenerIdleTimeout = 15 + DefaultListenerRequestTimeout = 60 + DefaultListenerGzipEnabled = true + DefaultListenerHttp2Enabled = true + DefaultListenerSecurityPolicyId = "tls_cipher_policy_1_0" +) + +const ( + ServerGroupSchedulerWrr = "Wrr" + ServerGroupSchedulerWlc = "Wlc" + ServerGroupSchedulerSch = "Sch" + + ServerGroupProtocolHTTP = "HTTP" + ServerGroupProtocolHTTPS = "HTTPS" + + ServerGroupHealthCheckMethodGET = "GET" + ServerGroupHealthCheckMethodHEAD = "HEAD" + ServerGroupHealthCheckProtocolHTTP = "HTTP" + ServerGroupHealthCheckProtocolHTTPS = "HTTPS" + ServerGroupHealthCheckCodes2xx = "http_2xx" + ServerGroupHealthCheckCodes3xx = "http_3xx" + ServerGroupHealthCheckCodes4xx = "http_4xx" + ServerGroupHealthCheckCodes5xx = "http_5xx" + ServerGroupHealthCheckHttpVersion10 = "HTTP1.0" + ServerGroupHealthCheckHttpVersion11 = "HTTP1.1" + + ServerGroupStickySessionTypeInsert = "Insert" + ServerGroupStickySessionTypeServer = "Server" +) + +const ( + LoadBalancerEditionBasic = "Basic" + LoadBalancerEditionStandard = "Standard" + + LoadBalancerAddressTypeInternet = "Internet" + LoadBalancerAddressTypeIntranet = "Intranet" + + LoadBalancerPayTypePostPay = "PostPay" + + LoadBalancerAddressAllocatedModeFixed = "Fixed" + LoadBalancerAddressAllocatedModeDynamic = "Dynamic" + + LoadBalancerModificationProtectionStatusNonProtection = "NonProtection" + LoadBalancerModificationProtectionStatusConsoleProtection = "ConsoleProtection" +) + +const ( + ListenerProtocolHTTP = "HTTP" + ListenerProtocolHTTPS = "HTTPS" + ListenerProtocolQUIC = "QUIC" +) + +const ( + TraceID = "traceID" +) + +const ( + ApplierManagerLogLevel = 0 + ApplierSynthesizerLogLevel = 0 +) + +var RandomSleepFunc = func(max int) { + if max <= 0 { + max = ConcurrentMaxSleepMillisecondTime + } + time.Sleep(time.Duration(rand.Intn(max)) * time.Millisecond) +} diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 7a3f2a037..cb0a96d3d 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -3,6 +3,10 @@ package util import ( "encoding/json" "fmt" + "time" + + "k8s.io/apimachinery/pkg/util/wait" + apiext "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -49,3 +53,30 @@ func ClusterVersionAtLeast(client *apiext.Clientset, min string) (bool, error) { return runningVersion.AtLeast(least), nil } + +// MergeStringMap will merge multiple map[string]string into single one. +// The merge is executed for maps argument in sequential order, if a key already exists, the value from previous map is kept. +// e.g. MergeStringMap(map[string]string{"a": "1", "b": "2"}, map[string]string{"a": "3", "d": "4"}) == map[string]string{"a": "1", "b": "2", "d": "4"} +func MergeStringMap(maps ...map[string]string) map[string]string { + ret := make(map[string]string) + for _, _map := range maps { + for k, v := range _map { + if _, ok := ret[k]; !ok { + ret[k] = v + } + } + } + return ret +} +func RetryImmediateOnError(interval time.Duration, timeout time.Duration, retryable func(error) bool, fn func() error) error { + return wait.PollImmediate(interval, timeout, func() (bool, error) { + err := fn() + if err != nil { + if retryable(err) { + return false, nil + } + return false, err + } + return true, nil + }) +} From cec8fb4f980d8fa4f5f548e80946f36e4cc5e23a Mon Sep 17 00:00:00 2001 From: "yuanyi.lp" Date: Fri, 31 Dec 2021 16:25:33 +0800 Subject: [PATCH 2/4] feature(ingress): update the vendor --- go.sum | 3 + .../services/alb/add_entries_to_acl.go | 109 ++++++ .../alb/add_servers_to_server_group.go | 113 ++++++ .../alb/associate_acls_with_listener.go | 104 +++++ ...e_additional_certificates_with_listener.go | 108 ++++++ .../services/alb/client.go | 129 +++++++ .../services/alb/create_acl.go | 105 +++++ .../alb/create_health_check_template.go | 115 ++++++ .../services/alb/create_listener.go | 166 ++++++++ .../services/alb/create_load_balancer.go | 130 +++++++ .../services/alb/create_rule.go | 271 +++++++++++++ .../services/alb/create_rules.go | 276 +++++++++++++ .../services/alb/create_security_policy.go | 105 +++++ .../services/alb/create_server_group.go | 136 +++++++ .../services/alb/delete_acl.go | 102 +++++ .../alb/delete_health_check_templates.go | 101 +++++ .../services/alb/delete_listener.go | 102 +++++ .../services/alb/delete_load_balancer.go | 102 +++++ .../services/alb/delete_rule.go | 102 +++++ .../services/alb/delete_rules.go | 102 +++++ .../services/alb/delete_security_policy.go | 101 +++++ .../services/alb/delete_server_group.go | 102 +++++ .../services/alb/describe_regions.go | 100 +++++ .../services/alb/describe_zones.go | 99 +++++ .../alb/disable_deletion_protection.go | 101 +++++ .../alb/disable_load_balancer_access_log.go | 101 +++++ .../alb/dissociate_acls_from_listener.go | 103 +++++ ...e_additional_certificates_from_listener.go | 108 ++++++ .../alb/enable_deletion_protection.go | 101 +++++ .../alb/enable_load_balancer_access_log.go | 103 +++++ .../services/alb/endpoint.go | 20 + .../get_health_check_template_attribute.go | 116 ++++++ .../services/alb/get_listener_attribute.go | 120 ++++++ .../alb/get_load_balancer_attribute.go | 123 ++++++ .../services/alb/list_acl_entries.go | 105 +++++ .../services/alb/list_acl_relations.go | 100 +++++ .../services/alb/list_acls.go | 108 ++++++ .../services/alb/list_asyn_jobs.go | 110 ++++++ .../alb/list_health_check_templates.go | 106 +++++ .../alb/list_listener_certificates.go | 106 +++++ .../services/alb/list_listeners.go | 108 ++++++ .../services/alb/list_load_balancers.go | 122 ++++++ .../services/alb/list_rules.go | 109 ++++++ .../services/alb/list_security_policies.go | 107 +++++ .../alb/list_security_policy_relations.go | 100 +++++ .../services/alb/list_server_group_servers.go | 115 ++++++ .../services/alb/list_server_groups.go | 117 ++++++ .../alb/list_system_security_policies.go | 99 +++++ .../services/alb/list_tag_keys.go | 107 +++++ .../services/alb/list_tag_resources.go | 113 ++++++ .../services/alb/list_tag_values.go | 107 +++++ .../services/alb/move_resource_group.go | 101 +++++ .../services/alb/remove_entries_from_acl.go | 103 +++++ .../alb/remove_servers_from_server_group.go | 111 ++++++ .../alb/replace_servers_in_server_group.go | 122 ++++++ .../services/alb/start_listener.go | 102 +++++ .../services/alb/stop_listener.go | 102 +++++ .../services/alb/struct_access_log_config.go | 22 ++ .../alb/struct_access_log_tracing_config.go | 23 ++ .../services/alb/struct_acl.go | 27 ++ .../services/alb/struct_acl_config.go | 22 ++ .../services/alb/struct_acl_entries.go | 21 + .../services/alb/struct_acl_entry.go | 23 ++ .../services/alb/struct_acl_relation.go | 23 ++ ...acl_relations_in_get_listener_attribute.go | 21 + ...uct_acl_relations_in_list_acl_relations.go | 21 + .../services/alb/struct_acls.go | 21 + .../services/alb/struct_action.go | 30 ++ .../services/alb/struct_backend_server.go | 28 ++ .../services/alb/struct_ca_certificates.go | 21 + .../services/alb/struct_certificate.go | 23 ++ .../services/alb/struct_certificate_model.go | 24 ++ ..._certificates_in_get_listener_attribute.go | 21 + ...tificates_in_list_listener_certificates.go | 21 + ...truct_ciphers_in_list_security_policies.go | 21 + ...iphers_in_list_system_security_policies.go | 21 + .../services/alb/struct_condition.go | 30 ++ .../services/alb/struct_cookie_config.go | 21 + .../services/alb/struct_default_action.go | 22 ++ ...fault_actions_in_get_listener_attribute.go | 21 + ...truct_default_actions_in_list_listeners.go | 21 + .../alb/struct_deletion_protection_config.go | 22 ++ .../services/alb/struct_feature_labels.go | 21 + .../alb/struct_fixed_response_config.go | 23 ++ .../alb/struct_forward_group_config.go | 21 + ...ruct_forward_group_config_in_list_rules.go | 22 ++ .../services/alb/struct_header_config.go | 22 ++ ..._in_get_health_check_template_attribute.go | 21 + ...ck_codes_in_list_health_check_templates.go | 21 + ...ealth_check_codes_in_list_server_groups.go | 21 + .../alb/struct_health_check_config.go | 34 ++ ..._in_get_health_check_template_attribute.go | 21 + ...tp_codes_in_list_health_check_templates.go | 21 + ..._check_http_codes_in_list_server_groups.go | 21 + .../alb/struct_health_check_template.go | 37 ++ .../alb/struct_health_check_templates.go | 21 + .../services/alb/struct_host_config.go | 21 + .../alb/struct_insert_header_config.go | 24 ++ .../services/alb/struct_job.go | 30 ++ .../services/alb/struct_jobs.go | 21 + .../services/alb/struct_listener.go | 37 ++ .../services/alb/struct_listeners.go | 21 + .../services/alb/struct_load_balancer.go | 41 ++ .../alb/struct_load_balancer_address.go | 21 + .../alb/struct_load_balancer_addresses.go | 21 + .../struct_load_balancer_billing_config.go | 23 ++ .../struct_load_balancer_operation_lock.go | 22 ++ ...on_locks_in_get_load_balancer_attribute.go | 21 + ..._operation_locks_in_list_load_balancers.go | 21 + .../services/alb/struct_load_balancers.go | 21 + .../services/alb/struct_log_config.go | 22 ++ .../services/alb/struct_method_config.go | 21 + .../alb/struct_mirror_group_config.go | 21 + .../struct_modification_protection_config.go | 22 ++ .../services/alb/struct_path_config.go | 21 + .../alb/struct_query_string_config.go | 21 + .../services/alb/struct_quic_config.go | 22 ++ .../services/alb/struct_redirect_config.go | 26 ++ .../services/alb/struct_region.go | 23 ++ .../services/alb/struct_regions.go | 21 + .../services/alb/struct_related_listener.go | 25 ++ ...tener_in_list_security_policy_relations.go | 24 ++ ...related_listeners_in_list_acl_relations.go | 21 + ...eners_in_list_security_policy_relations.go | 21 + .../alb/struct_related_load_balancer_ids.go | 21 + .../alb/struct_remove_header_config.go | 21 + .../alb/struct_response_header_config.go | 22 ++ .../alb/struct_response_status_code_config.go | 21 + .../services/alb/struct_rewrite_config.go | 23 ++ .../services/alb/struct_rule.go | 31 ++ .../services/alb/struct_rule_actions.go | 21 + .../services/alb/struct_rule_conditions.go | 21 + .../services/alb/struct_rule_id.go | 22 ++ .../services/alb/struct_rule_ids.go | 21 + .../services/alb/struct_rules.go | 21 + .../alb/struct_secrity_policy_relation.go | 22 ++ .../alb/struct_secrity_policy_relations.go | 21 + ...rity_policies_in_list_security_policies.go | 21 + ...licies_in_list_system_security_policies.go | 21 + .../services/alb/struct_security_policy.go | 28 ++ .../services/alb/struct_server_group.go | 34 ++ .../alb/struct_server_group_sticky_session.go | 22 ++ .../services/alb/struct_server_group_tuple.go | 22 ++ ..._group_tuples_in_get_listener_attribute.go | 21 + ...t_server_group_tuples_in_list_listeners.go | 21 + ...truct_server_group_tuples_in_list_rules.go | 21 + .../services/alb/struct_server_groups.go | 21 + .../services/alb/struct_servers.go | 21 + .../services/alb/struct_source_ip_config.go | 21 + .../alb/struct_sticky_session_config.go | 24 ++ .../services/alb/struct_tag.go | 22 ++ .../services/alb/struct_tag_key.go | 22 ++ .../services/alb/struct_tag_keys.go | 21 + .../services/alb/struct_tag_resource.go | 24 ++ .../services/alb/struct_tag_resources.go | 21 + .../services/alb/struct_tag_values.go | 21 + ...uct_tags_in_get_load_balancer_attribute.go | 21 + .../alb/struct_tags_in_list_load_balancers.go | 21 + .../alb/struct_tags_in_list_server_groups.go | 21 + ..._tls_versions_in_list_security_policies.go | 21 + ...rsions_in_list_system_security_policies.go | 21 + .../alb/struct_traffic_limit_config.go | 21 + .../alb/struct_traffic_mirror_config.go | 22 ++ .../services/alb/struct_value.go | 22 ++ .../alb/struct_values_in_list_rules.go | 21 + .../alb/struct_x_forwarded_for_config.go | 33 ++ .../services/alb/struct_zone.go | 22 ++ .../services/alb/struct_zone_mapping.go | 23 ++ .../services/alb/struct_zone_mappings.go | 21 + .../services/alb/struct_zones.go | 21 + .../services/alb/tag_resources.go | 107 +++++ .../services/alb/un_tag_resources.go | 108 ++++++ .../services/alb/update_acl_attribute.go | 102 +++++ .../update_health_check_template_attribute.go | 115 ++++++ .../services/alb/update_listener_attribute.go | 163 ++++++++ .../alb/update_listener_log_config.go | 111 ++++++ .../alb/update_load_balancer_attribute.go | 110 ++++++ .../alb/update_load_balancer_edition.go | 102 +++++ .../services/alb/update_rule_attribute.go | 269 +++++++++++++ .../services/alb/update_rules_attribute.go | 274 +++++++++++++ .../alb/update_security_policy_attribute.go | 105 +++++ .../alb/update_server_group_attribute.go | 132 +++++++ .../update_server_group_servers_attribute.go | 113 ++++++ .../services/cas/client.go | 129 +++++++ .../services/cas/create_ssl_certificate.go | 102 +++++ .../cas/create_ssl_certificate_with_name.go | 103 +++++ .../services/cas/delete_ssl_certificate.go | 100 +++++ .../cas/describe_ssl_certificate_count.go | 101 +++++ .../cas/describe_ssl_certificate_list.go | 107 +++++ ...cribe_ssl_certificate_match_domain_list.go | 107 +++++ .../describe_ssl_certificate_private_key.go | 102 +++++ ...cribe_ssl_certificate_public_key_detail.go | 102 +++++ .../services/cas/endpoint.go | 70 ++++ ...a_list_in_describe_ssl_certificate_list.go | 21 + ...cribe_ssl_certificate_match_domain_list.go | 21 + .../services/cas/struct_certificate_info.go | 34 ++ .../services/sls/analyze_app_log.go | 104 +++++ .../services/sls/analyze_product_log.go | 111 ++++++ .../sls/check_resource_orchestration.go | 105 +++++ .../services/sls/client.go | 129 +++++++ .../services/sls/create_app.go | 105 +++++ .../sls/create_resource_orchestration.go | 106 +++++ .../services/sls/delete_app.go | 102 +++++ .../services/sls/delete_log_resource.go | 104 +++++ .../services/sls/describe_app.go | 103 +++++ .../services/sls/disable_alert.go | 105 +++++ .../services/sls/enable_alert.go | 110 ++++++ .../services/sls/endpoint.go | 29 ++ .../services/sls/get_alert.go | 106 +++++ .../services/sls/get_alert_histories.go | 111 ++++++ .../services/sls/get_sls_service.go | 102 +++++ .../services/sls/open_sls_service.go | 101 +++++ .../services/sls/query_saf_service.go | 104 +++++ .../services/sls/set_alert_action_policy.go | 104 +++++ .../services/sls/set_alert_center_resource.go | 104 +++++ .../services/sls/struct_app_model.go | 24 ++ .../services/sls/sync_alert_groups.go | 104 +++++ .../services/sls/sync_alert_users.go | 104 +++++ .../services/sls/update_app.go | 104 +++++ vendor/github.com/eapache/channels/.gitignore | 22 ++ .../github.com/eapache/channels/.travis.yml | 11 + .../github.com/eapache/channels/CHANGELOG.md | 17 + vendor/github.com/eapache/channels/LICENSE | 20 + vendor/github.com/eapache/channels/README.md | 27 ++ .../eapache/channels/batching_channel.go | 87 +++++ .../github.com/eapache/channels/black_hole.go | 54 +++ .../github.com/eapache/channels/channels.go | 277 +++++++++++++ .../eapache/channels/infinite_channel.go | 72 ++++ .../eapache/channels/native_channel.go | 92 +++++ .../eapache/channels/overflowing_channel.go | 113 ++++++ .../eapache/channels/resizable_channel.go | 109 ++++++ .../eapache/channels/ring_channel.go | 114 ++++++ .../eapache/channels/shared_buffer.go | 167 ++++++++ vendor/github.com/eapache/queue/.gitignore | 23 ++ vendor/github.com/eapache/queue/.travis.yml | 7 + vendor/github.com/eapache/queue/LICENSE | 21 + vendor/github.com/eapache/queue/README.md | 16 + vendor/github.com/eapache/queue/queue.go | 102 +++++ .../google/go-cmp/cmp/cmpopts/equate.go | 148 +++++++ .../google/go-cmp/cmp/cmpopts/errors_go113.go | 15 + .../go-cmp/cmp/cmpopts/errors_xerrors.go | 18 + .../google/go-cmp/cmp/cmpopts/ignore.go | 206 ++++++++++ .../google/go-cmp/cmp/cmpopts/sort.go | 147 +++++++ .../go-cmp/cmp/cmpopts/struct_filter.go | 187 +++++++++ .../google/go-cmp/cmp/cmpopts/xform.go | 35 ++ vendor/golang.org/x/xerrors/LICENSE | 27 ++ vendor/golang.org/x/xerrors/PATENTS | 22 ++ vendor/golang.org/x/xerrors/README | 2 + vendor/golang.org/x/xerrors/adaptor.go | 193 ++++++++++ vendor/golang.org/x/xerrors/codereview.cfg | 1 + vendor/golang.org/x/xerrors/doc.go | 22 ++ vendor/golang.org/x/xerrors/errors.go | 33 ++ vendor/golang.org/x/xerrors/fmt.go | 187 +++++++++ vendor/golang.org/x/xerrors/format.go | 34 ++ vendor/golang.org/x/xerrors/frame.go | 56 +++ vendor/golang.org/x/xerrors/go.mod | 3 + .../golang.org/x/xerrors/internal/internal.go | 8 + vendor/golang.org/x/xerrors/wrap.go | 106 +++++ .../admissionregistration/interface.go | 54 +++ .../admissionregistration/v1/interface.go | 52 +++ .../v1/mutatingwebhookconfiguration.go | 89 +++++ .../v1/validatingwebhookconfiguration.go | 89 +++++ .../v1beta1/interface.go | 52 +++ .../v1beta1/mutatingwebhookconfiguration.go | 89 +++++ .../v1beta1/validatingwebhookconfiguration.go | 89 +++++ .../informers/apiserverinternal/interface.go | 46 +++ .../apiserverinternal/v1alpha1/interface.go | 45 +++ .../v1alpha1/storageversion.go | 89 +++++ .../client-go/informers/apps/interface.go | 62 +++ .../informers/apps/v1/controllerrevision.go | 90 +++++ .../client-go/informers/apps/v1/daemonset.go | 90 +++++ .../client-go/informers/apps/v1/deployment.go | 90 +++++ .../client-go/informers/apps/v1/interface.go | 73 ++++ .../client-go/informers/apps/v1/replicaset.go | 90 +++++ .../informers/apps/v1/statefulset.go | 90 +++++ .../apps/v1beta1/controllerrevision.go | 90 +++++ .../informers/apps/v1beta1/deployment.go | 90 +++++ .../informers/apps/v1beta1/interface.go | 59 +++ .../informers/apps/v1beta1/statefulset.go | 90 +++++ .../apps/v1beta2/controllerrevision.go | 90 +++++ .../informers/apps/v1beta2/daemonset.go | 90 +++++ .../informers/apps/v1beta2/deployment.go | 90 +++++ .../informers/apps/v1beta2/interface.go | 73 ++++ .../informers/apps/v1beta2/replicaset.go | 90 +++++ .../informers/apps/v1beta2/statefulset.go | 90 +++++ .../informers/autoscaling/interface.go | 62 +++ .../autoscaling/v1/horizontalpodautoscaler.go | 90 +++++ .../informers/autoscaling/v1/interface.go | 45 +++ .../v2beta1/horizontalpodautoscaler.go | 90 +++++ .../autoscaling/v2beta1/interface.go | 45 +++ .../v2beta2/horizontalpodautoscaler.go | 90 +++++ .../autoscaling/v2beta2/interface.go | 45 +++ .../client-go/informers/batch/interface.go | 54 +++ .../client-go/informers/batch/v1/cronjob.go | 90 +++++ .../client-go/informers/batch/v1/interface.go | 52 +++ .../client-go/informers/batch/v1/job.go | 90 +++++ .../informers/batch/v1beta1/cronjob.go | 90 +++++ .../informers/batch/v1beta1/interface.go | 45 +++ .../informers/certificates/interface.go | 54 +++ .../v1/certificatesigningrequest.go | 89 +++++ .../informers/certificates/v1/interface.go | 45 +++ .../v1beta1/certificatesigningrequest.go | 89 +++++ .../certificates/v1beta1/interface.go | 45 +++ .../informers/coordination/interface.go | 54 +++ .../informers/coordination/v1/interface.go | 45 +++ .../informers/coordination/v1/lease.go | 90 +++++ .../coordination/v1beta1/interface.go | 45 +++ .../informers/coordination/v1beta1/lease.go | 90 +++++ .../client-go/informers/core/interface.go | 46 +++ .../informers/core/v1/componentstatus.go | 89 +++++ .../client-go/informers/core/v1/configmap.go | 90 +++++ .../client-go/informers/core/v1/endpoints.go | 90 +++++ .../client-go/informers/core/v1/event.go | 90 +++++ .../client-go/informers/core/v1/interface.go | 150 ++++++++ .../client-go/informers/core/v1/limitrange.go | 90 +++++ .../client-go/informers/core/v1/namespace.go | 89 +++++ .../client-go/informers/core/v1/node.go | 89 +++++ .../informers/core/v1/persistentvolume.go | 89 +++++ .../core/v1/persistentvolumeclaim.go | 90 +++++ .../k8s.io/client-go/informers/core/v1/pod.go | 90 +++++ .../informers/core/v1/podtemplate.go | 90 +++++ .../core/v1/replicationcontroller.go | 90 +++++ .../informers/core/v1/resourcequota.go | 90 +++++ .../client-go/informers/core/v1/secret.go | 90 +++++ .../client-go/informers/core/v1/service.go | 90 +++++ .../informers/core/v1/serviceaccount.go | 90 +++++ .../informers/discovery/interface.go | 54 +++ .../informers/discovery/v1/endpointslice.go | 90 +++++ .../informers/discovery/v1/interface.go | 45 +++ .../discovery/v1beta1/endpointslice.go | 90 +++++ .../informers/discovery/v1beta1/interface.go | 45 +++ .../client-go/informers/events/interface.go | 54 +++ .../client-go/informers/events/v1/event.go | 90 +++++ .../informers/events/v1/interface.go | 45 +++ .../informers/events/v1beta1/event.go | 90 +++++ .../informers/events/v1beta1/interface.go | 45 +++ .../informers/extensions/interface.go | 46 +++ .../informers/extensions/v1beta1/daemonset.go | 90 +++++ .../extensions/v1beta1/deployment.go | 90 +++++ .../informers/extensions/v1beta1/ingress.go | 90 +++++ .../informers/extensions/v1beta1/interface.go | 80 ++++ .../extensions/v1beta1/networkpolicy.go | 90 +++++ .../extensions/v1beta1/podsecuritypolicy.go | 89 +++++ .../extensions/v1beta1/replicaset.go | 90 +++++ vendor/k8s.io/client-go/informers/factory.go | 282 ++++++++++++++ .../informers/flowcontrol/interface.go | 54 +++ .../flowcontrol/v1alpha1/flowschema.go | 89 +++++ .../flowcontrol/v1alpha1/interface.go | 52 +++ .../v1alpha1/prioritylevelconfiguration.go | 89 +++++ .../flowcontrol/v1beta1/flowschema.go | 89 +++++ .../flowcontrol/v1beta1/interface.go | 52 +++ .../v1beta1/prioritylevelconfiguration.go | 89 +++++ vendor/k8s.io/client-go/informers/generic.go | 364 ++++++++++++++++++ .../internalinterfaces/factory_interfaces.go | 40 ++ .../informers/networking/interface.go | 54 +++ .../informers/networking/v1/ingress.go | 90 +++++ .../informers/networking/v1/ingressclass.go | 89 +++++ .../informers/networking/v1/interface.go | 59 +++ .../informers/networking/v1/networkpolicy.go | 90 +++++ .../informers/networking/v1beta1/ingress.go | 90 +++++ .../networking/v1beta1/ingressclass.go | 89 +++++ .../informers/networking/v1beta1/interface.go | 52 +++ .../client-go/informers/node/interface.go | 62 +++ .../client-go/informers/node/v1/interface.go | 45 +++ .../informers/node/v1/runtimeclass.go | 89 +++++ .../informers/node/v1alpha1/interface.go | 45 +++ .../informers/node/v1alpha1/runtimeclass.go | 89 +++++ .../informers/node/v1beta1/interface.go | 45 +++ .../informers/node/v1beta1/runtimeclass.go | 89 +++++ .../client-go/informers/policy/interface.go | 54 +++ .../informers/policy/v1/interface.go | 45 +++ .../policy/v1/poddisruptionbudget.go | 90 +++++ .../informers/policy/v1beta1/interface.go | 52 +++ .../policy/v1beta1/poddisruptionbudget.go | 90 +++++ .../policy/v1beta1/podsecuritypolicy.go | 89 +++++ .../client-go/informers/rbac/interface.go | 62 +++ .../informers/rbac/v1/clusterrole.go | 89 +++++ .../informers/rbac/v1/clusterrolebinding.go | 89 +++++ .../client-go/informers/rbac/v1/interface.go | 66 ++++ .../client-go/informers/rbac/v1/role.go | 90 +++++ .../informers/rbac/v1/rolebinding.go | 90 +++++ .../informers/rbac/v1alpha1/clusterrole.go | 89 +++++ .../rbac/v1alpha1/clusterrolebinding.go | 89 +++++ .../informers/rbac/v1alpha1/interface.go | 66 ++++ .../client-go/informers/rbac/v1alpha1/role.go | 90 +++++ .../informers/rbac/v1alpha1/rolebinding.go | 90 +++++ .../informers/rbac/v1beta1/clusterrole.go | 89 +++++ .../rbac/v1beta1/clusterrolebinding.go | 89 +++++ .../informers/rbac/v1beta1/interface.go | 66 ++++ .../client-go/informers/rbac/v1beta1/role.go | 90 +++++ .../informers/rbac/v1beta1/rolebinding.go | 90 +++++ .../informers/scheduling/interface.go | 62 +++ .../informers/scheduling/v1/interface.go | 45 +++ .../informers/scheduling/v1/priorityclass.go | 89 +++++ .../scheduling/v1alpha1/interface.go | 45 +++ .../scheduling/v1alpha1/priorityclass.go | 89 +++++ .../informers/scheduling/v1beta1/interface.go | 45 +++ .../scheduling/v1beta1/priorityclass.go | 89 +++++ .../client-go/informers/storage/interface.go | 62 +++ .../informers/storage/v1/csidriver.go | 89 +++++ .../client-go/informers/storage/v1/csinode.go | 89 +++++ .../informers/storage/v1/interface.go | 66 ++++ .../informers/storage/v1/storageclass.go | 89 +++++ .../informers/storage/v1/volumeattachment.go | 89 +++++ .../storage/v1alpha1/csistoragecapacity.go | 90 +++++ .../informers/storage/v1alpha1/interface.go | 52 +++ .../storage/v1alpha1/volumeattachment.go | 89 +++++ .../informers/storage/v1beta1/csidriver.go | 89 +++++ .../informers/storage/v1beta1/csinode.go | 89 +++++ .../storage/v1beta1/csistoragecapacity.go | 90 +++++ .../informers/storage/v1beta1/interface.go | 73 ++++ .../informers/storage/v1beta1/storageclass.go | 89 +++++ .../storage/v1beta1/volumeattachment.go | 89 +++++ .../v1/expansion_generated.go | 27 ++ .../v1/mutatingwebhookconfiguration.go | 68 ++++ .../v1/validatingwebhookconfiguration.go | 68 ++++ .../v1beta1/expansion_generated.go | 27 ++ .../v1beta1/mutatingwebhookconfiguration.go | 68 ++++ .../v1beta1/validatingwebhookconfiguration.go | 68 ++++ .../v1alpha1/expansion_generated.go | 23 ++ .../v1alpha1/storageversion.go | 68 ++++ .../listers/apps/v1/controllerrevision.go | 99 +++++ .../client-go/listers/apps/v1/daemonset.go | 99 +++++ .../listers/apps/v1/daemonset_expansion.go | 113 ++++++ .../client-go/listers/apps/v1/deployment.go | 99 +++++ .../listers/apps/v1/expansion_generated.go | 35 ++ .../client-go/listers/apps/v1/replicaset.go | 99 +++++ .../listers/apps/v1/replicaset_expansion.go | 73 ++++ .../client-go/listers/apps/v1/statefulset.go | 99 +++++ .../listers/apps/v1/statefulset_expansion.go | 77 ++++ .../apps/v1beta1/controllerrevision.go | 99 +++++ .../listers/apps/v1beta1/deployment.go | 99 +++++ .../apps/v1beta1/expansion_generated.go | 35 ++ .../listers/apps/v1beta1/statefulset.go | 99 +++++ .../apps/v1beta1/statefulset_expansion.go | 77 ++++ .../apps/v1beta2/controllerrevision.go | 99 +++++ .../listers/apps/v1beta2/daemonset.go | 99 +++++ .../apps/v1beta2/daemonset_expansion.go | 113 ++++++ .../listers/apps/v1beta2/deployment.go | 99 +++++ .../apps/v1beta2/expansion_generated.go | 35 ++ .../listers/apps/v1beta2/replicaset.go | 99 +++++ .../apps/v1beta2/replicaset_expansion.go | 73 ++++ .../listers/apps/v1beta2/statefulset.go | 99 +++++ .../apps/v1beta2/statefulset_expansion.go | 77 ++++ .../autoscaling/v1/expansion_generated.go | 27 ++ .../autoscaling/v1/horizontalpodautoscaler.go | 99 +++++ .../v2beta1/expansion_generated.go | 27 ++ .../v2beta1/horizontalpodautoscaler.go | 99 +++++ .../v2beta2/expansion_generated.go | 27 ++ .../v2beta2/horizontalpodautoscaler.go | 99 +++++ .../client-go/listers/batch/v1/cronjob.go | 99 +++++ .../listers/batch/v1/expansion_generated.go | 27 ++ .../k8s.io/client-go/listers/batch/v1/job.go | 99 +++++ .../listers/batch/v1/job_expansion.go | 68 ++++ .../listers/batch/v1beta1/cronjob.go | 99 +++++ .../batch/v1beta1/expansion_generated.go | 27 ++ .../v1/certificatesigningrequest.go | 68 ++++ .../certificates/v1/expansion_generated.go | 23 ++ .../v1beta1/certificatesigningrequest.go | 68 ++++ .../v1beta1/expansion_generated.go | 23 ++ .../coordination/v1/expansion_generated.go | 27 ++ .../listers/coordination/v1/lease.go | 99 +++++ .../v1beta1/expansion_generated.go | 27 ++ .../listers/coordination/v1beta1/lease.go | 99 +++++ .../listers/core/v1/componentstatus.go | 68 ++++ .../client-go/listers/core/v1/configmap.go | 99 +++++ .../client-go/listers/core/v1/endpoints.go | 99 +++++ .../k8s.io/client-go/listers/core/v1/event.go | 99 +++++ .../listers/core/v1/expansion_generated.go | 123 ++++++ .../client-go/listers/core/v1/limitrange.go | 99 +++++ .../client-go/listers/core/v1/namespace.go | 68 ++++ .../k8s.io/client-go/listers/core/v1/node.go | 68 ++++ .../listers/core/v1/persistentvolume.go | 68 ++++ .../listers/core/v1/persistentvolumeclaim.go | 99 +++++ .../k8s.io/client-go/listers/core/v1/pod.go | 99 +++++ .../client-go/listers/core/v1/podtemplate.go | 99 +++++ .../listers/core/v1/replicationcontroller.go | 99 +++++ .../v1/replicationcontroller_expansion.go | 66 ++++ .../listers/core/v1/resourcequota.go | 99 +++++ .../client-go/listers/core/v1/secret.go | 99 +++++ .../client-go/listers/core/v1/service.go | 99 +++++ .../listers/core/v1/serviceaccount.go | 99 +++++ .../listers/discovery/v1/endpointslice.go | 99 +++++ .../discovery/v1/expansion_generated.go | 27 ++ .../discovery/v1beta1/endpointslice.go | 99 +++++ .../discovery/v1beta1/expansion_generated.go | 27 ++ .../client-go/listers/events/v1/event.go | 99 +++++ .../listers/events/v1/expansion_generated.go | 27 ++ .../client-go/listers/events/v1beta1/event.go | 99 +++++ .../events/v1beta1/expansion_generated.go | 27 ++ .../listers/extensions/v1beta1/daemonset.go | 99 +++++ .../extensions/v1beta1/daemonset_expansion.go | 114 ++++++ .../listers/extensions/v1beta1/deployment.go | 99 +++++ .../extensions/v1beta1/expansion_generated.go | 47 +++ .../listers/extensions/v1beta1/ingress.go | 99 +++++ .../extensions/v1beta1/networkpolicy.go | 99 +++++ .../extensions/v1beta1/podsecuritypolicy.go | 68 ++++ .../listers/extensions/v1beta1/replicaset.go | 99 +++++ .../v1beta1/replicaset_expansion.go | 73 ++++ .../v1alpha1/expansion_generated.go | 27 ++ .../flowcontrol/v1alpha1/flowschema.go | 68 ++++ .../v1alpha1/prioritylevelconfiguration.go | 68 ++++ .../v1beta1/expansion_generated.go | 27 ++ .../listers/flowcontrol/v1beta1/flowschema.go | 68 ++++ .../v1beta1/prioritylevelconfiguration.go | 68 ++++ .../networking/v1/expansion_generated.go | 39 ++ .../listers/networking/v1/ingress.go | 99 +++++ .../listers/networking/v1/ingressclass.go | 68 ++++ .../listers/networking/v1/networkpolicy.go | 99 +++++ .../networking/v1beta1/expansion_generated.go | 31 ++ .../listers/networking/v1beta1/ingress.go | 99 +++++ .../networking/v1beta1/ingressclass.go | 68 ++++ .../listers/node/v1/expansion_generated.go | 23 ++ .../client-go/listers/node/v1/runtimeclass.go | 68 ++++ .../node/v1alpha1/expansion_generated.go | 23 ++ .../listers/node/v1alpha1/runtimeclass.go | 68 ++++ .../node/v1beta1/expansion_generated.go | 23 ++ .../listers/node/v1beta1/runtimeclass.go | 68 ++++ .../client-go/listers/policy/v1/eviction.go | 99 +++++ .../listers/policy/v1/expansion_generated.go | 27 ++ .../listers/policy/v1/poddisruptionbudget.go | 99 +++++ .../v1/poddisruptionbudget_expansion.go | 69 ++++ .../listers/policy/v1beta1/eviction.go | 99 +++++ .../policy/v1beta1/expansion_generated.go | 31 ++ .../policy/v1beta1/poddisruptionbudget.go | 99 +++++ .../v1beta1/poddisruptionbudget_expansion.go | 70 ++++ .../policy/v1beta1/podsecuritypolicy.go | 68 ++++ .../client-go/listers/rbac/v1/clusterrole.go | 68 ++++ .../listers/rbac/v1/clusterrolebinding.go | 68 ++++ .../listers/rbac/v1/expansion_generated.go | 43 +++ .../k8s.io/client-go/listers/rbac/v1/role.go | 99 +++++ .../client-go/listers/rbac/v1/rolebinding.go | 99 +++++ .../listers/rbac/v1alpha1/clusterrole.go | 68 ++++ .../rbac/v1alpha1/clusterrolebinding.go | 68 ++++ .../rbac/v1alpha1/expansion_generated.go | 43 +++ .../client-go/listers/rbac/v1alpha1/role.go | 99 +++++ .../listers/rbac/v1alpha1/rolebinding.go | 99 +++++ .../listers/rbac/v1beta1/clusterrole.go | 68 ++++ .../rbac/v1beta1/clusterrolebinding.go | 68 ++++ .../rbac/v1beta1/expansion_generated.go | 43 +++ .../client-go/listers/rbac/v1beta1/role.go | 99 +++++ .../listers/rbac/v1beta1/rolebinding.go | 99 +++++ .../scheduling/v1/expansion_generated.go | 23 ++ .../listers/scheduling/v1/priorityclass.go | 68 ++++ .../v1alpha1/expansion_generated.go | 23 ++ .../scheduling/v1alpha1/priorityclass.go | 68 ++++ .../scheduling/v1beta1/expansion_generated.go | 23 ++ .../scheduling/v1beta1/priorityclass.go | 68 ++++ .../client-go/listers/storage/v1/csidriver.go | 68 ++++ .../client-go/listers/storage/v1/csinode.go | 68 ++++ .../listers/storage/v1/expansion_generated.go | 35 ++ .../listers/storage/v1/storageclass.go | 68 ++++ .../listers/storage/v1/volumeattachment.go | 68 ++++ .../storage/v1alpha1/csistoragecapacity.go | 99 +++++ .../storage/v1alpha1/expansion_generated.go | 31 ++ .../storage/v1alpha1/volumeattachment.go | 68 ++++ .../listers/storage/v1beta1/csidriver.go | 68 ++++ .../listers/storage/v1beta1/csinode.go | 68 ++++ .../storage/v1beta1/csistoragecapacity.go | 99 +++++ .../storage/v1beta1/expansion_generated.go | 43 +++ .../listers/storage/v1beta1/storageclass.go | 68 ++++ .../storage/v1beta1/volumeattachment.go | 68 ++++ vendor/modules.txt | 112 ++++++ 563 files changed, 40063 insertions(+) create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_entries_to_acl.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_servers_to_server_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_acls_with_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_additional_certificates_with_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/client.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_acl.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_health_check_template.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_load_balancer.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rule.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_security_policy.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_server_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_acl.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_health_check_templates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_load_balancer.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rule.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_security_policy.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_server_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_regions.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_zones.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_deletion_protection.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_load_balancer_access_log.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_acls_from_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_additional_certificates_from_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_deletion_protection.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_load_balancer_access_log.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/endpoint.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_health_check_template_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_listener_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_load_balancer_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_entries.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acls.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_asyn_jobs.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_health_check_templates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listener_certificates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listeners.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_load_balancers.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policy_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_group_servers.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_groups.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_system_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_keys.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_resources.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_values.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/move_resource_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_entries_from_acl.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_servers_from_server_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/replace_servers_in_server_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/start_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/stop_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_tracing_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entries.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entry.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relation.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_get_listener_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_list_acl_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acls.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_action.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_backend_server.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ca_certificates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate_model.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_get_listener_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_list_listener_certificates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_system_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_condition.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_cookie_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_action.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_get_listener_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_list_listeners.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_deletion_protection_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_feature_labels.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_fixed_response_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config_in_list_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_header_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_get_health_check_template_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_health_check_templates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_server_groups.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_get_health_check_template_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_health_check_templates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_server_groups.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_template.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_templates.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_host_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_insert_header_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_job.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_jobs.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listeners.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_address.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_addresses.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_billing_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_lock.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_get_load_balancer_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_list_load_balancers.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancers.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_log_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_method_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_mirror_group_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_modification_protection_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_path_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_query_string_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_quic_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_redirect_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_region.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_regions.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener_in_list_security_policy_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_acl_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_security_policy_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_load_balancer_ids.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_remove_header_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_header_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_status_code_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rewrite_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_actions.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_conditions.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_id.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_ids.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relation.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relations.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_system_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policy.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_sticky_session.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuple.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_get_listener_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_listeners.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_groups.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_servers.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_source_ip_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_sticky_session_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_key.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_keys.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resource.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resources.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_values.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_get_load_balancer_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_load_balancers.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_server_groups.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_system_security_policies.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_limit_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_mirror_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_value.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_values_in_list_rules.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_x_forwarded_for_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mapping.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mappings.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zones.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/tag_resources.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/un_tag_resources.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_acl_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_health_check_template_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_log_config.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_edition.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rule_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rules_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_security_policy_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_servers_attribute.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/client.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate_with_name.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/delete_ssl_certificate.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_count.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_list.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_match_domain_list.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_private_key.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_public_key_detail.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/endpoint.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_list.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_match_domain_list.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_certificate_info.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_app_log.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/check_resource_orchestration.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/client.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_resource_orchestration.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/disable_alert.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/enable_alert.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/endpoint.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert_histories.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_sls_service.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/open_sls_service.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/query_saf_service.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/struct_app_model.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_groups.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go create mode 100644 vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go create mode 100644 vendor/github.com/eapache/channels/.gitignore create mode 100644 vendor/github.com/eapache/channels/.travis.yml create mode 100644 vendor/github.com/eapache/channels/CHANGELOG.md create mode 100644 vendor/github.com/eapache/channels/LICENSE create mode 100644 vendor/github.com/eapache/channels/README.md create mode 100644 vendor/github.com/eapache/channels/batching_channel.go create mode 100644 vendor/github.com/eapache/channels/black_hole.go create mode 100644 vendor/github.com/eapache/channels/channels.go create mode 100644 vendor/github.com/eapache/channels/infinite_channel.go create mode 100644 vendor/github.com/eapache/channels/native_channel.go create mode 100644 vendor/github.com/eapache/channels/overflowing_channel.go create mode 100644 vendor/github.com/eapache/channels/resizable_channel.go create mode 100644 vendor/github.com/eapache/channels/ring_channel.go create mode 100644 vendor/github.com/eapache/channels/shared_buffer.go create mode 100644 vendor/github.com/eapache/queue/.gitignore create mode 100644 vendor/github.com/eapache/queue/.travis.yml create mode 100644 vendor/github.com/eapache/queue/LICENSE create mode 100644 vendor/github.com/eapache/queue/README.md create mode 100644 vendor/github.com/eapache/queue/queue.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/errors_go113.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/errors_xerrors.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/ignore.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/sort.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/struct_filter.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go create mode 100644 vendor/golang.org/x/xerrors/LICENSE create mode 100644 vendor/golang.org/x/xerrors/PATENTS create mode 100644 vendor/golang.org/x/xerrors/README create mode 100644 vendor/golang.org/x/xerrors/adaptor.go create mode 100644 vendor/golang.org/x/xerrors/codereview.cfg create mode 100644 vendor/golang.org/x/xerrors/doc.go create mode 100644 vendor/golang.org/x/xerrors/errors.go create mode 100644 vendor/golang.org/x/xerrors/fmt.go create mode 100644 vendor/golang.org/x/xerrors/format.go create mode 100644 vendor/golang.org/x/xerrors/frame.go create mode 100644 vendor/golang.org/x/xerrors/go.mod create mode 100644 vendor/golang.org/x/xerrors/internal/internal.go create mode 100644 vendor/golang.org/x/xerrors/wrap.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/interface.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/informers/apiserverinternal/interface.go create mode 100644 vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go create mode 100644 vendor/k8s.io/client-go/informers/apps/interface.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1/daemonset.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1/deployment.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1/replicaset.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1/statefulset.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go create mode 100644 vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/interface.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go create mode 100644 vendor/k8s.io/client-go/informers/batch/interface.go create mode 100644 vendor/k8s.io/client-go/informers/batch/v1/cronjob.go create mode 100644 vendor/k8s.io/client-go/informers/batch/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/batch/v1/job.go create mode 100644 vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go create mode 100644 vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/certificates/interface.go create mode 100644 vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/informers/certificates/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/coordination/interface.go create mode 100644 vendor/k8s.io/client-go/informers/coordination/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/coordination/v1/lease.go create mode 100644 vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go create mode 100644 vendor/k8s.io/client-go/informers/core/interface.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/componentstatus.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/configmap.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/endpoints.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/event.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/limitrange.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/namespace.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/node.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/pod.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/podtemplate.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/resourcequota.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/secret.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/service.go create mode 100644 vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go create mode 100644 vendor/k8s.io/client-go/informers/discovery/interface.go create mode 100644 vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/informers/discovery/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/events/interface.go create mode 100644 vendor/k8s.io/client-go/informers/events/v1/event.go create mode 100644 vendor/k8s.io/client-go/informers/events/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/events/v1beta1/event.go create mode 100644 vendor/k8s.io/client-go/informers/events/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/interface.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go create mode 100644 vendor/k8s.io/client-go/informers/factory.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/interface.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/informers/generic.go create mode 100644 vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go create mode 100644 vendor/k8s.io/client-go/informers/networking/interface.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1/ingress.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/node/interface.go create mode 100644 vendor/k8s.io/client-go/informers/node/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/informers/node/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/informers/policy/interface.go create mode 100644 vendor/k8s.io/client-go/informers/policy/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/interface.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1/role.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go create mode 100644 vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/interface.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/informers/storage/interface.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1/csidriver.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1/csinode.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1/storageclass.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go create mode 100644 vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/daemonset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/deployment.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/replicaset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/statefulset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go create mode 100644 vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/listers/batch/v1/cronjob.go create mode 100644 vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/batch/v1/job.go create mode 100644 vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go create mode 100644 vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/coordination/v1/lease.go create mode 100644 vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/componentstatus.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/configmap.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/endpoints.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/event.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/limitrange.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/namespace.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/node.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/pod.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/podtemplate.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/resourcequota.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/secret.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/service.go create mode 100644 vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go create mode 100644 vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/events/v1/event.go create mode 100644 vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/events/v1beta1/event.go create mode 100644 vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go create mode 100644 vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go create mode 100644 vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go create mode 100644 vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1/ingress.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1/eviction.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go create mode 100644 vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1/role.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go create mode 100644 vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1/csidriver.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1/csinode.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1/storageclass.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go create mode 100644 vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go diff --git a/go.sum b/go.sum index 83093fc54..2ce563a1d 100644 --- a/go.sum +++ b/go.sum @@ -275,8 +275,11 @@ github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNE github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/channels v1.1.0 h1:F1taHcn7/F0i8DYqKXJnyhJcVpp2kgFcNePxXtnyu4k= +github.com/eapache/channels v1.1.0/go.mod h1:jMm2qB5Ubtg9zLd+inMZd2/NUvXgzmWXsDaLyQIGfH0= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_entries_to_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_entries_to_acl.go new file mode 100644 index 000000000..f95c12109 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_entries_to_acl.go @@ -0,0 +1,109 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AddEntriesToAcl invokes the alb.AddEntriesToAcl API synchronously +func (client *Client) AddEntriesToAcl(request *AddEntriesToAclRequest) (response *AddEntriesToAclResponse, err error) { + response = CreateAddEntriesToAclResponse() + err = client.DoAction(request, response) + return +} + +// AddEntriesToAclWithChan invokes the alb.AddEntriesToAcl API asynchronously +func (client *Client) AddEntriesToAclWithChan(request *AddEntriesToAclRequest) (<-chan *AddEntriesToAclResponse, <-chan error) { + responseChan := make(chan *AddEntriesToAclResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AddEntriesToAcl(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AddEntriesToAclWithCallback invokes the alb.AddEntriesToAcl API asynchronously +func (client *Client) AddEntriesToAclWithCallback(request *AddEntriesToAclRequest, callback func(response *AddEntriesToAclResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AddEntriesToAclResponse + var err error + defer close(result) + response, err = client.AddEntriesToAcl(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AddEntriesToAclRequest is the request struct for api AddEntriesToAcl +type AddEntriesToAclRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + AclId string `position:"Query" name:"AclId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + AclEntries *[]AddEntriesToAclAclEntries `position:"Query" name:"AclEntries" type:"Repeated"` +} + +// AddEntriesToAclAclEntries is a repeated param struct in AddEntriesToAclRequest +type AddEntriesToAclAclEntries struct { + Entry string `name:"Entry"` + Description string `name:"Description"` +} + +// AddEntriesToAclResponse is the response struct for api AddEntriesToAcl +type AddEntriesToAclResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateAddEntriesToAclRequest creates a request to invoke AddEntriesToAcl API +func CreateAddEntriesToAclRequest() (request *AddEntriesToAclRequest) { + request = &AddEntriesToAclRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "AddEntriesToAcl", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateAddEntriesToAclResponse creates a response to parse from AddEntriesToAcl response +func CreateAddEntriesToAclResponse() (response *AddEntriesToAclResponse) { + response = &AddEntriesToAclResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_servers_to_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_servers_to_server_group.go new file mode 100644 index 000000000..0750d628e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/add_servers_to_server_group.go @@ -0,0 +1,113 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AddServersToServerGroup invokes the alb.AddServersToServerGroup API synchronously +func (client *Client) AddServersToServerGroup(request *AddServersToServerGroupRequest) (response *AddServersToServerGroupResponse, err error) { + response = CreateAddServersToServerGroupResponse() + err = client.DoAction(request, response) + return +} + +// AddServersToServerGroupWithChan invokes the alb.AddServersToServerGroup API asynchronously +func (client *Client) AddServersToServerGroupWithChan(request *AddServersToServerGroupRequest) (<-chan *AddServersToServerGroupResponse, <-chan error) { + responseChan := make(chan *AddServersToServerGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AddServersToServerGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AddServersToServerGroupWithCallback invokes the alb.AddServersToServerGroup API asynchronously +func (client *Client) AddServersToServerGroupWithCallback(request *AddServersToServerGroupRequest, callback func(response *AddServersToServerGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AddServersToServerGroupResponse + var err error + defer close(result) + response, err = client.AddServersToServerGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AddServersToServerGroupRequest is the request struct for api AddServersToServerGroup +type AddServersToServerGroupRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ServerGroupId string `position:"Query" name:"ServerGroupId"` + Servers *[]AddServersToServerGroupServers `position:"Query" name:"Servers" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// AddServersToServerGroupServers is a repeated param struct in AddServersToServerGroupRequest +type AddServersToServerGroupServers struct { + ServerType string `name:"ServerType"` + Port string `name:"Port"` + Description string `name:"Description"` + ServerIp string `name:"ServerIp"` + Weight string `name:"Weight"` + ServerId string `name:"ServerId"` +} + +// AddServersToServerGroupResponse is the response struct for api AddServersToServerGroup +type AddServersToServerGroupResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateAddServersToServerGroupRequest creates a request to invoke AddServersToServerGroup API +func CreateAddServersToServerGroupRequest() (request *AddServersToServerGroupRequest) { + request = &AddServersToServerGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "AddServersToServerGroup", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateAddServersToServerGroupResponse creates a response to parse from AddServersToServerGroup response +func CreateAddServersToServerGroupResponse() (response *AddServersToServerGroupResponse) { + response = &AddServersToServerGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_acls_with_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_acls_with_listener.go new file mode 100644 index 000000000..4ca96b347 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_acls_with_listener.go @@ -0,0 +1,104 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AssociateAclsWithListener invokes the alb.AssociateAclsWithListener API synchronously +func (client *Client) AssociateAclsWithListener(request *AssociateAclsWithListenerRequest) (response *AssociateAclsWithListenerResponse, err error) { + response = CreateAssociateAclsWithListenerResponse() + err = client.DoAction(request, response) + return +} + +// AssociateAclsWithListenerWithChan invokes the alb.AssociateAclsWithListener API asynchronously +func (client *Client) AssociateAclsWithListenerWithChan(request *AssociateAclsWithListenerRequest) (<-chan *AssociateAclsWithListenerResponse, <-chan error) { + responseChan := make(chan *AssociateAclsWithListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AssociateAclsWithListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AssociateAclsWithListenerWithCallback invokes the alb.AssociateAclsWithListener API asynchronously +func (client *Client) AssociateAclsWithListenerWithCallback(request *AssociateAclsWithListenerRequest, callback func(response *AssociateAclsWithListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AssociateAclsWithListenerResponse + var err error + defer close(result) + response, err = client.AssociateAclsWithListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AssociateAclsWithListenerRequest is the request struct for api AssociateAclsWithListener +type AssociateAclsWithListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + AclIds *[]string `position:"Query" name:"AclIds" type:"Repeated"` + AclType string `position:"Query" name:"AclType"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// AssociateAclsWithListenerResponse is the response struct for api AssociateAclsWithListener +type AssociateAclsWithListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateAssociateAclsWithListenerRequest creates a request to invoke AssociateAclsWithListener API +func CreateAssociateAclsWithListenerRequest() (request *AssociateAclsWithListenerRequest) { + request = &AssociateAclsWithListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "AssociateAclsWithListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateAssociateAclsWithListenerResponse creates a response to parse from AssociateAclsWithListener response +func CreateAssociateAclsWithListenerResponse() (response *AssociateAclsWithListenerResponse) { + response = &AssociateAclsWithListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_additional_certificates_with_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_additional_certificates_with_listener.go new file mode 100644 index 000000000..7a2e0d884 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/associate_additional_certificates_with_listener.go @@ -0,0 +1,108 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AssociateAdditionalCertificatesWithListener invokes the alb.AssociateAdditionalCertificatesWithListener API synchronously +func (client *Client) AssociateAdditionalCertificatesWithListener(request *AssociateAdditionalCertificatesWithListenerRequest) (response *AssociateAdditionalCertificatesWithListenerResponse, err error) { + response = CreateAssociateAdditionalCertificatesWithListenerResponse() + err = client.DoAction(request, response) + return +} + +// AssociateAdditionalCertificatesWithListenerWithChan invokes the alb.AssociateAdditionalCertificatesWithListener API asynchronously +func (client *Client) AssociateAdditionalCertificatesWithListenerWithChan(request *AssociateAdditionalCertificatesWithListenerRequest) (<-chan *AssociateAdditionalCertificatesWithListenerResponse, <-chan error) { + responseChan := make(chan *AssociateAdditionalCertificatesWithListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AssociateAdditionalCertificatesWithListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AssociateAdditionalCertificatesWithListenerWithCallback invokes the alb.AssociateAdditionalCertificatesWithListener API asynchronously +func (client *Client) AssociateAdditionalCertificatesWithListenerWithCallback(request *AssociateAdditionalCertificatesWithListenerRequest, callback func(response *AssociateAdditionalCertificatesWithListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AssociateAdditionalCertificatesWithListenerResponse + var err error + defer close(result) + response, err = client.AssociateAdditionalCertificatesWithListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AssociateAdditionalCertificatesWithListenerRequest is the request struct for api AssociateAdditionalCertificatesWithListener +type AssociateAdditionalCertificatesWithListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + Certificates *[]AssociateAdditionalCertificatesWithListenerCertificates `position:"Query" name:"Certificates" type:"Repeated"` +} + +// AssociateAdditionalCertificatesWithListenerCertificates is a repeated param struct in AssociateAdditionalCertificatesWithListenerRequest +type AssociateAdditionalCertificatesWithListenerCertificates struct { + CertificateId string `name:"CertificateId"` +} + +// AssociateAdditionalCertificatesWithListenerResponse is the response struct for api AssociateAdditionalCertificatesWithListener +type AssociateAdditionalCertificatesWithListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateAssociateAdditionalCertificatesWithListenerRequest creates a request to invoke AssociateAdditionalCertificatesWithListener API +func CreateAssociateAdditionalCertificatesWithListenerRequest() (request *AssociateAdditionalCertificatesWithListenerRequest) { + request = &AssociateAdditionalCertificatesWithListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "AssociateAdditionalCertificatesWithListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateAssociateAdditionalCertificatesWithListenerResponse creates a response to parse from AssociateAdditionalCertificatesWithListener response +func CreateAssociateAdditionalCertificatesWithListenerResponse() (response *AssociateAdditionalCertificatesWithListenerResponse) { + response = &AssociateAdditionalCertificatesWithListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/client.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/client.go new file mode 100644 index 000000000..b098ea6a3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/client.go @@ -0,0 +1,129 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "reflect" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider" +) + +// Client is the sdk client struct, each func corresponds to an OpenAPI +type Client struct { + sdk.Client +} + +// SetClientProperty Set Property by Reflect +func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) { + v := reflect.ValueOf(client).Elem() + if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() { + v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue)) + } +} + +// SetEndpointDataToClient Set EndpointMap and ENdpointType +func SetEndpointDataToClient(client *Client) { + SetClientProperty(client, "EndpointMap", GetEndpointMap()) + SetClientProperty(client, "EndpointType", GetEndpointType()) +} + +// NewClient creates a sdk client with environment variables +func NewClient() (client *Client, err error) { + client = &Client{} + err = client.Init() + SetEndpointDataToClient(client) + return +} + +// NewClientWithProvider creates a sdk client with providers +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) { + client = &Client{} + var pc provider.Provider + if len(providers) == 0 { + pc = provider.DefaultChain + } else { + pc = provider.NewProviderChain(providers) + } + err = client.InitWithProviderChain(regionId, pc) + SetEndpointDataToClient(client) + return +} + +// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential +// this is the common api to create a sdk client +func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) { + client = &Client{} + err = client.InitWithOptions(regionId, config, credential) + SetEndpointDataToClient(client) + return +} + +// NewClientWithAccessKey is a shortcut to create sdk client with accesskey +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) { + client = &Client{} + err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret) + SetEndpointDataToClient(client) + return +} + +// NewClientWithStsToken is a shortcut to create sdk client with sts token +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) { + client = &Client{} + err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy) + SetEndpointDataToClient(client) + return +} + +// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) { + client = &Client{} + err = client.InitWithEcsRamRole(regionId, roleName) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) { + client = &Client{} + err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration) + SetEndpointDataToClient(client) + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_acl.go new file mode 100644 index 000000000..aa8ba2f73 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_acl.go @@ -0,0 +1,105 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateAcl invokes the alb.CreateAcl API synchronously +func (client *Client) CreateAcl(request *CreateAclRequest) (response *CreateAclResponse, err error) { + response = CreateCreateAclResponse() + err = client.DoAction(request, response) + return +} + +// CreateAclWithChan invokes the alb.CreateAcl API asynchronously +func (client *Client) CreateAclWithChan(request *CreateAclRequest) (<-chan *CreateAclResponse, <-chan error) { + responseChan := make(chan *CreateAclResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateAcl(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateAclWithCallback invokes the alb.CreateAcl API asynchronously +func (client *Client) CreateAclWithCallback(request *CreateAclRequest, callback func(response *CreateAclResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateAclResponse + var err error + defer close(result) + response, err = client.CreateAcl(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateAclRequest is the request struct for api CreateAcl +type CreateAclRequest struct { + *requests.RpcRequest + AclName string `position:"Query" name:"AclName"` + ClientToken string `position:"Query" name:"ClientToken"` + AddressIpVersion string `position:"Query" name:"AddressIpVersion"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// CreateAclResponse is the response struct for api CreateAcl +type CreateAclResponse struct { + *responses.BaseResponse + AclId string `json:"AclId" xml:"AclId"` + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateCreateAclRequest creates a request to invoke CreateAcl API +func CreateCreateAclRequest() (request *CreateAclRequest) { + request = &CreateAclRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateAcl", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateAclResponse creates a response to parse from CreateAcl response +func CreateCreateAclResponse() (response *CreateAclResponse) { + response = &CreateAclResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_health_check_template.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_health_check_template.go new file mode 100644 index 000000000..470b3c0cb --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_health_check_template.go @@ -0,0 +1,115 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateHealthCheckTemplate invokes the alb.CreateHealthCheckTemplate API synchronously +func (client *Client) CreateHealthCheckTemplate(request *CreateHealthCheckTemplateRequest) (response *CreateHealthCheckTemplateResponse, err error) { + response = CreateCreateHealthCheckTemplateResponse() + err = client.DoAction(request, response) + return +} + +// CreateHealthCheckTemplateWithChan invokes the alb.CreateHealthCheckTemplate API asynchronously +func (client *Client) CreateHealthCheckTemplateWithChan(request *CreateHealthCheckTemplateRequest) (<-chan *CreateHealthCheckTemplateResponse, <-chan error) { + responseChan := make(chan *CreateHealthCheckTemplateResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateHealthCheckTemplate(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateHealthCheckTemplateWithCallback invokes the alb.CreateHealthCheckTemplate API asynchronously +func (client *Client) CreateHealthCheckTemplateWithCallback(request *CreateHealthCheckTemplateRequest, callback func(response *CreateHealthCheckTemplateResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateHealthCheckTemplateResponse + var err error + defer close(result) + response, err = client.CreateHealthCheckTemplate(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateHealthCheckTemplateRequest is the request struct for api CreateHealthCheckTemplate +type CreateHealthCheckTemplateRequest struct { + *requests.RpcRequest + HealthCheckTimeout requests.Integer `position:"Query" name:"HealthCheckTimeout"` + ClientToken string `position:"Query" name:"ClientToken"` + HealthCheckProtocol string `position:"Query" name:"HealthCheckProtocol"` + UnhealthyThreshold requests.Integer `position:"Query" name:"UnhealthyThreshold"` + HealthyThreshold requests.Integer `position:"Query" name:"HealthyThreshold"` + HealthCheckTcpFastCloseEnabled requests.Boolean `position:"Query" name:"HealthCheckTcpFastCloseEnabled"` + HealthCheckPath string `position:"Query" name:"HealthCheckPath"` + HealthCheckCodes *[]string `position:"Query" name:"HealthCheckCodes" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + HealthCheckMethod string `position:"Query" name:"HealthCheckMethod"` + HealthCheckHost string `position:"Query" name:"HealthCheckHost"` + HealthCheckInterval requests.Integer `position:"Query" name:"HealthCheckInterval"` + HealthCheckTemplateName string `position:"Query" name:"HealthCheckTemplateName"` + HealthCheckHttpCodes *[]string `position:"Query" name:"HealthCheckHttpCodes" type:"Repeated"` + HealthCheckHttpVersion string `position:"Query" name:"HealthCheckHttpVersion"` + HealthCheckConnectPort requests.Integer `position:"Query" name:"HealthCheckConnectPort"` +} + +// CreateHealthCheckTemplateResponse is the response struct for api CreateHealthCheckTemplate +type CreateHealthCheckTemplateResponse struct { + *responses.BaseResponse + HealthCheckTemplateId string `json:"HealthCheckTemplateId" xml:"HealthCheckTemplateId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateCreateHealthCheckTemplateRequest creates a request to invoke CreateHealthCheckTemplate API +func CreateCreateHealthCheckTemplateRequest() (request *CreateHealthCheckTemplateRequest) { + request = &CreateHealthCheckTemplateRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateHealthCheckTemplate", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateHealthCheckTemplateResponse creates a response to parse from CreateHealthCheckTemplate response +func CreateCreateHealthCheckTemplateResponse() (response *CreateHealthCheckTemplateResponse) { + response = &CreateHealthCheckTemplateResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_listener.go new file mode 100644 index 000000000..ac1532f36 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_listener.go @@ -0,0 +1,166 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateListener invokes the alb.CreateListener API synchronously +func (client *Client) CreateListener(request *CreateListenerRequest) (response *CreateListenerResponse, err error) { + response = CreateCreateListenerResponse() + err = client.DoAction(request, response) + return +} + +// CreateListenerWithChan invokes the alb.CreateListener API asynchronously +func (client *Client) CreateListenerWithChan(request *CreateListenerRequest) (<-chan *CreateListenerResponse, <-chan error) { + responseChan := make(chan *CreateListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateListenerWithCallback invokes the alb.CreateListener API asynchronously +func (client *Client) CreateListenerWithCallback(request *CreateListenerRequest, callback func(response *CreateListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateListenerResponse + var err error + defer close(result) + response, err = client.CreateListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateListenerRequest is the request struct for api CreateListener +type CreateListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + GzipEnabled requests.Boolean `position:"Query" name:"GzipEnabled"` + QuicConfig CreateListenerQuicConfig `position:"Query" name:"QuicConfig" type:"Struct"` + Http2Enabled requests.Boolean `position:"Query" name:"Http2Enabled"` + DefaultActions *[]CreateListenerDefaultActions `position:"Query" name:"DefaultActions" type:"Repeated"` + ListenerPort requests.Integer `position:"Query" name:"ListenerPort"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + RequestTimeout requests.Integer `position:"Query" name:"RequestTimeout"` + CaCertificates *[]CreateListenerCaCertificates `position:"Query" name:"CaCertificates" type:"Repeated"` + XForwardedForConfig CreateListenerXForwardedForConfig `position:"Query" name:"XForwardedForConfig" type:"Struct"` + ListenerProtocol string `position:"Query" name:"ListenerProtocol"` + SecurityPolicyId string `position:"Query" name:"SecurityPolicyId"` + IdleTimeout requests.Integer `position:"Query" name:"IdleTimeout"` + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` + Certificates *[]CreateListenerCertificates `position:"Query" name:"Certificates" type:"Repeated"` + ListenerDescription string `position:"Query" name:"ListenerDescription"` + CaEnabled requests.Boolean `position:"Query" name:"CaEnabled"` +} + +// CreateListenerDefaultActions is a repeated param struct in CreateListenerRequest +type CreateListenerDefaultActions struct { + ForwardGroupConfig CreateListenerDefaultActionsForwardGroupConfig `name:"ForwardGroupConfig" type:"Struct"` + Type string `name:"Type"` +} + +// CreateListenerCaCertificates is a repeated param struct in CreateListenerRequest +type CreateListenerCaCertificates struct { + CertificateId string `name:"CertificateId"` +} + +// CreateListenerCertificates is a repeated param struct in CreateListenerRequest +type CreateListenerCertificates struct { + CertificateId string `name:"CertificateId"` +} + +// CreateListenerDefaultActionsForwardGroupConfig is a repeated param struct in CreateListenerRequest +type CreateListenerDefaultActionsForwardGroupConfig struct { + ServerGroupTuples *[]CreateListenerDefaultActionsForwardGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// CreateListenerDefaultActionsForwardGroupConfigServerGroupTuplesItem is a repeated param struct in CreateListenerRequest +type CreateListenerDefaultActionsForwardGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` +} + +// CreateListenerQuicConfig is a repeated param struct in CreateListenerRequest +type CreateListenerQuicConfig struct { + QuicUpgradeEnabled string `name:"QuicUpgradeEnabled"` + QuicListenerId string `name:"QuicListenerId"` +} + +// CreateListenerXForwardedForConfig is a repeated param struct in CreateListenerRequest +type CreateListenerXForwardedForConfig struct { + XForwardedForClientCertSubjectDNAlias string `name:"XForwardedForClientCertSubjectDNAlias"` + XForwardedForClientCertIssuerDNEnabled string `name:"XForwardedForClientCertIssuerDNEnabled"` + XForwardedForClientCertFingerprintEnabled string `name:"XForwardedForClientCertFingerprintEnabled"` + XForwardedForClientCertIssuerDNAlias string `name:"XForwardedForClientCertIssuerDNAlias"` + XForwardedForProtoEnabled string `name:"XForwardedForProtoEnabled"` + XForwardedForClientCertFingerprintAlias string `name:"XForwardedForClientCertFingerprintAlias"` + XForwardedForClientCertClientVerifyEnabled string `name:"XForwardedForClientCertClientVerifyEnabled"` + XForwardedForSLBPortEnabled string `name:"XForwardedForSLBPortEnabled"` + XForwardedForClientCertSubjectDNEnabled string `name:"XForwardedForClientCertSubjectDNEnabled"` + XForwardedForClientCertClientVerifyAlias string `name:"XForwardedForClientCertClientVerifyAlias"` + XForwardedForClientSrcPortEnabled string `name:"XForwardedForClientSrcPortEnabled"` + XForwardedForEnabled string `name:"XForwardedForEnabled"` + XForwardedForSLBIdEnabled string `name:"XForwardedForSLBIdEnabled"` +} + +// CreateListenerResponse is the response struct for api CreateListener +type CreateListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + ListenerId string `json:"ListenerId" xml:"ListenerId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateCreateListenerRequest creates a request to invoke CreateListener API +func CreateCreateListenerRequest() (request *CreateListenerRequest) { + request = &CreateListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateListenerResponse creates a response to parse from CreateListener response +func CreateCreateListenerResponse() (response *CreateListenerResponse) { + response = &CreateListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_load_balancer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_load_balancer.go new file mode 100644 index 000000000..59c2a637d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_load_balancer.go @@ -0,0 +1,130 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateLoadBalancer invokes the alb.CreateLoadBalancer API synchronously +func (client *Client) CreateLoadBalancer(request *CreateLoadBalancerRequest) (response *CreateLoadBalancerResponse, err error) { + response = CreateCreateLoadBalancerResponse() + err = client.DoAction(request, response) + return +} + +// CreateLoadBalancerWithChan invokes the alb.CreateLoadBalancer API asynchronously +func (client *Client) CreateLoadBalancerWithChan(request *CreateLoadBalancerRequest) (<-chan *CreateLoadBalancerResponse, <-chan error) { + responseChan := make(chan *CreateLoadBalancerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateLoadBalancer(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateLoadBalancerWithCallback invokes the alb.CreateLoadBalancer API asynchronously +func (client *Client) CreateLoadBalancerWithCallback(request *CreateLoadBalancerRequest, callback func(response *CreateLoadBalancerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateLoadBalancerResponse + var err error + defer close(result) + response, err = client.CreateLoadBalancer(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateLoadBalancerRequest is the request struct for api CreateLoadBalancer +type CreateLoadBalancerRequest struct { + *requests.RpcRequest + LoadBalancerEdition string `position:"Query" name:"LoadBalancerEdition"` + ClientToken string `position:"Query" name:"ClientToken"` + ModificationProtectionConfig CreateLoadBalancerModificationProtectionConfig `position:"Query" name:"ModificationProtectionConfig" type:"Struct"` + LoadBalancerBillingConfig CreateLoadBalancerLoadBalancerBillingConfig `position:"Query" name:"LoadBalancerBillingConfig" type:"Struct"` + DeletionProtectionEnabled requests.Boolean `position:"Query" name:"DeletionProtectionEnabled"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + LoadBalancerName string `position:"Query" name:"LoadBalancerName"` + AddressType string `position:"Query" name:"AddressType"` + AddressAllocatedMode string `position:"Query" name:"AddressAllocatedMode"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ZoneMappings *[]CreateLoadBalancerZoneMappings `position:"Query" name:"ZoneMappings" type:"Repeated"` + VpcId string `position:"Query" name:"VpcId"` +} + +// CreateLoadBalancerZoneMappings is a repeated param struct in CreateLoadBalancerRequest +type CreateLoadBalancerZoneMappings struct { + VSwitchId string `name:"VSwitchId"` + ZoneId string `name:"ZoneId"` +} + +// CreateLoadBalancerModificationProtectionConfig is a repeated param struct in CreateLoadBalancerRequest +type CreateLoadBalancerModificationProtectionConfig struct { + Reason string `name:"Reason"` + Status string `name:"Status"` +} + +// CreateLoadBalancerLoadBalancerBillingConfig is a repeated param struct in CreateLoadBalancerRequest +type CreateLoadBalancerLoadBalancerBillingConfig struct { + InternetChargeType string `name:"InternetChargeType"` + InternetBandwidth string `name:"InternetBandwidth"` + PayType string `name:"PayType"` +} + +// CreateLoadBalancerResponse is the response struct for api CreateLoadBalancer +type CreateLoadBalancerResponse struct { + *responses.BaseResponse + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateCreateLoadBalancerRequest creates a request to invoke CreateLoadBalancer API +func CreateCreateLoadBalancerRequest() (request *CreateLoadBalancerRequest) { + request = &CreateLoadBalancerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateLoadBalancer", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateLoadBalancerResponse creates a response to parse from CreateLoadBalancer response +func CreateCreateLoadBalancerResponse() (response *CreateLoadBalancerResponse) { + response = &CreateLoadBalancerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rule.go new file mode 100644 index 000000000..bc5b5209b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rule.go @@ -0,0 +1,271 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateRule invokes the alb.CreateRule API synchronously +func (client *Client) CreateRule(request *CreateRuleRequest) (response *CreateRuleResponse, err error) { + response = CreateCreateRuleResponse() + err = client.DoAction(request, response) + return +} + +// CreateRuleWithChan invokes the alb.CreateRule API asynchronously +func (client *Client) CreateRuleWithChan(request *CreateRuleRequest) (<-chan *CreateRuleResponse, <-chan error) { + responseChan := make(chan *CreateRuleResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateRule(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateRuleWithCallback invokes the alb.CreateRule API asynchronously +func (client *Client) CreateRuleWithCallback(request *CreateRuleRequest, callback func(response *CreateRuleResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateRuleResponse + var err error + defer close(result) + response, err = client.CreateRule(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateRuleRequest is the request struct for api CreateRule +type CreateRuleRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + RuleName string `position:"Query" name:"RuleName"` + ListenerId string `position:"Query" name:"ListenerId"` + Direction string `position:"Query" name:"Direction"` + RuleActions *[]CreateRuleRuleActions `position:"Query" name:"RuleActions" type:"Repeated"` + RuleConditions *[]CreateRuleRuleConditions `position:"Query" name:"RuleConditions" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + Priority requests.Integer `position:"Query" name:"Priority"` +} + +// CreateRuleRuleActions is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActions struct { + FixedResponseConfig CreateRuleRuleActionsFixedResponseConfig `name:"FixedResponseConfig" type:"Struct"` + TrafficMirrorConfig CreateRuleRuleActionsTrafficMirrorConfig `name:"TrafficMirrorConfig" type:"Struct"` + ForwardGroupConfig CreateRuleRuleActionsForwardGroupConfig `name:"ForwardGroupConfig" type:"Struct"` + RemoveHeaderConfig CreateRuleRuleActionsRemoveHeaderConfig `name:"RemoveHeaderConfig" type:"Struct"` + InsertHeaderConfig CreateRuleRuleActionsInsertHeaderConfig `name:"InsertHeaderConfig" type:"Struct"` + TrafficLimitConfig CreateRuleRuleActionsTrafficLimitConfig `name:"TrafficLimitConfig" type:"Struct"` + RedirectConfig CreateRuleRuleActionsRedirectConfig `name:"RedirectConfig" type:"Struct"` + Type string `name:"Type"` + Order string `name:"Order"` + RewriteConfig CreateRuleRuleActionsRewriteConfig `name:"RewriteConfig" type:"Struct"` +} + +// CreateRuleRuleConditions is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditions struct { + MethodConfig CreateRuleRuleConditionsMethodConfig `name:"MethodConfig" type:"Struct"` + SourceIpConfig CreateRuleRuleConditionsSourceIpConfig `name:"SourceIpConfig" type:"Struct"` + HostConfig CreateRuleRuleConditionsHostConfig `name:"HostConfig" type:"Struct"` + QueryStringConfig CreateRuleRuleConditionsQueryStringConfig `name:"QueryStringConfig" type:"Struct"` + ResponseStatusCodeConfig CreateRuleRuleConditionsResponseStatusCodeConfig `name:"ResponseStatusCodeConfig" type:"Struct"` + PathConfig CreateRuleRuleConditionsPathConfig `name:"PathConfig" type:"Struct"` + CookieConfig CreateRuleRuleConditionsCookieConfig `name:"CookieConfig" type:"Struct"` + Type string `name:"Type"` + HeaderConfig CreateRuleRuleConditionsHeaderConfig `name:"HeaderConfig" type:"Struct"` + ResponseHeaderConfig CreateRuleRuleConditionsResponseHeaderConfig `name:"ResponseHeaderConfig" type:"Struct"` +} + +// CreateRuleRuleActionsFixedResponseConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsFixedResponseConfig struct { + HttpCode string `name:"HttpCode"` + Content string `name:"Content"` + ContentType string `name:"ContentType"` +} + +// CreateRuleRuleActionsTrafficMirrorConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsTrafficMirrorConfig struct { + MirrorGroupConfig CreateRuleRuleActionsTrafficMirrorConfigMirrorGroupConfig `name:"MirrorGroupConfig" type:"Struct"` + TargetType string `name:"TargetType"` +} + +// CreateRuleRuleActionsForwardGroupConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsForwardGroupConfig struct { + ServerGroupStickySession CreateRuleRuleActionsForwardGroupConfigServerGroupStickySession `name:"ServerGroupStickySession" type:"Struct"` + ServerGroupTuples *[]CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// CreateRuleRuleActionsRemoveHeaderConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsRemoveHeaderConfig struct { + Key string `name:"Key"` +} + +// CreateRuleRuleActionsInsertHeaderConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsInsertHeaderConfig struct { + ValueType string `name:"ValueType"` + CoverEnabled string `name:"CoverEnabled"` + Value string `name:"Value"` + Key string `name:"Key"` +} + +// CreateRuleRuleActionsTrafficLimitConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsTrafficLimitConfig struct { + QPS string `name:"QPS"` +} + +// CreateRuleRuleActionsRedirectConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsRedirectConfig struct { + Path string `name:"Path"` + Protocol string `name:"Protocol"` + Port string `name:"Port"` + Query string `name:"Query"` + Host string `name:"Host"` + HttpCode string `name:"HttpCode"` +} + +// CreateRuleRuleActionsRewriteConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsRewriteConfig struct { + Path string `name:"Path"` + Query string `name:"Query"` + Host string `name:"Host"` +} + +// CreateRuleRuleConditionsMethodConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsMethodConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsSourceIpConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsSourceIpConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsHostConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsHostConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsQueryStringConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsQueryStringConfig struct { + Values *[]CreateRuleRuleConditionsQueryStringConfigValuesItem `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsResponseStatusCodeConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsResponseStatusCodeConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsPathConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsPathConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsCookieConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsCookieConfig struct { + Values *[]CreateRuleRuleConditionsCookieConfigValuesItem `name:"Values" type:"Repeated"` +} + +// CreateRuleRuleConditionsHeaderConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// CreateRuleRuleConditionsResponseHeaderConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsResponseHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// CreateRuleRuleActionsTrafficMirrorConfigMirrorGroupConfig is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsTrafficMirrorConfigMirrorGroupConfig struct { + ServerGroupTuples *[]CreateRuleRuleActionsTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// CreateRuleRuleActionsForwardGroupConfigServerGroupStickySession is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsForwardGroupConfigServerGroupStickySession struct { + Enabled string `name:"Enabled"` + Timeout string `name:"Timeout"` +} + +// CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsForwardGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` + Weight string `name:"Weight"` +} + +// CreateRuleRuleConditionsQueryStringConfigValuesItem is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsQueryStringConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// CreateRuleRuleConditionsCookieConfigValuesItem is a repeated param struct in CreateRuleRequest +type CreateRuleRuleConditionsCookieConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// CreateRuleRuleActionsTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem is a repeated param struct in CreateRuleRequest +type CreateRuleRuleActionsTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` +} + +// CreateRuleResponse is the response struct for api CreateRule +type CreateRuleResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` + RuleId string `json:"RuleId" xml:"RuleId"` +} + +// CreateCreateRuleRequest creates a request to invoke CreateRule API +func CreateCreateRuleRequest() (request *CreateRuleRequest) { + request = &CreateRuleRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateRule", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateRuleResponse creates a response to parse from CreateRule response +func CreateCreateRuleResponse() (response *CreateRuleResponse) { + response = &CreateRuleResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rules.go new file mode 100644 index 000000000..09ea69ec2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_rules.go @@ -0,0 +1,276 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateRules invokes the alb.CreateRules API synchronously +func (client *Client) CreateRules(request *CreateRulesRequest) (response *CreateRulesResponse, err error) { + response = CreateCreateRulesResponse() + err = client.DoAction(request, response) + return +} + +// CreateRulesWithChan invokes the alb.CreateRules API asynchronously +func (client *Client) CreateRulesWithChan(request *CreateRulesRequest) (<-chan *CreateRulesResponse, <-chan error) { + responseChan := make(chan *CreateRulesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateRules(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateRulesWithCallback invokes the alb.CreateRules API asynchronously +func (client *Client) CreateRulesWithCallback(request *CreateRulesRequest, callback func(response *CreateRulesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateRulesResponse + var err error + defer close(result) + response, err = client.CreateRules(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateRulesRequest is the request struct for api CreateRules +type CreateRulesRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + Rules *[]CreateRulesRules `position:"Query" name:"Rules" type:"Repeated"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// CreateRulesRules is a repeated param struct in CreateRulesRequest +type CreateRulesRules struct { + RuleConditions *[]CreateRulesRulesRuleConditionsItem `name:"RuleConditions" type:"Repeated"` + RuleName string `name:"RuleName"` + Priority string `name:"Priority"` + RuleActions *[]CreateRulesRulesRuleActionsItem `name:"RuleActions" type:"Repeated"` + Direction string `name:"Direction"` +} + +// CreateRulesRulesRuleConditionsItem is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItem struct { + MethodConfig CreateRulesRulesRuleConditionsItemMethodConfig `name:"MethodConfig" type:"Struct"` + SourceIpConfig CreateRulesRulesRuleConditionsItemSourceIpConfig `name:"SourceIpConfig" type:"Struct"` + HostConfig CreateRulesRulesRuleConditionsItemHostConfig `name:"HostConfig" type:"Struct"` + QueryStringConfig CreateRulesRulesRuleConditionsItemQueryStringConfig `name:"QueryStringConfig" type:"Struct"` + ResponseStatusCodeConfig CreateRulesRulesRuleConditionsItemResponseStatusCodeConfig `name:"ResponseStatusCodeConfig" type:"Struct"` + PathConfig CreateRulesRulesRuleConditionsItemPathConfig `name:"PathConfig" type:"Struct"` + CookieConfig CreateRulesRulesRuleConditionsItemCookieConfig `name:"CookieConfig" type:"Struct"` + Type string `name:"Type"` + HeaderConfig CreateRulesRulesRuleConditionsItemHeaderConfig `name:"HeaderConfig" type:"Struct"` + ResponseHeaderConfig CreateRulesRulesRuleConditionsItemResponseHeaderConfig `name:"ResponseHeaderConfig" type:"Struct"` +} + +// CreateRulesRulesRuleActionsItem is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItem struct { + FixedResponseConfig CreateRulesRulesRuleActionsItemFixedResponseConfig `name:"FixedResponseConfig" type:"Struct"` + TrafficMirrorConfig CreateRulesRulesRuleActionsItemTrafficMirrorConfig `name:"TrafficMirrorConfig" type:"Struct"` + ForwardGroupConfig CreateRulesRulesRuleActionsItemForwardGroupConfig `name:"ForwardGroupConfig" type:"Struct"` + RemoveHeaderConfig CreateRulesRulesRuleActionsItemRemoveHeaderConfig `name:"RemoveHeaderConfig" type:"Struct"` + InsertHeaderConfig CreateRulesRulesRuleActionsItemInsertHeaderConfig `name:"InsertHeaderConfig" type:"Struct"` + TrafficLimitConfig CreateRulesRulesRuleActionsItemTrafficLimitConfig `name:"TrafficLimitConfig" type:"Struct"` + RedirectConfig CreateRulesRulesRuleActionsItemRedirectConfig `name:"RedirectConfig" type:"Struct"` + Type string `name:"Type"` + Order string `name:"Order"` + RewriteConfig CreateRulesRulesRuleActionsItemRewriteConfig `name:"RewriteConfig" type:"Struct"` +} + +// CreateRulesRulesRuleConditionsItemMethodConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemMethodConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemSourceIpConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemSourceIpConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemHostConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemHostConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemQueryStringConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemQueryStringConfig struct { + Values *[]CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemResponseStatusCodeConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemResponseStatusCodeConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemPathConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemPathConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemCookieConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemCookieConfig struct { + Values *[]CreateRulesRulesRuleConditionsItemCookieConfigValuesItem `name:"Values" type:"Repeated"` +} + +// CreateRulesRulesRuleConditionsItemHeaderConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// CreateRulesRulesRuleConditionsItemResponseHeaderConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemResponseHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// CreateRulesRulesRuleActionsItemFixedResponseConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemFixedResponseConfig struct { + HttpCode string `name:"HttpCode"` + Content string `name:"Content"` + ContentType string `name:"ContentType"` +} + +// CreateRulesRulesRuleActionsItemTrafficMirrorConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemTrafficMirrorConfig struct { + MirrorGroupConfig CreateRulesRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfig `name:"MirrorGroupConfig" type:"Struct"` + TargetType string `name:"TargetType"` +} + +// CreateRulesRulesRuleActionsItemForwardGroupConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemForwardGroupConfig struct { + ServerGroupStickySession CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupStickySession `name:"ServerGroupStickySession" type:"Struct"` + ServerGroupTuples *[]CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// CreateRulesRulesRuleActionsItemRemoveHeaderConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemRemoveHeaderConfig struct { + Key string `name:"Key"` +} + +// CreateRulesRulesRuleActionsItemInsertHeaderConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemInsertHeaderConfig struct { + ValueType string `name:"ValueType"` + CoverEnabled string `name:"CoverEnabled"` + Value string `name:"Value"` + Key string `name:"Key"` +} + +// CreateRulesRulesRuleActionsItemTrafficLimitConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemTrafficLimitConfig struct { + QPS string `name:"QPS"` +} + +// CreateRulesRulesRuleActionsItemRedirectConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemRedirectConfig struct { + Path string `name:"Path"` + Protocol string `name:"Protocol"` + Port string `name:"Port"` + Query string `name:"Query"` + Host string `name:"Host"` + HttpCode string `name:"HttpCode"` +} + +// CreateRulesRulesRuleActionsItemRewriteConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemRewriteConfig struct { + Path string `name:"Path"` + Query string `name:"Query"` + Host string `name:"Host"` +} + +// CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemQueryStringConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// CreateRulesRulesRuleConditionsItemCookieConfigValuesItem is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleConditionsItemCookieConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// CreateRulesRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfig is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfig struct { + ServerGroupTuples *[]CreateRulesRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupStickySession is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupStickySession struct { + Enabled string `name:"Enabled"` + Timeout string `name:"Timeout"` +} + +// CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` + Weight string `name:"Weight"` +} + +// CreateRulesRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem is a repeated param struct in CreateRulesRequest +type CreateRulesRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` +} + +// CreateRulesResponse is the response struct for api CreateRules +type CreateRulesResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` + RuleIds []RuleId `json:"RuleIds" xml:"RuleIds"` +} + +// CreateCreateRulesRequest creates a request to invoke CreateRules API +func CreateCreateRulesRequest() (request *CreateRulesRequest) { + request = &CreateRulesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateRules", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateRulesResponse creates a response to parse from CreateRules response +func CreateCreateRulesResponse() (response *CreateRulesResponse) { + response = &CreateRulesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_security_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_security_policy.go new file mode 100644 index 000000000..4e0f4bceb --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_security_policy.go @@ -0,0 +1,105 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateSecurityPolicy invokes the alb.CreateSecurityPolicy API synchronously +func (client *Client) CreateSecurityPolicy(request *CreateSecurityPolicyRequest) (response *CreateSecurityPolicyResponse, err error) { + response = CreateCreateSecurityPolicyResponse() + err = client.DoAction(request, response) + return +} + +// CreateSecurityPolicyWithChan invokes the alb.CreateSecurityPolicy API asynchronously +func (client *Client) CreateSecurityPolicyWithChan(request *CreateSecurityPolicyRequest) (<-chan *CreateSecurityPolicyResponse, <-chan error) { + responseChan := make(chan *CreateSecurityPolicyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateSecurityPolicy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateSecurityPolicyWithCallback invokes the alb.CreateSecurityPolicy API asynchronously +func (client *Client) CreateSecurityPolicyWithCallback(request *CreateSecurityPolicyRequest, callback func(response *CreateSecurityPolicyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateSecurityPolicyResponse + var err error + defer close(result) + response, err = client.CreateSecurityPolicy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateSecurityPolicyRequest is the request struct for api CreateSecurityPolicy +type CreateSecurityPolicyRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + Ciphers *[]string `position:"Query" name:"Ciphers" type:"Repeated"` + TLSVersions *[]string `position:"Query" name:"TLSVersions" type:"Repeated"` + SecurityPolicyName string `position:"Query" name:"SecurityPolicyName"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// CreateSecurityPolicyResponse is the response struct for api CreateSecurityPolicy +type CreateSecurityPolicyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + SecurityPolicyId string `json:"SecurityPolicyId" xml:"SecurityPolicyId"` +} + +// CreateCreateSecurityPolicyRequest creates a request to invoke CreateSecurityPolicy API +func CreateCreateSecurityPolicyRequest() (request *CreateSecurityPolicyRequest) { + request = &CreateSecurityPolicyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateSecurityPolicy", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateSecurityPolicyResponse creates a response to parse from CreateSecurityPolicy response +func CreateCreateSecurityPolicyResponse() (response *CreateSecurityPolicyResponse) { + response = &CreateSecurityPolicyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_server_group.go new file mode 100644 index 000000000..f91aff4a5 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/create_server_group.go @@ -0,0 +1,136 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateServerGroup invokes the alb.CreateServerGroup API synchronously +func (client *Client) CreateServerGroup(request *CreateServerGroupRequest) (response *CreateServerGroupResponse, err error) { + response = CreateCreateServerGroupResponse() + err = client.DoAction(request, response) + return +} + +// CreateServerGroupWithChan invokes the alb.CreateServerGroup API asynchronously +func (client *Client) CreateServerGroupWithChan(request *CreateServerGroupRequest) (<-chan *CreateServerGroupResponse, <-chan error) { + responseChan := make(chan *CreateServerGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateServerGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateServerGroupWithCallback invokes the alb.CreateServerGroup API asynchronously +func (client *Client) CreateServerGroupWithCallback(request *CreateServerGroupRequest, callback func(response *CreateServerGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateServerGroupResponse + var err error + defer close(result) + response, err = client.CreateServerGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateServerGroupRequest is the request struct for api CreateServerGroup +type CreateServerGroupRequest struct { + *requests.RpcRequest + ServerGroupName string `position:"Query" name:"ServerGroupName"` + ClientToken string `position:"Query" name:"ClientToken"` + HealthCheckConfig CreateServerGroupHealthCheckConfig `position:"Query" name:"HealthCheckConfig" type:"Struct"` + Scheduler string `position:"Query" name:"Scheduler"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + Protocol string `position:"Query" name:"Protocol"` + StickySessionConfig CreateServerGroupStickySessionConfig `position:"Query" name:"StickySessionConfig" type:"Struct"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + ServerGroupType string `position:"Query" name:"ServerGroupType"` + VpcId string `position:"Query" name:"VpcId"` +} + +// CreateServerGroupHealthCheckConfig is a repeated param struct in CreateServerGroupRequest +type CreateServerGroupHealthCheckConfig struct { + HealthCheckCodes *[]string `name:"HealthCheckCodes" type:"Repeated"` + HealthCheckEnabled string `name:"HealthCheckEnabled"` + HealthCheckTimeout string `name:"HealthCheckTimeout"` + HealthCheckMethod string `name:"HealthCheckMethod"` + HealthCheckHost string `name:"HealthCheckHost"` + HealthCheckProtocol string `name:"HealthCheckProtocol"` + UnhealthyThreshold string `name:"UnhealthyThreshold"` + HealthyThreshold string `name:"HealthyThreshold"` + HealthCheckTcpFastCloseEnabled string `name:"HealthCheckTcpFastCloseEnabled"` + HealthCheckPath string `name:"HealthCheckPath"` + HealthCheckInterval string `name:"HealthCheckInterval"` + HealthCheckHttpCodes *[]string `name:"HealthCheckHttpCodes" type:"Repeated"` + HealthCheckHttpVersion string `name:"HealthCheckHttpVersion"` + HealthCheckConnectPort string `name:"HealthCheckConnectPort"` +} + +// CreateServerGroupStickySessionConfig is a repeated param struct in CreateServerGroupRequest +type CreateServerGroupStickySessionConfig struct { + StickySessionEnabled string `name:"StickySessionEnabled"` + Cookie string `name:"Cookie"` + CookieTimeout string `name:"CookieTimeout"` + StickySessionType string `name:"StickySessionType"` +} + +// CreateServerGroupResponse is the response struct for api CreateServerGroup +type CreateServerGroupResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` + ServerGroupId string `json:"ServerGroupId" xml:"ServerGroupId"` +} + +// CreateCreateServerGroupRequest creates a request to invoke CreateServerGroup API +func CreateCreateServerGroupRequest() (request *CreateServerGroupRequest) { + request = &CreateServerGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "CreateServerGroup", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateServerGroupResponse creates a response to parse from CreateServerGroup response +func CreateCreateServerGroupResponse() (response *CreateServerGroupResponse) { + response = &CreateServerGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_acl.go new file mode 100644 index 000000000..fbc1c5b4d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_acl.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteAcl invokes the alb.DeleteAcl API synchronously +func (client *Client) DeleteAcl(request *DeleteAclRequest) (response *DeleteAclResponse, err error) { + response = CreateDeleteAclResponse() + err = client.DoAction(request, response) + return +} + +// DeleteAclWithChan invokes the alb.DeleteAcl API asynchronously +func (client *Client) DeleteAclWithChan(request *DeleteAclRequest) (<-chan *DeleteAclResponse, <-chan error) { + responseChan := make(chan *DeleteAclResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteAcl(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteAclWithCallback invokes the alb.DeleteAcl API asynchronously +func (client *Client) DeleteAclWithCallback(request *DeleteAclRequest, callback func(response *DeleteAclResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteAclResponse + var err error + defer close(result) + response, err = client.DeleteAcl(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteAclRequest is the request struct for api DeleteAcl +type DeleteAclRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + AclId string `position:"Query" name:"AclId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// DeleteAclResponse is the response struct for api DeleteAcl +type DeleteAclResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteAclRequest creates a request to invoke DeleteAcl API +func CreateDeleteAclRequest() (request *DeleteAclRequest) { + request = &DeleteAclRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteAcl", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteAclResponse creates a response to parse from DeleteAcl response +func CreateDeleteAclResponse() (response *DeleteAclResponse) { + response = &DeleteAclResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_health_check_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_health_check_templates.go new file mode 100644 index 000000000..de563e7f7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_health_check_templates.go @@ -0,0 +1,101 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteHealthCheckTemplates invokes the alb.DeleteHealthCheckTemplates API synchronously +func (client *Client) DeleteHealthCheckTemplates(request *DeleteHealthCheckTemplatesRequest) (response *DeleteHealthCheckTemplatesResponse, err error) { + response = CreateDeleteHealthCheckTemplatesResponse() + err = client.DoAction(request, response) + return +} + +// DeleteHealthCheckTemplatesWithChan invokes the alb.DeleteHealthCheckTemplates API asynchronously +func (client *Client) DeleteHealthCheckTemplatesWithChan(request *DeleteHealthCheckTemplatesRequest) (<-chan *DeleteHealthCheckTemplatesResponse, <-chan error) { + responseChan := make(chan *DeleteHealthCheckTemplatesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteHealthCheckTemplates(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteHealthCheckTemplatesWithCallback invokes the alb.DeleteHealthCheckTemplates API asynchronously +func (client *Client) DeleteHealthCheckTemplatesWithCallback(request *DeleteHealthCheckTemplatesRequest, callback func(response *DeleteHealthCheckTemplatesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteHealthCheckTemplatesResponse + var err error + defer close(result) + response, err = client.DeleteHealthCheckTemplates(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteHealthCheckTemplatesRequest is the request struct for api DeleteHealthCheckTemplates +type DeleteHealthCheckTemplatesRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + HealthCheckTemplateIds *[]string `position:"Query" name:"HealthCheckTemplateIds" type:"Repeated"` +} + +// DeleteHealthCheckTemplatesResponse is the response struct for api DeleteHealthCheckTemplates +type DeleteHealthCheckTemplatesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteHealthCheckTemplatesRequest creates a request to invoke DeleteHealthCheckTemplates API +func CreateDeleteHealthCheckTemplatesRequest() (request *DeleteHealthCheckTemplatesRequest) { + request = &DeleteHealthCheckTemplatesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteHealthCheckTemplates", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteHealthCheckTemplatesResponse creates a response to parse from DeleteHealthCheckTemplates response +func CreateDeleteHealthCheckTemplatesResponse() (response *DeleteHealthCheckTemplatesResponse) { + response = &DeleteHealthCheckTemplatesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_listener.go new file mode 100644 index 000000000..d593bd266 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_listener.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteListener invokes the alb.DeleteListener API synchronously +func (client *Client) DeleteListener(request *DeleteListenerRequest) (response *DeleteListenerResponse, err error) { + response = CreateDeleteListenerResponse() + err = client.DoAction(request, response) + return +} + +// DeleteListenerWithChan invokes the alb.DeleteListener API asynchronously +func (client *Client) DeleteListenerWithChan(request *DeleteListenerRequest) (<-chan *DeleteListenerResponse, <-chan error) { + responseChan := make(chan *DeleteListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteListenerWithCallback invokes the alb.DeleteListener API asynchronously +func (client *Client) DeleteListenerWithCallback(request *DeleteListenerRequest, callback func(response *DeleteListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteListenerResponse + var err error + defer close(result) + response, err = client.DeleteListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteListenerRequest is the request struct for api DeleteListener +type DeleteListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// DeleteListenerResponse is the response struct for api DeleteListener +type DeleteListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteListenerRequest creates a request to invoke DeleteListener API +func CreateDeleteListenerRequest() (request *DeleteListenerRequest) { + request = &DeleteListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteListenerResponse creates a response to parse from DeleteListener response +func CreateDeleteListenerResponse() (response *DeleteListenerResponse) { + response = &DeleteListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_load_balancer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_load_balancer.go new file mode 100644 index 000000000..a91867b84 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_load_balancer.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteLoadBalancer invokes the alb.DeleteLoadBalancer API synchronously +func (client *Client) DeleteLoadBalancer(request *DeleteLoadBalancerRequest) (response *DeleteLoadBalancerResponse, err error) { + response = CreateDeleteLoadBalancerResponse() + err = client.DoAction(request, response) + return +} + +// DeleteLoadBalancerWithChan invokes the alb.DeleteLoadBalancer API asynchronously +func (client *Client) DeleteLoadBalancerWithChan(request *DeleteLoadBalancerRequest) (<-chan *DeleteLoadBalancerResponse, <-chan error) { + responseChan := make(chan *DeleteLoadBalancerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteLoadBalancer(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteLoadBalancerWithCallback invokes the alb.DeleteLoadBalancer API asynchronously +func (client *Client) DeleteLoadBalancerWithCallback(request *DeleteLoadBalancerRequest, callback func(response *DeleteLoadBalancerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteLoadBalancerResponse + var err error + defer close(result) + response, err = client.DeleteLoadBalancer(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteLoadBalancerRequest is the request struct for api DeleteLoadBalancer +type DeleteLoadBalancerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` +} + +// DeleteLoadBalancerResponse is the response struct for api DeleteLoadBalancer +type DeleteLoadBalancerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteLoadBalancerRequest creates a request to invoke DeleteLoadBalancer API +func CreateDeleteLoadBalancerRequest() (request *DeleteLoadBalancerRequest) { + request = &DeleteLoadBalancerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteLoadBalancer", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteLoadBalancerResponse creates a response to parse from DeleteLoadBalancer response +func CreateDeleteLoadBalancerResponse() (response *DeleteLoadBalancerResponse) { + response = &DeleteLoadBalancerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rule.go new file mode 100644 index 000000000..0b6f538b7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rule.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteRule invokes the alb.DeleteRule API synchronously +func (client *Client) DeleteRule(request *DeleteRuleRequest) (response *DeleteRuleResponse, err error) { + response = CreateDeleteRuleResponse() + err = client.DoAction(request, response) + return +} + +// DeleteRuleWithChan invokes the alb.DeleteRule API asynchronously +func (client *Client) DeleteRuleWithChan(request *DeleteRuleRequest) (<-chan *DeleteRuleResponse, <-chan error) { + responseChan := make(chan *DeleteRuleResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteRule(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteRuleWithCallback invokes the alb.DeleteRule API asynchronously +func (client *Client) DeleteRuleWithCallback(request *DeleteRuleRequest, callback func(response *DeleteRuleResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteRuleResponse + var err error + defer close(result) + response, err = client.DeleteRule(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteRuleRequest is the request struct for api DeleteRule +type DeleteRuleRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + RuleId string `position:"Query" name:"RuleId"` +} + +// DeleteRuleResponse is the response struct for api DeleteRule +type DeleteRuleResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteRuleRequest creates a request to invoke DeleteRule API +func CreateDeleteRuleRequest() (request *DeleteRuleRequest) { + request = &DeleteRuleRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteRule", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteRuleResponse creates a response to parse from DeleteRule response +func CreateDeleteRuleResponse() (response *DeleteRuleResponse) { + response = &DeleteRuleResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rules.go new file mode 100644 index 000000000..61681b607 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_rules.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteRules invokes the alb.DeleteRules API synchronously +func (client *Client) DeleteRules(request *DeleteRulesRequest) (response *DeleteRulesResponse, err error) { + response = CreateDeleteRulesResponse() + err = client.DoAction(request, response) + return +} + +// DeleteRulesWithChan invokes the alb.DeleteRules API asynchronously +func (client *Client) DeleteRulesWithChan(request *DeleteRulesRequest) (<-chan *DeleteRulesResponse, <-chan error) { + responseChan := make(chan *DeleteRulesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteRules(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteRulesWithCallback invokes the alb.DeleteRules API asynchronously +func (client *Client) DeleteRulesWithCallback(request *DeleteRulesRequest, callback func(response *DeleteRulesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteRulesResponse + var err error + defer close(result) + response, err = client.DeleteRules(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteRulesRequest is the request struct for api DeleteRules +type DeleteRulesRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + RuleIds *[]string `position:"Query" name:"RuleIds" type:"Repeated"` +} + +// DeleteRulesResponse is the response struct for api DeleteRules +type DeleteRulesResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteRulesRequest creates a request to invoke DeleteRules API +func CreateDeleteRulesRequest() (request *DeleteRulesRequest) { + request = &DeleteRulesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteRules", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteRulesResponse creates a response to parse from DeleteRules response +func CreateDeleteRulesResponse() (response *DeleteRulesResponse) { + response = &DeleteRulesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_security_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_security_policy.go new file mode 100644 index 000000000..42ea900f7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_security_policy.go @@ -0,0 +1,101 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteSecurityPolicy invokes the alb.DeleteSecurityPolicy API synchronously +func (client *Client) DeleteSecurityPolicy(request *DeleteSecurityPolicyRequest) (response *DeleteSecurityPolicyResponse, err error) { + response = CreateDeleteSecurityPolicyResponse() + err = client.DoAction(request, response) + return +} + +// DeleteSecurityPolicyWithChan invokes the alb.DeleteSecurityPolicy API asynchronously +func (client *Client) DeleteSecurityPolicyWithChan(request *DeleteSecurityPolicyRequest) (<-chan *DeleteSecurityPolicyResponse, <-chan error) { + responseChan := make(chan *DeleteSecurityPolicyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteSecurityPolicy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteSecurityPolicyWithCallback invokes the alb.DeleteSecurityPolicy API asynchronously +func (client *Client) DeleteSecurityPolicyWithCallback(request *DeleteSecurityPolicyRequest, callback func(response *DeleteSecurityPolicyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteSecurityPolicyResponse + var err error + defer close(result) + response, err = client.DeleteSecurityPolicy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteSecurityPolicyRequest is the request struct for api DeleteSecurityPolicy +type DeleteSecurityPolicyRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + SecurityPolicyId string `position:"Query" name:"SecurityPolicyId"` +} + +// DeleteSecurityPolicyResponse is the response struct for api DeleteSecurityPolicy +type DeleteSecurityPolicyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteSecurityPolicyRequest creates a request to invoke DeleteSecurityPolicy API +func CreateDeleteSecurityPolicyRequest() (request *DeleteSecurityPolicyRequest) { + request = &DeleteSecurityPolicyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteSecurityPolicy", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteSecurityPolicyResponse creates a response to parse from DeleteSecurityPolicy response +func CreateDeleteSecurityPolicyResponse() (response *DeleteSecurityPolicyResponse) { + response = &DeleteSecurityPolicyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_server_group.go new file mode 100644 index 000000000..2893bbc5a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/delete_server_group.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteServerGroup invokes the alb.DeleteServerGroup API synchronously +func (client *Client) DeleteServerGroup(request *DeleteServerGroupRequest) (response *DeleteServerGroupResponse, err error) { + response = CreateDeleteServerGroupResponse() + err = client.DoAction(request, response) + return +} + +// DeleteServerGroupWithChan invokes the alb.DeleteServerGroup API asynchronously +func (client *Client) DeleteServerGroupWithChan(request *DeleteServerGroupRequest) (<-chan *DeleteServerGroupResponse, <-chan error) { + responseChan := make(chan *DeleteServerGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteServerGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteServerGroupWithCallback invokes the alb.DeleteServerGroup API asynchronously +func (client *Client) DeleteServerGroupWithCallback(request *DeleteServerGroupRequest, callback func(response *DeleteServerGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteServerGroupResponse + var err error + defer close(result) + response, err = client.DeleteServerGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteServerGroupRequest is the request struct for api DeleteServerGroup +type DeleteServerGroupRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ServerGroupId string `position:"Query" name:"ServerGroupId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// DeleteServerGroupResponse is the response struct for api DeleteServerGroup +type DeleteServerGroupResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteServerGroupRequest creates a request to invoke DeleteServerGroup API +func CreateDeleteServerGroupRequest() (request *DeleteServerGroupRequest) { + request = &DeleteServerGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DeleteServerGroup", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteServerGroupResponse creates a response to parse from DeleteServerGroup response +func CreateDeleteServerGroupResponse() (response *DeleteServerGroupResponse) { + response = &DeleteServerGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_regions.go new file mode 100644 index 000000000..af12a4457 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_regions.go @@ -0,0 +1,100 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeRegions invokes the alb.DescribeRegions API synchronously +func (client *Client) DescribeRegions(request *DescribeRegionsRequest) (response *DescribeRegionsResponse, err error) { + response = CreateDescribeRegionsResponse() + err = client.DoAction(request, response) + return +} + +// DescribeRegionsWithChan invokes the alb.DescribeRegions API asynchronously +func (client *Client) DescribeRegionsWithChan(request *DescribeRegionsRequest) (<-chan *DescribeRegionsResponse, <-chan error) { + responseChan := make(chan *DescribeRegionsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeRegions(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeRegionsWithCallback invokes the alb.DescribeRegions API asynchronously +func (client *Client) DescribeRegionsWithCallback(request *DescribeRegionsRequest, callback func(response *DescribeRegionsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeRegionsResponse + var err error + defer close(result) + response, err = client.DescribeRegions(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeRegionsRequest is the request struct for api DescribeRegions +type DescribeRegionsRequest struct { + *requests.RpcRequest + AcceptLanguage string `position:"Query" name:"AcceptLanguage"` +} + +// DescribeRegionsResponse is the response struct for api DescribeRegions +type DescribeRegionsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Regions []Region `json:"Regions" xml:"Regions"` +} + +// CreateDescribeRegionsRequest creates a request to invoke DescribeRegions API +func CreateDescribeRegionsRequest() (request *DescribeRegionsRequest) { + request = &DescribeRegionsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DescribeRegions", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeRegionsResponse creates a response to parse from DescribeRegions response +func CreateDescribeRegionsResponse() (response *DescribeRegionsResponse) { + response = &DescribeRegionsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_zones.go new file mode 100644 index 000000000..d29b2c2c3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/describe_zones.go @@ -0,0 +1,99 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeZones invokes the alb.DescribeZones API synchronously +func (client *Client) DescribeZones(request *DescribeZonesRequest) (response *DescribeZonesResponse, err error) { + response = CreateDescribeZonesResponse() + err = client.DoAction(request, response) + return +} + +// DescribeZonesWithChan invokes the alb.DescribeZones API asynchronously +func (client *Client) DescribeZonesWithChan(request *DescribeZonesRequest) (<-chan *DescribeZonesResponse, <-chan error) { + responseChan := make(chan *DescribeZonesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeZones(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeZonesWithCallback invokes the alb.DescribeZones API asynchronously +func (client *Client) DescribeZonesWithCallback(request *DescribeZonesRequest, callback func(response *DescribeZonesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeZonesResponse + var err error + defer close(result) + response, err = client.DescribeZones(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeZonesRequest is the request struct for api DescribeZones +type DescribeZonesRequest struct { + *requests.RpcRequest +} + +// DescribeZonesResponse is the response struct for api DescribeZones +type DescribeZonesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Zones []Zone `json:"Zones" xml:"Zones"` +} + +// CreateDescribeZonesRequest creates a request to invoke DescribeZones API +func CreateDescribeZonesRequest() (request *DescribeZonesRequest) { + request = &DescribeZonesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DescribeZones", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeZonesResponse creates a response to parse from DescribeZones response +func CreateDescribeZonesResponse() (response *DescribeZonesResponse) { + response = &DescribeZonesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_deletion_protection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_deletion_protection.go new file mode 100644 index 000000000..cae5c2401 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_deletion_protection.go @@ -0,0 +1,101 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DisableDeletionProtection invokes the alb.DisableDeletionProtection API synchronously +func (client *Client) DisableDeletionProtection(request *DisableDeletionProtectionRequest) (response *DisableDeletionProtectionResponse, err error) { + response = CreateDisableDeletionProtectionResponse() + err = client.DoAction(request, response) + return +} + +// DisableDeletionProtectionWithChan invokes the alb.DisableDeletionProtection API asynchronously +func (client *Client) DisableDeletionProtectionWithChan(request *DisableDeletionProtectionRequest) (<-chan *DisableDeletionProtectionResponse, <-chan error) { + responseChan := make(chan *DisableDeletionProtectionResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DisableDeletionProtection(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DisableDeletionProtectionWithCallback invokes the alb.DisableDeletionProtection API asynchronously +func (client *Client) DisableDeletionProtectionWithCallback(request *DisableDeletionProtectionRequest, callback func(response *DisableDeletionProtectionResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DisableDeletionProtectionResponse + var err error + defer close(result) + response, err = client.DisableDeletionProtection(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DisableDeletionProtectionRequest is the request struct for api DisableDeletionProtection +type DisableDeletionProtectionRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ResourceId string `position:"Query" name:"ResourceId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// DisableDeletionProtectionResponse is the response struct for api DisableDeletionProtection +type DisableDeletionProtectionResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDisableDeletionProtectionRequest creates a request to invoke DisableDeletionProtection API +func CreateDisableDeletionProtectionRequest() (request *DisableDeletionProtectionRequest) { + request = &DisableDeletionProtectionRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DisableDeletionProtection", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDisableDeletionProtectionResponse creates a response to parse from DisableDeletionProtection response +func CreateDisableDeletionProtectionResponse() (response *DisableDeletionProtectionResponse) { + response = &DisableDeletionProtectionResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_load_balancer_access_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_load_balancer_access_log.go new file mode 100644 index 000000000..3ccbecd80 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/disable_load_balancer_access_log.go @@ -0,0 +1,101 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DisableLoadBalancerAccessLog invokes the alb.DisableLoadBalancerAccessLog API synchronously +func (client *Client) DisableLoadBalancerAccessLog(request *DisableLoadBalancerAccessLogRequest) (response *DisableLoadBalancerAccessLogResponse, err error) { + response = CreateDisableLoadBalancerAccessLogResponse() + err = client.DoAction(request, response) + return +} + +// DisableLoadBalancerAccessLogWithChan invokes the alb.DisableLoadBalancerAccessLog API asynchronously +func (client *Client) DisableLoadBalancerAccessLogWithChan(request *DisableLoadBalancerAccessLogRequest) (<-chan *DisableLoadBalancerAccessLogResponse, <-chan error) { + responseChan := make(chan *DisableLoadBalancerAccessLogResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DisableLoadBalancerAccessLog(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DisableLoadBalancerAccessLogWithCallback invokes the alb.DisableLoadBalancerAccessLog API asynchronously +func (client *Client) DisableLoadBalancerAccessLogWithCallback(request *DisableLoadBalancerAccessLogRequest, callback func(response *DisableLoadBalancerAccessLogResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DisableLoadBalancerAccessLogResponse + var err error + defer close(result) + response, err = client.DisableLoadBalancerAccessLog(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DisableLoadBalancerAccessLogRequest is the request struct for api DisableLoadBalancerAccessLog +type DisableLoadBalancerAccessLogRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` +} + +// DisableLoadBalancerAccessLogResponse is the response struct for api DisableLoadBalancerAccessLog +type DisableLoadBalancerAccessLogResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDisableLoadBalancerAccessLogRequest creates a request to invoke DisableLoadBalancerAccessLog API +func CreateDisableLoadBalancerAccessLogRequest() (request *DisableLoadBalancerAccessLogRequest) { + request = &DisableLoadBalancerAccessLogRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DisableLoadBalancerAccessLog", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDisableLoadBalancerAccessLogResponse creates a response to parse from DisableLoadBalancerAccessLog response +func CreateDisableLoadBalancerAccessLogResponse() (response *DisableLoadBalancerAccessLogResponse) { + response = &DisableLoadBalancerAccessLogResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_acls_from_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_acls_from_listener.go new file mode 100644 index 000000000..f11a229df --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_acls_from_listener.go @@ -0,0 +1,103 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DissociateAclsFromListener invokes the alb.DissociateAclsFromListener API synchronously +func (client *Client) DissociateAclsFromListener(request *DissociateAclsFromListenerRequest) (response *DissociateAclsFromListenerResponse, err error) { + response = CreateDissociateAclsFromListenerResponse() + err = client.DoAction(request, response) + return +} + +// DissociateAclsFromListenerWithChan invokes the alb.DissociateAclsFromListener API asynchronously +func (client *Client) DissociateAclsFromListenerWithChan(request *DissociateAclsFromListenerRequest) (<-chan *DissociateAclsFromListenerResponse, <-chan error) { + responseChan := make(chan *DissociateAclsFromListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DissociateAclsFromListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DissociateAclsFromListenerWithCallback invokes the alb.DissociateAclsFromListener API asynchronously +func (client *Client) DissociateAclsFromListenerWithCallback(request *DissociateAclsFromListenerRequest, callback func(response *DissociateAclsFromListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DissociateAclsFromListenerResponse + var err error + defer close(result) + response, err = client.DissociateAclsFromListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DissociateAclsFromListenerRequest is the request struct for api DissociateAclsFromListener +type DissociateAclsFromListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + AclIds *[]string `position:"Query" name:"AclIds" type:"Repeated"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// DissociateAclsFromListenerResponse is the response struct for api DissociateAclsFromListener +type DissociateAclsFromListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDissociateAclsFromListenerRequest creates a request to invoke DissociateAclsFromListener API +func CreateDissociateAclsFromListenerRequest() (request *DissociateAclsFromListenerRequest) { + request = &DissociateAclsFromListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DissociateAclsFromListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDissociateAclsFromListenerResponse creates a response to parse from DissociateAclsFromListener response +func CreateDissociateAclsFromListenerResponse() (response *DissociateAclsFromListenerResponse) { + response = &DissociateAclsFromListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_additional_certificates_from_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_additional_certificates_from_listener.go new file mode 100644 index 000000000..310e86887 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/dissociate_additional_certificates_from_listener.go @@ -0,0 +1,108 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DissociateAdditionalCertificatesFromListener invokes the alb.DissociateAdditionalCertificatesFromListener API synchronously +func (client *Client) DissociateAdditionalCertificatesFromListener(request *DissociateAdditionalCertificatesFromListenerRequest) (response *DissociateAdditionalCertificatesFromListenerResponse, err error) { + response = CreateDissociateAdditionalCertificatesFromListenerResponse() + err = client.DoAction(request, response) + return +} + +// DissociateAdditionalCertificatesFromListenerWithChan invokes the alb.DissociateAdditionalCertificatesFromListener API asynchronously +func (client *Client) DissociateAdditionalCertificatesFromListenerWithChan(request *DissociateAdditionalCertificatesFromListenerRequest) (<-chan *DissociateAdditionalCertificatesFromListenerResponse, <-chan error) { + responseChan := make(chan *DissociateAdditionalCertificatesFromListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DissociateAdditionalCertificatesFromListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DissociateAdditionalCertificatesFromListenerWithCallback invokes the alb.DissociateAdditionalCertificatesFromListener API asynchronously +func (client *Client) DissociateAdditionalCertificatesFromListenerWithCallback(request *DissociateAdditionalCertificatesFromListenerRequest, callback func(response *DissociateAdditionalCertificatesFromListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DissociateAdditionalCertificatesFromListenerResponse + var err error + defer close(result) + response, err = client.DissociateAdditionalCertificatesFromListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DissociateAdditionalCertificatesFromListenerRequest is the request struct for api DissociateAdditionalCertificatesFromListener +type DissociateAdditionalCertificatesFromListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + Certificates *[]DissociateAdditionalCertificatesFromListenerCertificates `position:"Query" name:"Certificates" type:"Repeated"` +} + +// DissociateAdditionalCertificatesFromListenerCertificates is a repeated param struct in DissociateAdditionalCertificatesFromListenerRequest +type DissociateAdditionalCertificatesFromListenerCertificates struct { + CertificateId string `name:"CertificateId"` +} + +// DissociateAdditionalCertificatesFromListenerResponse is the response struct for api DissociateAdditionalCertificatesFromListener +type DissociateAdditionalCertificatesFromListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDissociateAdditionalCertificatesFromListenerRequest creates a request to invoke DissociateAdditionalCertificatesFromListener API +func CreateDissociateAdditionalCertificatesFromListenerRequest() (request *DissociateAdditionalCertificatesFromListenerRequest) { + request = &DissociateAdditionalCertificatesFromListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "DissociateAdditionalCertificatesFromListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateDissociateAdditionalCertificatesFromListenerResponse creates a response to parse from DissociateAdditionalCertificatesFromListener response +func CreateDissociateAdditionalCertificatesFromListenerResponse() (response *DissociateAdditionalCertificatesFromListenerResponse) { + response = &DissociateAdditionalCertificatesFromListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_deletion_protection.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_deletion_protection.go new file mode 100644 index 000000000..3ba9d0068 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_deletion_protection.go @@ -0,0 +1,101 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// EnableDeletionProtection invokes the alb.EnableDeletionProtection API synchronously +func (client *Client) EnableDeletionProtection(request *EnableDeletionProtectionRequest) (response *EnableDeletionProtectionResponse, err error) { + response = CreateEnableDeletionProtectionResponse() + err = client.DoAction(request, response) + return +} + +// EnableDeletionProtectionWithChan invokes the alb.EnableDeletionProtection API asynchronously +func (client *Client) EnableDeletionProtectionWithChan(request *EnableDeletionProtectionRequest) (<-chan *EnableDeletionProtectionResponse, <-chan error) { + responseChan := make(chan *EnableDeletionProtectionResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.EnableDeletionProtection(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// EnableDeletionProtectionWithCallback invokes the alb.EnableDeletionProtection API asynchronously +func (client *Client) EnableDeletionProtectionWithCallback(request *EnableDeletionProtectionRequest, callback func(response *EnableDeletionProtectionResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *EnableDeletionProtectionResponse + var err error + defer close(result) + response, err = client.EnableDeletionProtection(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// EnableDeletionProtectionRequest is the request struct for api EnableDeletionProtection +type EnableDeletionProtectionRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ResourceId string `position:"Query" name:"ResourceId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// EnableDeletionProtectionResponse is the response struct for api EnableDeletionProtection +type EnableDeletionProtectionResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateEnableDeletionProtectionRequest creates a request to invoke EnableDeletionProtection API +func CreateEnableDeletionProtectionRequest() (request *EnableDeletionProtectionRequest) { + request = &EnableDeletionProtectionRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "EnableDeletionProtection", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateEnableDeletionProtectionResponse creates a response to parse from EnableDeletionProtection response +func CreateEnableDeletionProtectionResponse() (response *EnableDeletionProtectionResponse) { + response = &EnableDeletionProtectionResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_load_balancer_access_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_load_balancer_access_log.go new file mode 100644 index 000000000..a7a3040bd --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/enable_load_balancer_access_log.go @@ -0,0 +1,103 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// EnableLoadBalancerAccessLog invokes the alb.EnableLoadBalancerAccessLog API synchronously +func (client *Client) EnableLoadBalancerAccessLog(request *EnableLoadBalancerAccessLogRequest) (response *EnableLoadBalancerAccessLogResponse, err error) { + response = CreateEnableLoadBalancerAccessLogResponse() + err = client.DoAction(request, response) + return +} + +// EnableLoadBalancerAccessLogWithChan invokes the alb.EnableLoadBalancerAccessLog API asynchronously +func (client *Client) EnableLoadBalancerAccessLogWithChan(request *EnableLoadBalancerAccessLogRequest) (<-chan *EnableLoadBalancerAccessLogResponse, <-chan error) { + responseChan := make(chan *EnableLoadBalancerAccessLogResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.EnableLoadBalancerAccessLog(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// EnableLoadBalancerAccessLogWithCallback invokes the alb.EnableLoadBalancerAccessLog API asynchronously +func (client *Client) EnableLoadBalancerAccessLogWithCallback(request *EnableLoadBalancerAccessLogRequest, callback func(response *EnableLoadBalancerAccessLogResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *EnableLoadBalancerAccessLogResponse + var err error + defer close(result) + response, err = client.EnableLoadBalancerAccessLog(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// EnableLoadBalancerAccessLogRequest is the request struct for api EnableLoadBalancerAccessLog +type EnableLoadBalancerAccessLogRequest struct { + *requests.RpcRequest + LogProject string `position:"Query" name:"LogProject"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` + LogStore string `position:"Query" name:"LogStore"` +} + +// EnableLoadBalancerAccessLogResponse is the response struct for api EnableLoadBalancerAccessLog +type EnableLoadBalancerAccessLogResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateEnableLoadBalancerAccessLogRequest creates a request to invoke EnableLoadBalancerAccessLog API +func CreateEnableLoadBalancerAccessLogRequest() (request *EnableLoadBalancerAccessLogRequest) { + request = &EnableLoadBalancerAccessLogRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "EnableLoadBalancerAccessLog", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateEnableLoadBalancerAccessLogResponse creates a response to parse from EnableLoadBalancerAccessLog response +func CreateEnableLoadBalancerAccessLogResponse() (response *EnableLoadBalancerAccessLogResponse) { + response = &EnableLoadBalancerAccessLogResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/endpoint.go new file mode 100644 index 000000000..b992d211b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/endpoint.go @@ -0,0 +1,20 @@ +package alb + +// EndpointMap Endpoint Data +var EndpointMap map[string]string + +// EndpointType regional or central +var EndpointType = "regional" + +// GetEndpointMap Get Endpoint Data Map +func GetEndpointMap() map[string]string { + if EndpointMap == nil { + EndpointMap = map[string]string{} + } + return EndpointMap +} + +// GetEndpointType Get Endpoint Type Value +func GetEndpointType() string { + return EndpointType +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_health_check_template_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_health_check_template_attribute.go new file mode 100644 index 000000000..6bf5ebaac --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_health_check_template_attribute.go @@ -0,0 +1,116 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetHealthCheckTemplateAttribute invokes the alb.GetHealthCheckTemplateAttribute API synchronously +func (client *Client) GetHealthCheckTemplateAttribute(request *GetHealthCheckTemplateAttributeRequest) (response *GetHealthCheckTemplateAttributeResponse, err error) { + response = CreateGetHealthCheckTemplateAttributeResponse() + err = client.DoAction(request, response) + return +} + +// GetHealthCheckTemplateAttributeWithChan invokes the alb.GetHealthCheckTemplateAttribute API asynchronously +func (client *Client) GetHealthCheckTemplateAttributeWithChan(request *GetHealthCheckTemplateAttributeRequest) (<-chan *GetHealthCheckTemplateAttributeResponse, <-chan error) { + responseChan := make(chan *GetHealthCheckTemplateAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetHealthCheckTemplateAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetHealthCheckTemplateAttributeWithCallback invokes the alb.GetHealthCheckTemplateAttribute API asynchronously +func (client *Client) GetHealthCheckTemplateAttributeWithCallback(request *GetHealthCheckTemplateAttributeRequest, callback func(response *GetHealthCheckTemplateAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetHealthCheckTemplateAttributeResponse + var err error + defer close(result) + response, err = client.GetHealthCheckTemplateAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetHealthCheckTemplateAttributeRequest is the request struct for api GetHealthCheckTemplateAttribute +type GetHealthCheckTemplateAttributeRequest struct { + *requests.RpcRequest + HealthCheckTemplateId string `position:"Query" name:"HealthCheckTemplateId"` +} + +// GetHealthCheckTemplateAttributeResponse is the response struct for api GetHealthCheckTemplateAttribute +type GetHealthCheckTemplateAttributeResponse struct { + *responses.BaseResponse + HealthCheckConnectPort int `json:"HealthCheckConnectPort" xml:"HealthCheckConnectPort"` + HealthCheckHost string `json:"HealthCheckHost" xml:"HealthCheckHost"` + HealthCheckHttpVersion string `json:"HealthCheckHttpVersion" xml:"HealthCheckHttpVersion"` + HealthCheckTemplateId string `json:"HealthCheckTemplateId" xml:"HealthCheckTemplateId"` + HealthCheckInterval int `json:"HealthCheckInterval" xml:"HealthCheckInterval"` + HealthCheckMethod string `json:"HealthCheckMethod" xml:"HealthCheckMethod"` + HealthCheckPath string `json:"HealthCheckPath" xml:"HealthCheckPath"` + HealthCheckProtocol string `json:"HealthCheckProtocol" xml:"HealthCheckProtocol"` + HealthCheckTemplateName string `json:"HealthCheckTemplateName" xml:"HealthCheckTemplateName"` + HealthCheckTimeout int `json:"HealthCheckTimeout" xml:"HealthCheckTimeout"` + HealthyThreshold int `json:"HealthyThreshold" xml:"HealthyThreshold"` + RequestId string `json:"RequestId" xml:"RequestId"` + UnhealthyThreshold int `json:"UnhealthyThreshold" xml:"UnhealthyThreshold"` + HealthCheckTcpFastCloseEnabled bool `json:"HealthCheckTcpFastCloseEnabled" xml:"HealthCheckTcpFastCloseEnabled"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + HealthCheckHttpCodes []string `json:"HealthCheckHttpCodes" xml:"HealthCheckHttpCodes"` + HealthCheckCodes []string `json:"HealthCheckCodes" xml:"HealthCheckCodes"` +} + +// CreateGetHealthCheckTemplateAttributeRequest creates a request to invoke GetHealthCheckTemplateAttribute API +func CreateGetHealthCheckTemplateAttributeRequest() (request *GetHealthCheckTemplateAttributeRequest) { + request = &GetHealthCheckTemplateAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "GetHealthCheckTemplateAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateGetHealthCheckTemplateAttributeResponse creates a response to parse from GetHealthCheckTemplateAttribute response +func CreateGetHealthCheckTemplateAttributeResponse() (response *GetHealthCheckTemplateAttributeResponse) { + response = &GetHealthCheckTemplateAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_listener_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_listener_attribute.go new file mode 100644 index 000000000..cc8f64da0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_listener_attribute.go @@ -0,0 +1,120 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetListenerAttribute invokes the alb.GetListenerAttribute API synchronously +func (client *Client) GetListenerAttribute(request *GetListenerAttributeRequest) (response *GetListenerAttributeResponse, err error) { + response = CreateGetListenerAttributeResponse() + err = client.DoAction(request, response) + return +} + +// GetListenerAttributeWithChan invokes the alb.GetListenerAttribute API asynchronously +func (client *Client) GetListenerAttributeWithChan(request *GetListenerAttributeRequest) (<-chan *GetListenerAttributeResponse, <-chan error) { + responseChan := make(chan *GetListenerAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetListenerAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetListenerAttributeWithCallback invokes the alb.GetListenerAttribute API asynchronously +func (client *Client) GetListenerAttributeWithCallback(request *GetListenerAttributeRequest, callback func(response *GetListenerAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetListenerAttributeResponse + var err error + defer close(result) + response, err = client.GetListenerAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetListenerAttributeRequest is the request struct for api GetListenerAttribute +type GetListenerAttributeRequest struct { + *requests.RpcRequest + ListenerId string `position:"Query" name:"ListenerId"` +} + +// GetListenerAttributeResponse is the response struct for api GetListenerAttribute +type GetListenerAttributeResponse struct { + *responses.BaseResponse + CaEnabled bool `json:"CaEnabled" xml:"CaEnabled"` + GzipEnabled bool `json:"GzipEnabled" xml:"GzipEnabled"` + Http2Enabled bool `json:"Http2Enabled" xml:"Http2Enabled"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + IdleTimeout int `json:"IdleTimeout" xml:"IdleTimeout"` + ListenerDescription string `json:"ListenerDescription" xml:"ListenerDescription"` + ListenerId string `json:"ListenerId" xml:"ListenerId"` + ListenerPort int `json:"ListenerPort" xml:"ListenerPort"` + ListenerProtocol string `json:"ListenerProtocol" xml:"ListenerProtocol"` + ListenerStatus string `json:"ListenerStatus" xml:"ListenerStatus"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + RequestId string `json:"RequestId" xml:"RequestId"` + RequestTimeout int `json:"RequestTimeout" xml:"RequestTimeout"` + SecurityPolicyId string `json:"SecurityPolicyId" xml:"SecurityPolicyId"` + AclConfig AclConfig `json:"AclConfig" xml:"AclConfig"` + LogConfig LogConfig `json:"LogConfig" xml:"LogConfig"` + QuicConfig QuicConfig `json:"QuicConfig" xml:"QuicConfig"` + XForwardedForConfig XForwardedForConfig `json:"XForwardedForConfig" xml:"XForwardedForConfig"` + Certificates []Certificate `json:"Certificates" xml:"Certificates"` + CaCertificates []Certificate `json:"CaCertificates" xml:"CaCertificates"` + DefaultActions []DefaultAction `json:"DefaultActions" xml:"DefaultActions"` +} + +// CreateGetListenerAttributeRequest creates a request to invoke GetListenerAttribute API +func CreateGetListenerAttributeRequest() (request *GetListenerAttributeRequest) { + request = &GetListenerAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "GetListenerAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateGetListenerAttributeResponse creates a response to parse from GetListenerAttribute response +func CreateGetListenerAttributeResponse() (response *GetListenerAttributeResponse) { + response = &GetListenerAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_load_balancer_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_load_balancer_attribute.go new file mode 100644 index 000000000..4f35b6892 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/get_load_balancer_attribute.go @@ -0,0 +1,123 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetLoadBalancerAttribute invokes the alb.GetLoadBalancerAttribute API synchronously +func (client *Client) GetLoadBalancerAttribute(request *GetLoadBalancerAttributeRequest) (response *GetLoadBalancerAttributeResponse, err error) { + response = CreateGetLoadBalancerAttributeResponse() + err = client.DoAction(request, response) + return +} + +// GetLoadBalancerAttributeWithChan invokes the alb.GetLoadBalancerAttribute API asynchronously +func (client *Client) GetLoadBalancerAttributeWithChan(request *GetLoadBalancerAttributeRequest) (<-chan *GetLoadBalancerAttributeResponse, <-chan error) { + responseChan := make(chan *GetLoadBalancerAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetLoadBalancerAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetLoadBalancerAttributeWithCallback invokes the alb.GetLoadBalancerAttribute API asynchronously +func (client *Client) GetLoadBalancerAttributeWithCallback(request *GetLoadBalancerAttributeRequest, callback func(response *GetLoadBalancerAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetLoadBalancerAttributeResponse + var err error + defer close(result) + response, err = client.GetLoadBalancerAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetLoadBalancerAttributeRequest is the request struct for api GetLoadBalancerAttribute +type GetLoadBalancerAttributeRequest struct { + *requests.RpcRequest + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` +} + +// GetLoadBalancerAttributeResponse is the response struct for api GetLoadBalancerAttribute +type GetLoadBalancerAttributeResponse struct { + *responses.BaseResponse + AddressAllocatedMode string `json:"AddressAllocatedMode" xml:"AddressAllocatedMode"` + AddressType string `json:"AddressType" xml:"AddressType"` + BandwidthCapacity int `json:"BandwidthCapacity" xml:"BandwidthCapacity"` + BandwidthPackageId string `json:"BandwidthPackageId" xml:"BandwidthPackageId"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + DNSName string `json:"DNSName" xml:"DNSName"` + LoadBalancerBussinessStatus string `json:"LoadBalancerBussinessStatus" xml:"LoadBalancerBussinessStatus"` + LoadBalancerEdition string `json:"LoadBalancerEdition" xml:"LoadBalancerEdition"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + LoadBalancerName string `json:"LoadBalancerName" xml:"LoadBalancerName"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + LoadBalancerStatus string `json:"LoadBalancerStatus" xml:"LoadBalancerStatus"` + RegionId string `json:"RegionId" xml:"RegionId"` + RequestId string `json:"RequestId" xml:"RequestId"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + VpcId string `json:"VpcId" xml:"VpcId"` + FeatureLabels []string `json:"FeatureLabels" xml:"FeatureLabels"` + AccessLogConfig AccessLogConfig `json:"AccessLogConfig" xml:"AccessLogConfig"` + DeletionProtectionConfig DeletionProtectionConfig `json:"DeletionProtectionConfig" xml:"DeletionProtectionConfig"` + LoadBalancerBillingConfig LoadBalancerBillingConfig `json:"LoadBalancerBillingConfig" xml:"LoadBalancerBillingConfig"` + ModificationProtectionConfig ModificationProtectionConfig `json:"ModificationProtectionConfig" xml:"ModificationProtectionConfig"` + LoadBalancerOperationLocks []LoadBalancerOperationLock `json:"LoadBalancerOperationLocks" xml:"LoadBalancerOperationLocks"` + Tags []Tag `json:"Tags" xml:"Tags"` + ZoneMappings []ZoneMapping `json:"ZoneMappings" xml:"ZoneMappings"` +} + +// CreateGetLoadBalancerAttributeRequest creates a request to invoke GetLoadBalancerAttribute API +func CreateGetLoadBalancerAttributeRequest() (request *GetLoadBalancerAttributeRequest) { + request = &GetLoadBalancerAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "GetLoadBalancerAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateGetLoadBalancerAttributeResponse creates a response to parse from GetLoadBalancerAttribute response +func CreateGetLoadBalancerAttributeResponse() (response *GetLoadBalancerAttributeResponse) { + response = &GetLoadBalancerAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_entries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_entries.go new file mode 100644 index 000000000..74228474e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_entries.go @@ -0,0 +1,105 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListAclEntries invokes the alb.ListAclEntries API synchronously +func (client *Client) ListAclEntries(request *ListAclEntriesRequest) (response *ListAclEntriesResponse, err error) { + response = CreateListAclEntriesResponse() + err = client.DoAction(request, response) + return +} + +// ListAclEntriesWithChan invokes the alb.ListAclEntries API asynchronously +func (client *Client) ListAclEntriesWithChan(request *ListAclEntriesRequest) (<-chan *ListAclEntriesResponse, <-chan error) { + responseChan := make(chan *ListAclEntriesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListAclEntries(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListAclEntriesWithCallback invokes the alb.ListAclEntries API asynchronously +func (client *Client) ListAclEntriesWithCallback(request *ListAclEntriesRequest, callback func(response *ListAclEntriesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListAclEntriesResponse + var err error + defer close(result) + response, err = client.ListAclEntries(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListAclEntriesRequest is the request struct for api ListAclEntries +type ListAclEntriesRequest struct { + *requests.RpcRequest + NextToken string `position:"Query" name:"NextToken"` + AclId string `position:"Query" name:"AclId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListAclEntriesResponse is the response struct for api ListAclEntries +type ListAclEntriesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + AclEntries []AclEntry `json:"AclEntries" xml:"AclEntries"` +} + +// CreateListAclEntriesRequest creates a request to invoke ListAclEntries API +func CreateListAclEntriesRequest() (request *ListAclEntriesRequest) { + request = &ListAclEntriesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListAclEntries", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListAclEntriesResponse creates a response to parse from ListAclEntries response +func CreateListAclEntriesResponse() (response *ListAclEntriesResponse) { + response = &ListAclEntriesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_relations.go new file mode 100644 index 000000000..1f573c205 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acl_relations.go @@ -0,0 +1,100 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListAclRelations invokes the alb.ListAclRelations API synchronously +func (client *Client) ListAclRelations(request *ListAclRelationsRequest) (response *ListAclRelationsResponse, err error) { + response = CreateListAclRelationsResponse() + err = client.DoAction(request, response) + return +} + +// ListAclRelationsWithChan invokes the alb.ListAclRelations API asynchronously +func (client *Client) ListAclRelationsWithChan(request *ListAclRelationsRequest) (<-chan *ListAclRelationsResponse, <-chan error) { + responseChan := make(chan *ListAclRelationsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListAclRelations(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListAclRelationsWithCallback invokes the alb.ListAclRelations API asynchronously +func (client *Client) ListAclRelationsWithCallback(request *ListAclRelationsRequest, callback func(response *ListAclRelationsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListAclRelationsResponse + var err error + defer close(result) + response, err = client.ListAclRelations(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListAclRelationsRequest is the request struct for api ListAclRelations +type ListAclRelationsRequest struct { + *requests.RpcRequest + AclIds *[]string `position:"Query" name:"AclIds" type:"Repeated"` +} + +// ListAclRelationsResponse is the response struct for api ListAclRelations +type ListAclRelationsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + AclRelations []AclRelation `json:"AclRelations" xml:"AclRelations"` +} + +// CreateListAclRelationsRequest creates a request to invoke ListAclRelations API +func CreateListAclRelationsRequest() (request *ListAclRelationsRequest) { + request = &ListAclRelationsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListAclRelations", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListAclRelationsResponse creates a response to parse from ListAclRelations response +func CreateListAclRelationsResponse() (response *ListAclRelationsResponse) { + response = &ListAclRelationsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acls.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acls.go new file mode 100644 index 000000000..0c6086171 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_acls.go @@ -0,0 +1,108 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListAcls invokes the alb.ListAcls API synchronously +func (client *Client) ListAcls(request *ListAclsRequest) (response *ListAclsResponse, err error) { + response = CreateListAclsResponse() + err = client.DoAction(request, response) + return +} + +// ListAclsWithChan invokes the alb.ListAcls API asynchronously +func (client *Client) ListAclsWithChan(request *ListAclsRequest) (<-chan *ListAclsResponse, <-chan error) { + responseChan := make(chan *ListAclsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListAcls(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListAclsWithCallback invokes the alb.ListAcls API asynchronously +func (client *Client) ListAclsWithCallback(request *ListAclsRequest, callback func(response *ListAclsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListAclsResponse + var err error + defer close(result) + response, err = client.ListAcls(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListAclsRequest is the request struct for api ListAcls +type ListAclsRequest struct { + *requests.RpcRequest + AclIds *[]string `position:"Query" name:"AclIds" type:"Repeated"` + AddressIPVersion string `position:"Query" name:"AddressIPVersion"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + NextToken string `position:"Query" name:"NextToken"` + AclNames *[]string `position:"Query" name:"AclNames" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListAclsResponse is the response struct for api ListAcls +type ListAclsResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Acls []Acl `json:"Acls" xml:"Acls"` +} + +// CreateListAclsRequest creates a request to invoke ListAcls API +func CreateListAclsRequest() (request *ListAclsRequest) { + request = &ListAclsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListAcls", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListAclsResponse creates a response to parse from ListAcls response +func CreateListAclsResponse() (response *ListAclsResponse) { + response = &ListAclsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_asyn_jobs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_asyn_jobs.go new file mode 100644 index 000000000..4fc839e63 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_asyn_jobs.go @@ -0,0 +1,110 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListAsynJobs invokes the alb.ListAsynJobs API synchronously +func (client *Client) ListAsynJobs(request *ListAsynJobsRequest) (response *ListAsynJobsResponse, err error) { + response = CreateListAsynJobsResponse() + err = client.DoAction(request, response) + return +} + +// ListAsynJobsWithChan invokes the alb.ListAsynJobs API asynchronously +func (client *Client) ListAsynJobsWithChan(request *ListAsynJobsRequest) (<-chan *ListAsynJobsResponse, <-chan error) { + responseChan := make(chan *ListAsynJobsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListAsynJobs(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListAsynJobsWithCallback invokes the alb.ListAsynJobs API asynchronously +func (client *Client) ListAsynJobsWithCallback(request *ListAsynJobsRequest, callback func(response *ListAsynJobsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListAsynJobsResponse + var err error + defer close(result) + response, err = client.ListAsynJobs(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListAsynJobsRequest is the request struct for api ListAsynJobs +type ListAsynJobsRequest struct { + *requests.RpcRequest + NextToken string `position:"Query" name:"NextToken"` + EndTime requests.Integer `position:"Query" name:"EndTime"` + BeginTime requests.Integer `position:"Query" name:"BeginTime"` + ResourceType string `position:"Query" name:"ResourceType"` + ApiName string `position:"Query" name:"ApiName"` + JobIds *[]string `position:"Query" name:"JobIds" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + ResourceIds *[]string `position:"Query" name:"ResourceIds" type:"Repeated"` +} + +// ListAsynJobsResponse is the response struct for api ListAsynJobs +type ListAsynJobsResponse struct { + *responses.BaseResponse + MaxResults int64 `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int64 `json:"TotalCount" xml:"TotalCount"` + Jobs []Job `json:"Jobs" xml:"Jobs"` +} + +// CreateListAsynJobsRequest creates a request to invoke ListAsynJobs API +func CreateListAsynJobsRequest() (request *ListAsynJobsRequest) { + request = &ListAsynJobsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListAsynJobs", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListAsynJobsResponse creates a response to parse from ListAsynJobs response +func CreateListAsynJobsResponse() (response *ListAsynJobsResponse) { + response = &ListAsynJobsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_health_check_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_health_check_templates.go new file mode 100644 index 000000000..e18b37208 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_health_check_templates.go @@ -0,0 +1,106 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListHealthCheckTemplates invokes the alb.ListHealthCheckTemplates API synchronously +func (client *Client) ListHealthCheckTemplates(request *ListHealthCheckTemplatesRequest) (response *ListHealthCheckTemplatesResponse, err error) { + response = CreateListHealthCheckTemplatesResponse() + err = client.DoAction(request, response) + return +} + +// ListHealthCheckTemplatesWithChan invokes the alb.ListHealthCheckTemplates API asynchronously +func (client *Client) ListHealthCheckTemplatesWithChan(request *ListHealthCheckTemplatesRequest) (<-chan *ListHealthCheckTemplatesResponse, <-chan error) { + responseChan := make(chan *ListHealthCheckTemplatesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListHealthCheckTemplates(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListHealthCheckTemplatesWithCallback invokes the alb.ListHealthCheckTemplates API asynchronously +func (client *Client) ListHealthCheckTemplatesWithCallback(request *ListHealthCheckTemplatesRequest, callback func(response *ListHealthCheckTemplatesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListHealthCheckTemplatesResponse + var err error + defer close(result) + response, err = client.ListHealthCheckTemplates(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListHealthCheckTemplatesRequest is the request struct for api ListHealthCheckTemplates +type ListHealthCheckTemplatesRequest struct { + *requests.RpcRequest + NextToken string `position:"Query" name:"NextToken"` + HealthCheckTemplateNames *[]string `position:"Query" name:"HealthCheckTemplateNames" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + HealthCheckTemplateIds *[]string `position:"Query" name:"HealthCheckTemplateIds" type:"Repeated"` +} + +// ListHealthCheckTemplatesResponse is the response struct for api ListHealthCheckTemplates +type ListHealthCheckTemplatesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + HealthCheckTemplates []HealthCheckTemplate `json:"HealthCheckTemplates" xml:"HealthCheckTemplates"` +} + +// CreateListHealthCheckTemplatesRequest creates a request to invoke ListHealthCheckTemplates API +func CreateListHealthCheckTemplatesRequest() (request *ListHealthCheckTemplatesRequest) { + request = &ListHealthCheckTemplatesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListHealthCheckTemplates", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListHealthCheckTemplatesResponse creates a response to parse from ListHealthCheckTemplates response +func CreateListHealthCheckTemplatesResponse() (response *ListHealthCheckTemplatesResponse) { + response = &ListHealthCheckTemplatesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listener_certificates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listener_certificates.go new file mode 100644 index 000000000..82fef61e1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listener_certificates.go @@ -0,0 +1,106 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListListenerCertificates invokes the alb.ListListenerCertificates API synchronously +func (client *Client) ListListenerCertificates(request *ListListenerCertificatesRequest) (response *ListListenerCertificatesResponse, err error) { + response = CreateListListenerCertificatesResponse() + err = client.DoAction(request, response) + return +} + +// ListListenerCertificatesWithChan invokes the alb.ListListenerCertificates API asynchronously +func (client *Client) ListListenerCertificatesWithChan(request *ListListenerCertificatesRequest) (<-chan *ListListenerCertificatesResponse, <-chan error) { + responseChan := make(chan *ListListenerCertificatesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListListenerCertificates(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListListenerCertificatesWithCallback invokes the alb.ListListenerCertificates API asynchronously +func (client *Client) ListListenerCertificatesWithCallback(request *ListListenerCertificatesRequest, callback func(response *ListListenerCertificatesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListListenerCertificatesResponse + var err error + defer close(result) + response, err = client.ListListenerCertificates(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListListenerCertificatesRequest is the request struct for api ListListenerCertificates +type ListListenerCertificatesRequest struct { + *requests.RpcRequest + CertificateType string `position:"Query" name:"CertificateType"` + ListenerId string `position:"Query" name:"ListenerId"` + NextToken string `position:"Query" name:"NextToken"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListListenerCertificatesResponse is the response struct for api ListListenerCertificates +type ListListenerCertificatesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Certificates []CertificateModel `json:"Certificates" xml:"Certificates"` +} + +// CreateListListenerCertificatesRequest creates a request to invoke ListListenerCertificates API +func CreateListListenerCertificatesRequest() (request *ListListenerCertificatesRequest) { + request = &ListListenerCertificatesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListListenerCertificates", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListListenerCertificatesResponse creates a response to parse from ListListenerCertificates response +func CreateListListenerCertificatesResponse() (response *ListListenerCertificatesResponse) { + response = &ListListenerCertificatesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listeners.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listeners.go new file mode 100644 index 000000000..c9d0cb451 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_listeners.go @@ -0,0 +1,108 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListListeners invokes the alb.ListListeners API synchronously +func (client *Client) ListListeners(request *ListListenersRequest) (response *ListListenersResponse, err error) { + response = CreateListListenersResponse() + err = client.DoAction(request, response) + return +} + +// ListListenersWithChan invokes the alb.ListListeners API asynchronously +func (client *Client) ListListenersWithChan(request *ListListenersRequest) (<-chan *ListListenersResponse, <-chan error) { + responseChan := make(chan *ListListenersResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListListeners(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListListenersWithCallback invokes the alb.ListListeners API asynchronously +func (client *Client) ListListenersWithCallback(request *ListListenersRequest, callback func(response *ListListenersResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListListenersResponse + var err error + defer close(result) + response, err = client.ListListeners(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListListenersRequest is the request struct for api ListListeners +type ListListenersRequest struct { + *requests.RpcRequest + LoadBalancerIds *[]string `position:"Query" name:"LoadBalancerIds" type:"Repeated"` + NextToken string `position:"Query" name:"NextToken"` + AccessLogRecordCustomizedHeadersEnabled requests.Boolean `position:"Query" name:"AccessLogRecordCustomizedHeadersEnabled"` + ListenerProtocol string `position:"Query" name:"ListenerProtocol"` + ListenerIds *[]string `position:"Query" name:"ListenerIds" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListListenersResponse is the response struct for api ListListeners +type ListListenersResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Listeners []Listener `json:"Listeners" xml:"Listeners"` +} + +// CreateListListenersRequest creates a request to invoke ListListeners API +func CreateListListenersRequest() (request *ListListenersRequest) { + request = &ListListenersRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListListeners", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListListenersResponse creates a response to parse from ListListeners response +func CreateListListenersResponse() (response *ListListenersResponse) { + response = &ListListenersResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_load_balancers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_load_balancers.go new file mode 100644 index 000000000..f09b04491 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_load_balancers.go @@ -0,0 +1,122 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListLoadBalancers invokes the alb.ListLoadBalancers API synchronously +func (client *Client) ListLoadBalancers(request *ListLoadBalancersRequest) (response *ListLoadBalancersResponse, err error) { + response = CreateListLoadBalancersResponse() + err = client.DoAction(request, response) + return +} + +// ListLoadBalancersWithChan invokes the alb.ListLoadBalancers API asynchronously +func (client *Client) ListLoadBalancersWithChan(request *ListLoadBalancersRequest) (<-chan *ListLoadBalancersResponse, <-chan error) { + responseChan := make(chan *ListLoadBalancersResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListLoadBalancers(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListLoadBalancersWithCallback invokes the alb.ListLoadBalancers API asynchronously +func (client *Client) ListLoadBalancersWithCallback(request *ListLoadBalancersRequest, callback func(response *ListLoadBalancersResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListLoadBalancersResponse + var err error + defer close(result) + response, err = client.ListLoadBalancers(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListLoadBalancersRequest is the request struct for api ListLoadBalancers +type ListLoadBalancersRequest struct { + *requests.RpcRequest + LoadBalancerNames *[]string `position:"Query" name:"LoadBalancerNames" type:"Repeated"` + LoadBalancerIds *[]string `position:"Query" name:"LoadBalancerIds" type:"Repeated"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + NextToken string `position:"Query" name:"NextToken"` + LoadBalancerBussinessStatus string `position:"Query" name:"LoadBalancerBussinessStatus"` + AddressType string `position:"Query" name:"AddressType"` + VpcIds *[]string `position:"Query" name:"VpcIds" type:"Repeated"` + Tag *[]ListLoadBalancersTag `position:"Query" name:"Tag" type:"Repeated"` + Address string `position:"Query" name:"Address"` + LoadBalancerStatus string `position:"Query" name:"LoadBalancerStatus"` + InternetChargeType string `position:"Query" name:"InternetChargeType"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + ZoneId string `position:"Query" name:"ZoneId"` + PayType string `position:"Query" name:"PayType"` +} + +// ListLoadBalancersTag is a repeated param struct in ListLoadBalancersRequest +type ListLoadBalancersTag struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// ListLoadBalancersResponse is the response struct for api ListLoadBalancers +type ListLoadBalancersResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + LoadBalancers []LoadBalancer `json:"LoadBalancers" xml:"LoadBalancers"` +} + +// CreateListLoadBalancersRequest creates a request to invoke ListLoadBalancers API +func CreateListLoadBalancersRequest() (request *ListLoadBalancersRequest) { + request = &ListLoadBalancersRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListLoadBalancers", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListLoadBalancersResponse creates a response to parse from ListLoadBalancers response +func CreateListLoadBalancersResponse() (response *ListLoadBalancersResponse) { + response = &ListLoadBalancersResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_rules.go new file mode 100644 index 000000000..25ed2684f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_rules.go @@ -0,0 +1,109 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListRules invokes the alb.ListRules API synchronously +func (client *Client) ListRules(request *ListRulesRequest) (response *ListRulesResponse, err error) { + response = CreateListRulesResponse() + err = client.DoAction(request, response) + return +} + +// ListRulesWithChan invokes the alb.ListRules API asynchronously +func (client *Client) ListRulesWithChan(request *ListRulesRequest) (<-chan *ListRulesResponse, <-chan error) { + responseChan := make(chan *ListRulesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListRules(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListRulesWithCallback invokes the alb.ListRules API asynchronously +func (client *Client) ListRulesWithCallback(request *ListRulesRequest, callback func(response *ListRulesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListRulesResponse + var err error + defer close(result) + response, err = client.ListRules(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListRulesRequest is the request struct for api ListRules +type ListRulesRequest struct { + *requests.RpcRequest + LoadBalancerIds *[]string `position:"Query" name:"LoadBalancerIds" type:"Repeated"` + ListenerId string `position:"Query" name:"ListenerId"` + NextToken string `position:"Query" name:"NextToken"` + Direction string `position:"Query" name:"Direction"` + RuleIds *[]string `position:"Query" name:"RuleIds" type:"Repeated"` + ListenerIds *[]string `position:"Query" name:"ListenerIds" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListRulesResponse is the response struct for api ListRules +type ListRulesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Rules []Rule `json:"Rules" xml:"Rules"` +} + +// CreateListRulesRequest creates a request to invoke ListRules API +func CreateListRulesRequest() (request *ListRulesRequest) { + request = &ListRulesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListRules", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListRulesResponse creates a response to parse from ListRules response +func CreateListRulesResponse() (response *ListRulesResponse) { + response = &ListRulesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policies.go new file mode 100644 index 000000000..7b4b749d3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policies.go @@ -0,0 +1,107 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListSecurityPolicies invokes the alb.ListSecurityPolicies API synchronously +func (client *Client) ListSecurityPolicies(request *ListSecurityPoliciesRequest) (response *ListSecurityPoliciesResponse, err error) { + response = CreateListSecurityPoliciesResponse() + err = client.DoAction(request, response) + return +} + +// ListSecurityPoliciesWithChan invokes the alb.ListSecurityPolicies API asynchronously +func (client *Client) ListSecurityPoliciesWithChan(request *ListSecurityPoliciesRequest) (<-chan *ListSecurityPoliciesResponse, <-chan error) { + responseChan := make(chan *ListSecurityPoliciesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListSecurityPolicies(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListSecurityPoliciesWithCallback invokes the alb.ListSecurityPolicies API asynchronously +func (client *Client) ListSecurityPoliciesWithCallback(request *ListSecurityPoliciesRequest, callback func(response *ListSecurityPoliciesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListSecurityPoliciesResponse + var err error + defer close(result) + response, err = client.ListSecurityPolicies(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListSecurityPoliciesRequest is the request struct for api ListSecurityPolicies +type ListSecurityPoliciesRequest struct { + *requests.RpcRequest + SecurityPolicyNames *[]string `position:"Query" name:"SecurityPolicyNames" type:"Repeated"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + NextToken string `position:"Query" name:"NextToken"` + SecurityPolicyIds *[]string `position:"Query" name:"SecurityPolicyIds" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListSecurityPoliciesResponse is the response struct for api ListSecurityPolicies +type ListSecurityPoliciesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + SecurityPolicies []SecurityPolicy `json:"SecurityPolicies" xml:"SecurityPolicies"` +} + +// CreateListSecurityPoliciesRequest creates a request to invoke ListSecurityPolicies API +func CreateListSecurityPoliciesRequest() (request *ListSecurityPoliciesRequest) { + request = &ListSecurityPoliciesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListSecurityPolicies", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListSecurityPoliciesResponse creates a response to parse from ListSecurityPolicies response +func CreateListSecurityPoliciesResponse() (response *ListSecurityPoliciesResponse) { + response = &ListSecurityPoliciesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policy_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policy_relations.go new file mode 100644 index 000000000..427917670 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_security_policy_relations.go @@ -0,0 +1,100 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListSecurityPolicyRelations invokes the alb.ListSecurityPolicyRelations API synchronously +func (client *Client) ListSecurityPolicyRelations(request *ListSecurityPolicyRelationsRequest) (response *ListSecurityPolicyRelationsResponse, err error) { + response = CreateListSecurityPolicyRelationsResponse() + err = client.DoAction(request, response) + return +} + +// ListSecurityPolicyRelationsWithChan invokes the alb.ListSecurityPolicyRelations API asynchronously +func (client *Client) ListSecurityPolicyRelationsWithChan(request *ListSecurityPolicyRelationsRequest) (<-chan *ListSecurityPolicyRelationsResponse, <-chan error) { + responseChan := make(chan *ListSecurityPolicyRelationsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListSecurityPolicyRelations(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListSecurityPolicyRelationsWithCallback invokes the alb.ListSecurityPolicyRelations API asynchronously +func (client *Client) ListSecurityPolicyRelationsWithCallback(request *ListSecurityPolicyRelationsRequest, callback func(response *ListSecurityPolicyRelationsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListSecurityPolicyRelationsResponse + var err error + defer close(result) + response, err = client.ListSecurityPolicyRelations(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListSecurityPolicyRelationsRequest is the request struct for api ListSecurityPolicyRelations +type ListSecurityPolicyRelationsRequest struct { + *requests.RpcRequest + SecurityPolicyIds *[]string `position:"Query" name:"SecurityPolicyIds" type:"Repeated"` +} + +// ListSecurityPolicyRelationsResponse is the response struct for api ListSecurityPolicyRelations +type ListSecurityPolicyRelationsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + SecrityPolicyRelations []SecrityPolicyRelation `json:"SecrityPolicyRelations" xml:"SecrityPolicyRelations"` +} + +// CreateListSecurityPolicyRelationsRequest creates a request to invoke ListSecurityPolicyRelations API +func CreateListSecurityPolicyRelationsRequest() (request *ListSecurityPolicyRelationsRequest) { + request = &ListSecurityPolicyRelationsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListSecurityPolicyRelations", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListSecurityPolicyRelationsResponse creates a response to parse from ListSecurityPolicyRelations response +func CreateListSecurityPolicyRelationsResponse() (response *ListSecurityPolicyRelationsResponse) { + response = &ListSecurityPolicyRelationsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_group_servers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_group_servers.go new file mode 100644 index 000000000..8326ff284 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_group_servers.go @@ -0,0 +1,115 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListServerGroupServers invokes the alb.ListServerGroupServers API synchronously +func (client *Client) ListServerGroupServers(request *ListServerGroupServersRequest) (response *ListServerGroupServersResponse, err error) { + response = CreateListServerGroupServersResponse() + err = client.DoAction(request, response) + return +} + +// ListServerGroupServersWithChan invokes the alb.ListServerGroupServers API asynchronously +func (client *Client) ListServerGroupServersWithChan(request *ListServerGroupServersRequest) (<-chan *ListServerGroupServersResponse, <-chan error) { + responseChan := make(chan *ListServerGroupServersResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListServerGroupServers(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListServerGroupServersWithCallback invokes the alb.ListServerGroupServers API asynchronously +func (client *Client) ListServerGroupServersWithCallback(request *ListServerGroupServersRequest, callback func(response *ListServerGroupServersResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListServerGroupServersResponse + var err error + defer close(result) + response, err = client.ListServerGroupServers(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListServerGroupServersRequest is the request struct for api ListServerGroupServers +type ListServerGroupServersRequest struct { + *requests.RpcRequest + ServerGroupId string `position:"Query" name:"ServerGroupId"` + NextToken string `position:"Query" name:"NextToken"` + ServerIp string `position:"Query" name:"ServerIp"` + Tag *[]ListServerGroupServersTag `position:"Query" name:"Tag" type:"Repeated"` + ServerId string `position:"Query" name:"ServerId"` + ServerIds *[]string `position:"Query" name:"ServerIds" type:"Repeated"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListServerGroupServersTag is a repeated param struct in ListServerGroupServersRequest +type ListServerGroupServersTag struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// ListServerGroupServersResponse is the response struct for api ListServerGroupServers +type ListServerGroupServersResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + Servers []BackendServer `json:"Servers" xml:"Servers"` +} + +// CreateListServerGroupServersRequest creates a request to invoke ListServerGroupServers API +func CreateListServerGroupServersRequest() (request *ListServerGroupServersRequest) { + request = &ListServerGroupServersRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListServerGroupServers", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListServerGroupServersResponse creates a response to parse from ListServerGroupServers response +func CreateListServerGroupServersResponse() (response *ListServerGroupServersResponse) { + response = &ListServerGroupServersResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_groups.go new file mode 100644 index 000000000..7a2712458 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_server_groups.go @@ -0,0 +1,117 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListServerGroups invokes the alb.ListServerGroups API synchronously +func (client *Client) ListServerGroups(request *ListServerGroupsRequest) (response *ListServerGroupsResponse, err error) { + response = CreateListServerGroupsResponse() + err = client.DoAction(request, response) + return +} + +// ListServerGroupsWithChan invokes the alb.ListServerGroups API asynchronously +func (client *Client) ListServerGroupsWithChan(request *ListServerGroupsRequest) (<-chan *ListServerGroupsResponse, <-chan error) { + responseChan := make(chan *ListServerGroupsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListServerGroups(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListServerGroupsWithCallback invokes the alb.ListServerGroups API asynchronously +func (client *Client) ListServerGroupsWithCallback(request *ListServerGroupsRequest, callback func(response *ListServerGroupsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListServerGroupsResponse + var err error + defer close(result) + response, err = client.ListServerGroups(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListServerGroupsRequest is the request struct for api ListServerGroups +type ListServerGroupsRequest struct { + *requests.RpcRequest + ServerGroupNames *[]string `position:"Query" name:"ServerGroupNames" type:"Repeated"` + ResourceGroupId string `position:"Query" name:"ResourceGroupId"` + NextToken string `position:"Query" name:"NextToken"` + Tag *[]ListServerGroupsTag `position:"Query" name:"Tag" type:"Repeated"` + ShowRelationEnabled requests.Boolean `position:"Query" name:"ShowRelationEnabled"` + ServerGroupIds *[]string `position:"Query" name:"ServerGroupIds" type:"Repeated"` + ServerGroupType string `position:"Query" name:"ServerGroupType"` + VpcId string `position:"Query" name:"VpcId"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListServerGroupsTag is a repeated param struct in ListServerGroupsRequest +type ListServerGroupsTag struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// ListServerGroupsResponse is the response struct for api ListServerGroups +type ListServerGroupsResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + ServerGroups []ServerGroup `json:"ServerGroups" xml:"ServerGroups"` +} + +// CreateListServerGroupsRequest creates a request to invoke ListServerGroups API +func CreateListServerGroupsRequest() (request *ListServerGroupsRequest) { + request = &ListServerGroupsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListServerGroups", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListServerGroupsResponse creates a response to parse from ListServerGroups response +func CreateListServerGroupsResponse() (response *ListServerGroupsResponse) { + response = &ListServerGroupsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_system_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_system_security_policies.go new file mode 100644 index 000000000..66f6d2279 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_system_security_policies.go @@ -0,0 +1,99 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListSystemSecurityPolicies invokes the alb.ListSystemSecurityPolicies API synchronously +func (client *Client) ListSystemSecurityPolicies(request *ListSystemSecurityPoliciesRequest) (response *ListSystemSecurityPoliciesResponse, err error) { + response = CreateListSystemSecurityPoliciesResponse() + err = client.DoAction(request, response) + return +} + +// ListSystemSecurityPoliciesWithChan invokes the alb.ListSystemSecurityPolicies API asynchronously +func (client *Client) ListSystemSecurityPoliciesWithChan(request *ListSystemSecurityPoliciesRequest) (<-chan *ListSystemSecurityPoliciesResponse, <-chan error) { + responseChan := make(chan *ListSystemSecurityPoliciesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListSystemSecurityPolicies(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListSystemSecurityPoliciesWithCallback invokes the alb.ListSystemSecurityPolicies API asynchronously +func (client *Client) ListSystemSecurityPoliciesWithCallback(request *ListSystemSecurityPoliciesRequest, callback func(response *ListSystemSecurityPoliciesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListSystemSecurityPoliciesResponse + var err error + defer close(result) + response, err = client.ListSystemSecurityPolicies(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListSystemSecurityPoliciesRequest is the request struct for api ListSystemSecurityPolicies +type ListSystemSecurityPoliciesRequest struct { + *requests.RpcRequest +} + +// ListSystemSecurityPoliciesResponse is the response struct for api ListSystemSecurityPolicies +type ListSystemSecurityPoliciesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + SecurityPolicies []SecurityPolicy `json:"SecurityPolicies" xml:"SecurityPolicies"` +} + +// CreateListSystemSecurityPoliciesRequest creates a request to invoke ListSystemSecurityPolicies API +func CreateListSystemSecurityPoliciesRequest() (request *ListSystemSecurityPoliciesRequest) { + request = &ListSystemSecurityPoliciesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListSystemSecurityPolicies", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListSystemSecurityPoliciesResponse creates a response to parse from ListSystemSecurityPolicies response +func CreateListSystemSecurityPoliciesResponse() (response *ListSystemSecurityPoliciesResponse) { + response = &ListSystemSecurityPoliciesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_keys.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_keys.go new file mode 100644 index 000000000..3b0c5c369 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_keys.go @@ -0,0 +1,107 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTagKeys invokes the alb.ListTagKeys API synchronously +func (client *Client) ListTagKeys(request *ListTagKeysRequest) (response *ListTagKeysResponse, err error) { + response = CreateListTagKeysResponse() + err = client.DoAction(request, response) + return +} + +// ListTagKeysWithChan invokes the alb.ListTagKeys API asynchronously +func (client *Client) ListTagKeysWithChan(request *ListTagKeysRequest) (<-chan *ListTagKeysResponse, <-chan error) { + responseChan := make(chan *ListTagKeysResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTagKeys(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTagKeysWithCallback invokes the alb.ListTagKeys API asynchronously +func (client *Client) ListTagKeysWithCallback(request *ListTagKeysRequest, callback func(response *ListTagKeysResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTagKeysResponse + var err error + defer close(result) + response, err = client.ListTagKeys(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTagKeysRequest is the request struct for api ListTagKeys +type ListTagKeysRequest struct { + *requests.RpcRequest + NextToken string `position:"Query" name:"NextToken"` + Keyword string `position:"Query" name:"Keyword"` + ResourceType string `position:"Query" name:"ResourceType"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + Category string `position:"Query" name:"Category"` +} + +// ListTagKeysResponse is the response struct for api ListTagKeys +type ListTagKeysResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + TagKeys []TagKey `json:"TagKeys" xml:"TagKeys"` +} + +// CreateListTagKeysRequest creates a request to invoke ListTagKeys API +func CreateListTagKeysRequest() (request *ListTagKeysRequest) { + request = &ListTagKeysRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListTagKeys", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTagKeysResponse creates a response to parse from ListTagKeys response +func CreateListTagKeysResponse() (response *ListTagKeysResponse) { + response = &ListTagKeysResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_resources.go new file mode 100644 index 000000000..ca06ac81d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_resources.go @@ -0,0 +1,113 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTagResources invokes the alb.ListTagResources API synchronously +func (client *Client) ListTagResources(request *ListTagResourcesRequest) (response *ListTagResourcesResponse, err error) { + response = CreateListTagResourcesResponse() + err = client.DoAction(request, response) + return +} + +// ListTagResourcesWithChan invokes the alb.ListTagResources API asynchronously +func (client *Client) ListTagResourcesWithChan(request *ListTagResourcesRequest) (<-chan *ListTagResourcesResponse, <-chan error) { + responseChan := make(chan *ListTagResourcesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTagResources(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTagResourcesWithCallback invokes the alb.ListTagResources API asynchronously +func (client *Client) ListTagResourcesWithCallback(request *ListTagResourcesRequest, callback func(response *ListTagResourcesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTagResourcesResponse + var err error + defer close(result) + response, err = client.ListTagResources(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTagResourcesRequest is the request struct for api ListTagResources +type ListTagResourcesRequest struct { + *requests.RpcRequest + NextToken string `position:"Query" name:"NextToken"` + Tag *[]ListTagResourcesTag `position:"Query" name:"Tag" type:"Repeated"` + ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` + ResourceType string `position:"Query" name:"ResourceType"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` +} + +// ListTagResourcesTag is a repeated param struct in ListTagResourcesRequest +type ListTagResourcesTag struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// ListTagResourcesResponse is the response struct for api ListTagResources +type ListTagResourcesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + TagResources []TagResource `json:"TagResources" xml:"TagResources"` +} + +// CreateListTagResourcesRequest creates a request to invoke ListTagResources API +func CreateListTagResourcesRequest() (request *ListTagResourcesRequest) { + request = &ListTagResourcesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListTagResources", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTagResourcesResponse creates a response to parse from ListTagResources response +func CreateListTagResourcesResponse() (response *ListTagResourcesResponse) { + response = &ListTagResourcesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_values.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_values.go new file mode 100644 index 000000000..0d8c8030c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/list_tag_values.go @@ -0,0 +1,107 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ListTagValues invokes the alb.ListTagValues API synchronously +func (client *Client) ListTagValues(request *ListTagValuesRequest) (response *ListTagValuesResponse, err error) { + response = CreateListTagValuesResponse() + err = client.DoAction(request, response) + return +} + +// ListTagValuesWithChan invokes the alb.ListTagValues API asynchronously +func (client *Client) ListTagValuesWithChan(request *ListTagValuesRequest) (<-chan *ListTagValuesResponse, <-chan error) { + responseChan := make(chan *ListTagValuesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ListTagValues(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ListTagValuesWithCallback invokes the alb.ListTagValues API asynchronously +func (client *Client) ListTagValuesWithCallback(request *ListTagValuesRequest, callback func(response *ListTagValuesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ListTagValuesResponse + var err error + defer close(result) + response, err = client.ListTagValues(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ListTagValuesRequest is the request struct for api ListTagValues +type ListTagValuesRequest struct { + *requests.RpcRequest + NextToken string `position:"Query" name:"NextToken"` + ResourceId string `position:"Query" name:"ResourceId"` + ResourceType string `position:"Query" name:"ResourceType"` + MaxResults requests.Integer `position:"Query" name:"MaxResults"` + TagKey string `position:"Query" name:"TagKey"` +} + +// ListTagValuesResponse is the response struct for api ListTagValues +type ListTagValuesResponse struct { + *responses.BaseResponse + MaxResults int `json:"MaxResults" xml:"MaxResults"` + NextToken string `json:"NextToken" xml:"NextToken"` + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + TagValues []string `json:"TagValues" xml:"TagValues"` +} + +// CreateListTagValuesRequest creates a request to invoke ListTagValues API +func CreateListTagValuesRequest() (request *ListTagValuesRequest) { + request = &ListTagValuesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ListTagValues", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateListTagValuesResponse creates a response to parse from ListTagValues response +func CreateListTagValuesResponse() (response *ListTagValuesResponse) { + response = &ListTagValuesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/move_resource_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/move_resource_group.go new file mode 100644 index 000000000..05f76975f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/move_resource_group.go @@ -0,0 +1,101 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// MoveResourceGroup invokes the alb.MoveResourceGroup API synchronously +func (client *Client) MoveResourceGroup(request *MoveResourceGroupRequest) (response *MoveResourceGroupResponse, err error) { + response = CreateMoveResourceGroupResponse() + err = client.DoAction(request, response) + return +} + +// MoveResourceGroupWithChan invokes the alb.MoveResourceGroup API asynchronously +func (client *Client) MoveResourceGroupWithChan(request *MoveResourceGroupRequest) (<-chan *MoveResourceGroupResponse, <-chan error) { + responseChan := make(chan *MoveResourceGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.MoveResourceGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// MoveResourceGroupWithCallback invokes the alb.MoveResourceGroup API asynchronously +func (client *Client) MoveResourceGroupWithCallback(request *MoveResourceGroupRequest, callback func(response *MoveResourceGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *MoveResourceGroupResponse + var err error + defer close(result) + response, err = client.MoveResourceGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// MoveResourceGroupRequest is the request struct for api MoveResourceGroup +type MoveResourceGroupRequest struct { + *requests.RpcRequest + ResourceId string `position:"Query" name:"ResourceId"` + ResourceType string `position:"Query" name:"ResourceType"` + NewResourceGroupId string `position:"Query" name:"NewResourceGroupId"` +} + +// MoveResourceGroupResponse is the response struct for api MoveResourceGroup +type MoveResourceGroupResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateMoveResourceGroupRequest creates a request to invoke MoveResourceGroup API +func CreateMoveResourceGroupRequest() (request *MoveResourceGroupRequest) { + request = &MoveResourceGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "MoveResourceGroup", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateMoveResourceGroupResponse creates a response to parse from MoveResourceGroup response +func CreateMoveResourceGroupResponse() (response *MoveResourceGroupResponse) { + response = &MoveResourceGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_entries_from_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_entries_from_acl.go new file mode 100644 index 000000000..a699fd1e2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_entries_from_acl.go @@ -0,0 +1,103 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// RemoveEntriesFromAcl invokes the alb.RemoveEntriesFromAcl API synchronously +func (client *Client) RemoveEntriesFromAcl(request *RemoveEntriesFromAclRequest) (response *RemoveEntriesFromAclResponse, err error) { + response = CreateRemoveEntriesFromAclResponse() + err = client.DoAction(request, response) + return +} + +// RemoveEntriesFromAclWithChan invokes the alb.RemoveEntriesFromAcl API asynchronously +func (client *Client) RemoveEntriesFromAclWithChan(request *RemoveEntriesFromAclRequest) (<-chan *RemoveEntriesFromAclResponse, <-chan error) { + responseChan := make(chan *RemoveEntriesFromAclResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.RemoveEntriesFromAcl(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// RemoveEntriesFromAclWithCallback invokes the alb.RemoveEntriesFromAcl API asynchronously +func (client *Client) RemoveEntriesFromAclWithCallback(request *RemoveEntriesFromAclRequest, callback func(response *RemoveEntriesFromAclResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *RemoveEntriesFromAclResponse + var err error + defer close(result) + response, err = client.RemoveEntriesFromAcl(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// RemoveEntriesFromAclRequest is the request struct for api RemoveEntriesFromAcl +type RemoveEntriesFromAclRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + AclId string `position:"Query" name:"AclId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + Entries *[]string `position:"Query" name:"Entries" type:"Repeated"` +} + +// RemoveEntriesFromAclResponse is the response struct for api RemoveEntriesFromAcl +type RemoveEntriesFromAclResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateRemoveEntriesFromAclRequest creates a request to invoke RemoveEntriesFromAcl API +func CreateRemoveEntriesFromAclRequest() (request *RemoveEntriesFromAclRequest) { + request = &RemoveEntriesFromAclRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "RemoveEntriesFromAcl", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateRemoveEntriesFromAclResponse creates a response to parse from RemoveEntriesFromAcl response +func CreateRemoveEntriesFromAclResponse() (response *RemoveEntriesFromAclResponse) { + response = &RemoveEntriesFromAclResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_servers_from_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_servers_from_server_group.go new file mode 100644 index 000000000..75e11f10b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/remove_servers_from_server_group.go @@ -0,0 +1,111 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// RemoveServersFromServerGroup invokes the alb.RemoveServersFromServerGroup API synchronously +func (client *Client) RemoveServersFromServerGroup(request *RemoveServersFromServerGroupRequest) (response *RemoveServersFromServerGroupResponse, err error) { + response = CreateRemoveServersFromServerGroupResponse() + err = client.DoAction(request, response) + return +} + +// RemoveServersFromServerGroupWithChan invokes the alb.RemoveServersFromServerGroup API asynchronously +func (client *Client) RemoveServersFromServerGroupWithChan(request *RemoveServersFromServerGroupRequest) (<-chan *RemoveServersFromServerGroupResponse, <-chan error) { + responseChan := make(chan *RemoveServersFromServerGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.RemoveServersFromServerGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// RemoveServersFromServerGroupWithCallback invokes the alb.RemoveServersFromServerGroup API asynchronously +func (client *Client) RemoveServersFromServerGroupWithCallback(request *RemoveServersFromServerGroupRequest, callback func(response *RemoveServersFromServerGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *RemoveServersFromServerGroupResponse + var err error + defer close(result) + response, err = client.RemoveServersFromServerGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// RemoveServersFromServerGroupRequest is the request struct for api RemoveServersFromServerGroup +type RemoveServersFromServerGroupRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ServerGroupId string `position:"Query" name:"ServerGroupId"` + Servers *[]RemoveServersFromServerGroupServers `position:"Query" name:"Servers" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// RemoveServersFromServerGroupServers is a repeated param struct in RemoveServersFromServerGroupRequest +type RemoveServersFromServerGroupServers struct { + ServerType string `name:"ServerType"` + Port string `name:"Port"` + ServerIp string `name:"ServerIp"` + ServerId string `name:"ServerId"` +} + +// RemoveServersFromServerGroupResponse is the response struct for api RemoveServersFromServerGroup +type RemoveServersFromServerGroupResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateRemoveServersFromServerGroupRequest creates a request to invoke RemoveServersFromServerGroup API +func CreateRemoveServersFromServerGroupRequest() (request *RemoveServersFromServerGroupRequest) { + request = &RemoveServersFromServerGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "RemoveServersFromServerGroup", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateRemoveServersFromServerGroupResponse creates a response to parse from RemoveServersFromServerGroup response +func CreateRemoveServersFromServerGroupResponse() (response *RemoveServersFromServerGroupResponse) { + response = &RemoveServersFromServerGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/replace_servers_in_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/replace_servers_in_server_group.go new file mode 100644 index 000000000..1b570d28d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/replace_servers_in_server_group.go @@ -0,0 +1,122 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// ReplaceServersInServerGroup invokes the alb.ReplaceServersInServerGroup API synchronously +func (client *Client) ReplaceServersInServerGroup(request *ReplaceServersInServerGroupRequest) (response *ReplaceServersInServerGroupResponse, err error) { + response = CreateReplaceServersInServerGroupResponse() + err = client.DoAction(request, response) + return +} + +// ReplaceServersInServerGroupWithChan invokes the alb.ReplaceServersInServerGroup API asynchronously +func (client *Client) ReplaceServersInServerGroupWithChan(request *ReplaceServersInServerGroupRequest) (<-chan *ReplaceServersInServerGroupResponse, <-chan error) { + responseChan := make(chan *ReplaceServersInServerGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.ReplaceServersInServerGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// ReplaceServersInServerGroupWithCallback invokes the alb.ReplaceServersInServerGroup API asynchronously +func (client *Client) ReplaceServersInServerGroupWithCallback(request *ReplaceServersInServerGroupRequest, callback func(response *ReplaceServersInServerGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *ReplaceServersInServerGroupResponse + var err error + defer close(result) + response, err = client.ReplaceServersInServerGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// ReplaceServersInServerGroupRequest is the request struct for api ReplaceServersInServerGroup +type ReplaceServersInServerGroupRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ServerGroupId string `position:"Query" name:"ServerGroupId"` + AddedServers *[]ReplaceServersInServerGroupAddedServers `position:"Query" name:"AddedServers" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + RemovedServers *[]ReplaceServersInServerGroupRemovedServers `position:"Query" name:"RemovedServers" type:"Repeated"` +} + +// ReplaceServersInServerGroupAddedServers is a repeated param struct in ReplaceServersInServerGroupRequest +type ReplaceServersInServerGroupAddedServers struct { + ServerType string `name:"ServerType"` + Port string `name:"Port"` + Description string `name:"Description"` + ServerIp string `name:"ServerIp"` + Weight string `name:"Weight"` + ServerId string `name:"ServerId"` +} + +// ReplaceServersInServerGroupRemovedServers is a repeated param struct in ReplaceServersInServerGroupRequest +type ReplaceServersInServerGroupRemovedServers struct { + ServerType string `name:"ServerType"` + Port string `name:"Port"` + ServerIp string `name:"ServerIp"` + ServerId string `name:"ServerId"` +} + +// ReplaceServersInServerGroupResponse is the response struct for api ReplaceServersInServerGroup +type ReplaceServersInServerGroupResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateReplaceServersInServerGroupRequest creates a request to invoke ReplaceServersInServerGroup API +func CreateReplaceServersInServerGroupRequest() (request *ReplaceServersInServerGroupRequest) { + request = &ReplaceServersInServerGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "ReplaceServersInServerGroup", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateReplaceServersInServerGroupResponse creates a response to parse from ReplaceServersInServerGroup response +func CreateReplaceServersInServerGroupResponse() (response *ReplaceServersInServerGroupResponse) { + response = &ReplaceServersInServerGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/start_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/start_listener.go new file mode 100644 index 000000000..1faa56a9e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/start_listener.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// StartListener invokes the alb.StartListener API synchronously +func (client *Client) StartListener(request *StartListenerRequest) (response *StartListenerResponse, err error) { + response = CreateStartListenerResponse() + err = client.DoAction(request, response) + return +} + +// StartListenerWithChan invokes the alb.StartListener API asynchronously +func (client *Client) StartListenerWithChan(request *StartListenerRequest) (<-chan *StartListenerResponse, <-chan error) { + responseChan := make(chan *StartListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.StartListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// StartListenerWithCallback invokes the alb.StartListener API asynchronously +func (client *Client) StartListenerWithCallback(request *StartListenerRequest, callback func(response *StartListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *StartListenerResponse + var err error + defer close(result) + response, err = client.StartListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// StartListenerRequest is the request struct for api StartListener +type StartListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// StartListenerResponse is the response struct for api StartListener +type StartListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateStartListenerRequest creates a request to invoke StartListener API +func CreateStartListenerRequest() (request *StartListenerRequest) { + request = &StartListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "StartListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateStartListenerResponse creates a response to parse from StartListener response +func CreateStartListenerResponse() (response *StartListenerResponse) { + response = &StartListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/stop_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/stop_listener.go new file mode 100644 index 000000000..e8cb58d05 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/stop_listener.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// StopListener invokes the alb.StopListener API synchronously +func (client *Client) StopListener(request *StopListenerRequest) (response *StopListenerResponse, err error) { + response = CreateStopListenerResponse() + err = client.DoAction(request, response) + return +} + +// StopListenerWithChan invokes the alb.StopListener API asynchronously +func (client *Client) StopListenerWithChan(request *StopListenerRequest) (<-chan *StopListenerResponse, <-chan error) { + responseChan := make(chan *StopListenerResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.StopListener(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// StopListenerWithCallback invokes the alb.StopListener API asynchronously +func (client *Client) StopListenerWithCallback(request *StopListenerRequest, callback func(response *StopListenerResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *StopListenerResponse + var err error + defer close(result) + response, err = client.StopListener(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// StopListenerRequest is the request struct for api StopListener +type StopListenerRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ListenerId string `position:"Query" name:"ListenerId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// StopListenerResponse is the response struct for api StopListener +type StopListenerResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateStopListenerRequest creates a request to invoke StopListener API +func CreateStopListenerRequest() (request *StopListenerRequest) { + request = &StopListenerRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "StopListener", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateStopListenerResponse creates a response to parse from StopListener response +func CreateStopListenerResponse() (response *StopListenerResponse) { + response = &StopListenerResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_config.go new file mode 100644 index 000000000..c1b57a5de --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AccessLogConfig is a nested struct in alb response +type AccessLogConfig struct { + LogStore string `json:"LogStore" xml:"LogStore"` + LogProject string `json:"LogProject" xml:"LogProject"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_tracing_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_tracing_config.go new file mode 100644 index 000000000..d30b2ef55 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_access_log_tracing_config.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AccessLogTracingConfig is a nested struct in alb response +type AccessLogTracingConfig struct { + TracingSample int `json:"TracingSample" xml:"TracingSample"` + TracingType string `json:"TracingType" xml:"TracingType"` + TracingEnabled bool `json:"TracingEnabled" xml:"TracingEnabled"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl.go new file mode 100644 index 000000000..985cae190 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl.go @@ -0,0 +1,27 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Acl is a nested struct in alb response +type Acl struct { + AclId string `json:"AclId" xml:"AclId"` + AclName string `json:"AclName" xml:"AclName"` + AclStatus string `json:"AclStatus" xml:"AclStatus"` + AddressIPVersion string `json:"AddressIPVersion" xml:"AddressIPVersion"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_config.go new file mode 100644 index 000000000..1f8f8336f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AclConfig is a nested struct in alb response +type AclConfig struct { + AclType string `json:"AclType" xml:"AclType"` + AclRelations []AclRelation `json:"AclRelations" xml:"AclRelations"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entries.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entries.go new file mode 100644 index 000000000..bb76c85a1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entries.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AclEntries is a nested struct in alb response +type AclEntries struct { + AclEntry []AclEntry `json:"AclEntry" xml:"AclEntry"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entry.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entry.go new file mode 100644 index 000000000..b5fed528f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_entry.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AclEntry is a nested struct in alb response +type AclEntry struct { + Description string `json:"Description" xml:"Description"` + Entry string `json:"Entry" xml:"Entry"` + Status string `json:"Status" xml:"Status"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relation.go new file mode 100644 index 000000000..24cd7b1ee --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relation.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AclRelation is a nested struct in alb response +type AclRelation struct { + AclId string `json:"AclId" xml:"AclId"` + Status string `json:"Status" xml:"Status"` + RelatedListeners []RelatedListener `json:"RelatedListeners" xml:"RelatedListeners"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_get_listener_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_get_listener_attribute.go new file mode 100644 index 000000000..28bd37b66 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_get_listener_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AclRelationsInGetListenerAttribute is a nested struct in alb response +type AclRelationsInGetListenerAttribute struct { + AclRelation []AclRelation `json:"aclRelation" xml:"aclRelation"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_list_acl_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_list_acl_relations.go new file mode 100644 index 000000000..a751e64a0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acl_relations_in_list_acl_relations.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AclRelationsInListAclRelations is a nested struct in alb response +type AclRelationsInListAclRelations struct { + AclRelation []AclRelation `json:"AclRelation" xml:"AclRelation"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acls.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acls.go new file mode 100644 index 000000000..f6bec9eda --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_acls.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Acls is a nested struct in alb response +type Acls struct { + Acl []Acl `json:"Acl" xml:"Acl"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_action.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_action.go new file mode 100644 index 000000000..2af61599c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_action.go @@ -0,0 +1,30 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Action is a nested struct in alb response +type Action struct { + Order int `json:"Order" xml:"Order"` + Type string `json:"Type" xml:"Type"` + FixedResponseConfig FixedResponseConfig `json:"FixedResponseConfig" xml:"FixedResponseConfig"` + ForwardGroupConfig ForwardGroupConfigInListRules `json:"ForwardGroupConfig" xml:"ForwardGroupConfig"` + InsertHeaderConfig InsertHeaderConfig `json:"InsertHeaderConfig" xml:"InsertHeaderConfig"` + RedirectConfig RedirectConfig `json:"RedirectConfig" xml:"RedirectConfig"` + RemoveHeaderConfig RemoveHeaderConfig `json:"RemoveHeaderConfig" xml:"RemoveHeaderConfig"` + RewriteConfig RewriteConfig `json:"RewriteConfig" xml:"RewriteConfig"` + TrafficMirrorConfig TrafficMirrorConfig `json:"TrafficMirrorConfig" xml:"TrafficMirrorConfig"` + TrafficLimitConfig TrafficLimitConfig `json:"TrafficLimitConfig" xml:"TrafficLimitConfig"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_backend_server.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_backend_server.go new file mode 100644 index 000000000..a0921013a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_backend_server.go @@ -0,0 +1,28 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// BackendServer is a nested struct in alb response +type BackendServer struct { + Description string `json:"Description" xml:"Description"` + Port int `json:"Port" xml:"Port"` + ServerId string `json:"ServerId" xml:"ServerId"` + ServerIp string `json:"ServerIp" xml:"ServerIp"` + ServerType string `json:"ServerType" xml:"ServerType"` + Status string `json:"Status" xml:"Status"` + Weight int `json:"Weight" xml:"Weight"` + ServerGroupId string `json:"ServerGroupId" xml:"ServerGroupId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ca_certificates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ca_certificates.go new file mode 100644 index 000000000..5436bbfa9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ca_certificates.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CaCertificates is a nested struct in alb response +type CaCertificates struct { + Certificate []Certificate `json:"Certificate" xml:"Certificate"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate.go new file mode 100644 index 000000000..e6dd7206c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Certificate is a nested struct in alb response +type Certificate struct { + IsDefault bool `json:"IsDefault" xml:"IsDefault"` + CertificateId string `json:"CertificateId" xml:"CertificateId"` + Status string `json:"Status" xml:"Status"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate_model.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate_model.go new file mode 100644 index 000000000..a1aeac67a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificate_model.go @@ -0,0 +1,24 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CertificateModel is a nested struct in alb response +type CertificateModel struct { + CertificateId string `json:"CertificateId" xml:"CertificateId"` + IsDefault bool `json:"IsDefault" xml:"IsDefault"` + Status string `json:"Status" xml:"Status"` + CertificateType string `json:"CertificateType" xml:"CertificateType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_get_listener_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_get_listener_attribute.go new file mode 100644 index 000000000..0d90c5e49 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_get_listener_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CertificatesInGetListenerAttribute is a nested struct in alb response +type CertificatesInGetListenerAttribute struct { + Certificate []Certificate `json:"Certificate" xml:"Certificate"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_list_listener_certificates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_list_listener_certificates.go new file mode 100644 index 000000000..07f1f9fe1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_certificates_in_list_listener_certificates.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CertificatesInListListenerCertificates is a nested struct in alb response +type CertificatesInListListenerCertificates struct { + CertificateModel []CertificateModel `json:"CertificateModel" xml:"CertificateModel"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_security_policies.go new file mode 100644 index 000000000..261da6dee --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_security_policies.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CiphersInListSecurityPolicies is a nested struct in alb response +type CiphersInListSecurityPolicies struct { + Cipher []string `json:"Cipher" xml:"Cipher"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_system_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_system_security_policies.go new file mode 100644 index 000000000..e12d421cd --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_ciphers_in_list_system_security_policies.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CiphersInListSystemSecurityPolicies is a nested struct in alb response +type CiphersInListSystemSecurityPolicies struct { + Cipher []string `json:"Cipher" xml:"Cipher"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_condition.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_condition.go new file mode 100644 index 000000000..d08bab20d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_condition.go @@ -0,0 +1,30 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Condition is a nested struct in alb response +type Condition struct { + Type string `json:"Type" xml:"Type"` + CookieConfig CookieConfig `json:"CookieConfig" xml:"CookieConfig"` + HeaderConfig HeaderConfig `json:"HeaderConfig" xml:"HeaderConfig"` + HostConfig HostConfig `json:"HostConfig" xml:"HostConfig"` + MethodConfig MethodConfig `json:"MethodConfig" xml:"MethodConfig"` + PathConfig PathConfig `json:"PathConfig" xml:"PathConfig"` + QueryStringConfig QueryStringConfig `json:"QueryStringConfig" xml:"QueryStringConfig"` + SourceIpConfig SourceIpConfig `json:"SourceIpConfig" xml:"SourceIpConfig"` + ResponseStatusCodeConfig ResponseStatusCodeConfig `json:"ResponseStatusCodeConfig" xml:"ResponseStatusCodeConfig"` + ResponseHeaderConfig ResponseHeaderConfig `json:"ResponseHeaderConfig" xml:"ResponseHeaderConfig"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_cookie_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_cookie_config.go new file mode 100644 index 000000000..c485eee08 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_cookie_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CookieConfig is a nested struct in alb response +type CookieConfig struct { + Values []Value `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_action.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_action.go new file mode 100644 index 000000000..abbab28e7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_action.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DefaultAction is a nested struct in alb response +type DefaultAction struct { + Type string `json:"Type" xml:"Type"` + ForwardGroupConfig ForwardGroupConfig `json:"ForwardGroupConfig" xml:"ForwardGroupConfig"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_get_listener_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_get_listener_attribute.go new file mode 100644 index 000000000..cbb0ca722 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_get_listener_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DefaultActionsInGetListenerAttribute is a nested struct in alb response +type DefaultActionsInGetListenerAttribute struct { + DefaultAction []DefaultAction `json:"defaultAction" xml:"defaultAction"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_list_listeners.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_list_listeners.go new file mode 100644 index 000000000..52859478d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_default_actions_in_list_listeners.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DefaultActionsInListListeners is a nested struct in alb response +type DefaultActionsInListListeners struct { + DefaultAction []DefaultAction `json:"defaultAction" xml:"defaultAction"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_deletion_protection_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_deletion_protection_config.go new file mode 100644 index 000000000..bc12678b2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_deletion_protection_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DeletionProtectionConfig is a nested struct in alb response +type DeletionProtectionConfig struct { + Enabled bool `json:"Enabled" xml:"Enabled"` + EnabledTime string `json:"EnabledTime" xml:"EnabledTime"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_feature_labels.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_feature_labels.go new file mode 100644 index 000000000..9fbb6a734 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_feature_labels.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// FeatureLabels is a nested struct in alb response +type FeatureLabels struct { + FeatureLabel []string `json:"FeatureLabel" xml:"FeatureLabel"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_fixed_response_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_fixed_response_config.go new file mode 100644 index 000000000..eaf0793bf --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_fixed_response_config.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// FixedResponseConfig is a nested struct in alb response +type FixedResponseConfig struct { + Content string `json:"Content" xml:"Content"` + ContentType string `json:"ContentType" xml:"ContentType"` + HttpCode string `json:"HttpCode" xml:"HttpCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config.go new file mode 100644 index 000000000..aa160df71 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ForwardGroupConfig is a nested struct in alb response +type ForwardGroupConfig struct { + ServerGroupTuples []ServerGroupTuple `json:"ServerGroupTuples" xml:"ServerGroupTuples"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config_in_list_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config_in_list_rules.go new file mode 100644 index 000000000..13698f40d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_forward_group_config_in_list_rules.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ForwardGroupConfigInListRules is a nested struct in alb response +type ForwardGroupConfigInListRules struct { + ServerGroupStickySession ServerGroupStickySession `json:"ServerGroupStickySession" xml:"ServerGroupStickySession"` + ServerGroupTuples []ServerGroupTuple `json:"ServerGroupTuples" xml:"ServerGroupTuples"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_header_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_header_config.go new file mode 100644 index 000000000..f7713695f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_header_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HeaderConfig is a nested struct in alb response +type HeaderConfig struct { + Key string `json:"Key" xml:"Key"` + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_get_health_check_template_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_get_health_check_template_attribute.go new file mode 100644 index 000000000..48f1d77ad --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_get_health_check_template_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckCodesInGetHealthCheckTemplateAttribute is a nested struct in alb response +type HealthCheckCodesInGetHealthCheckTemplateAttribute struct { + HealthCheckCode []string `json:"HealthCheckCode" xml:"HealthCheckCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_health_check_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_health_check_templates.go new file mode 100644 index 000000000..0b2362ad4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_health_check_templates.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckCodesInListHealthCheckTemplates is a nested struct in alb response +type HealthCheckCodesInListHealthCheckTemplates struct { + HealthCheckCode []string `json:"HealthCheckCode" xml:"HealthCheckCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_server_groups.go new file mode 100644 index 000000000..2827119fa --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_codes_in_list_server_groups.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckCodesInListServerGroups is a nested struct in alb response +type HealthCheckCodesInListServerGroups struct { + HealthCheckCode []string `json:"HealthCheckCode" xml:"HealthCheckCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_config.go new file mode 100644 index 000000000..db8f2b419 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_config.go @@ -0,0 +1,34 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckConfig is a nested struct in alb response +type HealthCheckConfig struct { + HealthCheckConnectPort int `json:"HealthCheckConnectPort" xml:"HealthCheckConnectPort"` + HealthCheckEnabled bool `json:"HealthCheckEnabled" xml:"HealthCheckEnabled"` + HealthCheckHost string `json:"HealthCheckHost" xml:"HealthCheckHost"` + HealthCheckHttpVersion string `json:"HealthCheckHttpVersion" xml:"HealthCheckHttpVersion"` + HealthCheckInterval int `json:"HealthCheckInterval" xml:"HealthCheckInterval"` + HealthCheckMethod string `json:"HealthCheckMethod" xml:"HealthCheckMethod"` + HealthCheckPath string `json:"HealthCheckPath" xml:"HealthCheckPath"` + HealthCheckProtocol string `json:"HealthCheckProtocol" xml:"HealthCheckProtocol"` + HealthCheckTimeout int `json:"HealthCheckTimeout" xml:"HealthCheckTimeout"` + HealthyThreshold int `json:"HealthyThreshold" xml:"HealthyThreshold"` + UnhealthyThreshold int `json:"UnhealthyThreshold" xml:"UnhealthyThreshold"` + HealthCheckTcpFastCloseEnabled bool `json:"HealthCheckTcpFastCloseEnabled" xml:"HealthCheckTcpFastCloseEnabled"` + HealthCheckHttpCodes []string `json:"HealthCheckHttpCodes" xml:"HealthCheckHttpCodes"` + HealthCheckCodes []string `json:"HealthCheckCodes" xml:"HealthCheckCodes"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_get_health_check_template_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_get_health_check_template_attribute.go new file mode 100644 index 000000000..d7f44a8db --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_get_health_check_template_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckHttpCodesInGetHealthCheckTemplateAttribute is a nested struct in alb response +type HealthCheckHttpCodesInGetHealthCheckTemplateAttribute struct { + HttpCode []string `json:"httpCode" xml:"httpCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_health_check_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_health_check_templates.go new file mode 100644 index 000000000..159059809 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_health_check_templates.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckHttpCodesInListHealthCheckTemplates is a nested struct in alb response +type HealthCheckHttpCodesInListHealthCheckTemplates struct { + HttpCode []string `json:"httpCode" xml:"httpCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_server_groups.go new file mode 100644 index 000000000..6b0542d6a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_http_codes_in_list_server_groups.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckHttpCodesInListServerGroups is a nested struct in alb response +type HealthCheckHttpCodesInListServerGroups struct { + HealthCheckHttpCode []string `json:"HealthCheckHttpCode" xml:"HealthCheckHttpCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_template.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_template.go new file mode 100644 index 000000000..b0a017efe --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_template.go @@ -0,0 +1,37 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckTemplate is a nested struct in alb response +type HealthCheckTemplate struct { + HealthCheckConnectPort int `json:"HealthCheckConnectPort" xml:"HealthCheckConnectPort"` + HealthCheckHost string `json:"HealthCheckHost" xml:"HealthCheckHost"` + HealthCheckHttpVersion string `json:"HealthCheckHttpVersion" xml:"HealthCheckHttpVersion"` + HealthCheckInterval int `json:"HealthCheckInterval" xml:"HealthCheckInterval"` + HealthCheckMethod string `json:"HealthCheckMethod" xml:"HealthCheckMethod"` + HealthCheckPath string `json:"HealthCheckPath" xml:"HealthCheckPath"` + HealthCheckProtocol string `json:"HealthCheckProtocol" xml:"HealthCheckProtocol"` + HealthCheckTemplateId string `json:"HealthCheckTemplateId" xml:"HealthCheckTemplateId"` + HealthCheckTemplateName string `json:"HealthCheckTemplateName" xml:"HealthCheckTemplateName"` + HealthCheckTimeout int `json:"HealthCheckTimeout" xml:"HealthCheckTimeout"` + HealthyThreshold int `json:"HealthyThreshold" xml:"HealthyThreshold"` + UnhealthyThreshold int `json:"UnhealthyThreshold" xml:"UnhealthyThreshold"` + HealthCheckTcpFastCloseEnabled bool `json:"HealthCheckTcpFastCloseEnabled" xml:"HealthCheckTcpFastCloseEnabled"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + HealthCheckHttpCodes []string `json:"HealthCheckHttpCodes" xml:"HealthCheckHttpCodes"` + HealthCheckCodes []string `json:"HealthCheckCodes" xml:"HealthCheckCodes"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_templates.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_templates.go new file mode 100644 index 000000000..fe90ca73b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_health_check_templates.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HealthCheckTemplates is a nested struct in alb response +type HealthCheckTemplates struct { + HealthCheckTemplate []HealthCheckTemplate `json:"HealthCheckTemplate" xml:"HealthCheckTemplate"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_host_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_host_config.go new file mode 100644 index 000000000..d6f5e823d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_host_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// HostConfig is a nested struct in alb response +type HostConfig struct { + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_insert_header_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_insert_header_config.go new file mode 100644 index 000000000..973670a96 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_insert_header_config.go @@ -0,0 +1,24 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// InsertHeaderConfig is a nested struct in alb response +type InsertHeaderConfig struct { + CoverEnabled bool `json:"CoverEnabled" xml:"CoverEnabled"` + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` + ValueType string `json:"ValueType" xml:"ValueType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_job.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_job.go new file mode 100644 index 000000000..6048e96e6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_job.go @@ -0,0 +1,30 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Job is a nested struct in alb response +type Job struct { + ApiName string `json:"ApiName" xml:"ApiName"` + CreateTime int64 `json:"CreateTime" xml:"CreateTime"` + ErrorCode string `json:"ErrorCode" xml:"ErrorCode"` + ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"` + Id string `json:"Id" xml:"Id"` + ModifyTime int64 `json:"ModifyTime" xml:"ModifyTime"` + OperateType string `json:"OperateType" xml:"OperateType"` + ResourceId string `json:"ResourceId" xml:"ResourceId"` + ResourceType string `json:"ResourceType" xml:"ResourceType"` + Status string `json:"Status" xml:"Status"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_jobs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_jobs.go new file mode 100644 index 000000000..c893a7420 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_jobs.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Jobs is a nested struct in alb response +type Jobs struct { + Job []Job `json:"Job" xml:"Job"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listener.go new file mode 100644 index 000000000..62bcf7a39 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listener.go @@ -0,0 +1,37 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Listener is a nested struct in alb response +type Listener struct { + GzipEnabled bool `json:"GzipEnabled" xml:"GzipEnabled"` + Http2Enabled bool `json:"Http2Enabled" xml:"Http2Enabled"` + IdleTimeout int `json:"IdleTimeout" xml:"IdleTimeout"` + ListenerDescription string `json:"ListenerDescription" xml:"ListenerDescription"` + ListenerId string `json:"ListenerId" xml:"ListenerId"` + ListenerPort int `json:"ListenerPort" xml:"ListenerPort"` + ListenerProtocol string `json:"ListenerProtocol" xml:"ListenerProtocol"` + ListenerStatus string `json:"ListenerStatus" xml:"ListenerStatus"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + RequestTimeout int `json:"RequestTimeout" xml:"RequestTimeout"` + SecurityPolicyId string `json:"SecurityPolicyId" xml:"SecurityPolicyId"` + LogConfig LogConfig `json:"LogConfig" xml:"LogConfig"` + QuicConfig QuicConfig `json:"QuicConfig" xml:"QuicConfig"` + XForwardedForConfig XForwardedForConfig `json:"XForwardedForConfig" xml:"XForwardedForConfig"` + DefaultActions []DefaultAction `json:"DefaultActions" xml:"DefaultActions"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listeners.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listeners.go new file mode 100644 index 000000000..5cfa382d0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_listeners.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Listeners is a nested struct in alb response +type Listeners struct { + Listener []Listener `json:"listener" xml:"listener"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer.go new file mode 100644 index 000000000..ad3a7c19b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer.go @@ -0,0 +1,41 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancer is a nested struct in alb response +type LoadBalancer struct { + AddressAllocatedMode string `json:"AddressAllocatedMode" xml:"AddressAllocatedMode"` + AddressType string `json:"AddressType" xml:"AddressType"` + BandwidthCapacity int `json:"BandwidthCapacity" xml:"BandwidthCapacity"` + BandwidthPackageId string `json:"BandwidthPackageId" xml:"BandwidthPackageId"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + DNSName string `json:"DNSName" xml:"DNSName"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + LoadBalancerBussinessStatus string `json:"LoadBalancerBussinessStatus" xml:"LoadBalancerBussinessStatus"` + LoadBalancerEdition string `json:"LoadBalancerEdition" xml:"LoadBalancerEdition"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + LoadBalancerName string `json:"LoadBalancerName" xml:"LoadBalancerName"` + LoadBalancerStatus string `json:"LoadBalancerStatus" xml:"LoadBalancerStatus"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + VpcId string `json:"VpcId" xml:"VpcId"` + AccessLogConfig AccessLogConfig `json:"AccessLogConfig" xml:"AccessLogConfig"` + DeletionProtectionConfig DeletionProtectionConfig `json:"DeletionProtectionConfig" xml:"DeletionProtectionConfig"` + LoadBalancerBillingConfig LoadBalancerBillingConfig `json:"LoadBalancerBillingConfig" xml:"LoadBalancerBillingConfig"` + ModificationProtectionConfig ModificationProtectionConfig `json:"ModificationProtectionConfig" xml:"ModificationProtectionConfig"` + LoadBalancerOperationLocks []LoadBalancerOperationLock `json:"LoadBalancerOperationLocks" xml:"LoadBalancerOperationLocks"` + Tags []Tag `json:"Tags" xml:"Tags"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_address.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_address.go new file mode 100644 index 000000000..a28e8fe33 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_address.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancerAddress is a nested struct in alb response +type LoadBalancerAddress struct { + Address string `json:"Address" xml:"Address"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_addresses.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_addresses.go new file mode 100644 index 000000000..556d0e2b4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_addresses.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancerAddresses is a nested struct in alb response +type LoadBalancerAddresses struct { + LoadBalancerAddress []LoadBalancerAddress `json:"LoadBalancerAddress" xml:"LoadBalancerAddress"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_billing_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_billing_config.go new file mode 100644 index 000000000..728d617bd --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_billing_config.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancerBillingConfig is a nested struct in alb response +type LoadBalancerBillingConfig struct { + InternetBandwidth int `json:"InternetBandwidth" xml:"InternetBandwidth"` + InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"` + PayType string `json:"PayType" xml:"PayType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_lock.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_lock.go new file mode 100644 index 000000000..0ed7dce6e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_lock.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancerOperationLock is a nested struct in alb response +type LoadBalancerOperationLock struct { + LockReason string `json:"LockReason" xml:"LockReason"` + LockType string `json:"LockType" xml:"LockType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_get_load_balancer_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_get_load_balancer_attribute.go new file mode 100644 index 000000000..e853ea6d0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_get_load_balancer_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancerOperationLocksInGetLoadBalancerAttribute is a nested struct in alb response +type LoadBalancerOperationLocksInGetLoadBalancerAttribute struct { + LoadBalancerOperationLock []LoadBalancerOperationLock `json:"LoadBalancerOperationLock" xml:"LoadBalancerOperationLock"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_list_load_balancers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_list_load_balancers.go new file mode 100644 index 000000000..bfee19846 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancer_operation_locks_in_list_load_balancers.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancerOperationLocksInListLoadBalancers is a nested struct in alb response +type LoadBalancerOperationLocksInListLoadBalancers struct { + LoadBalancerOperationLock []LoadBalancerOperationLock `json:"LoadBalancerOperationLock" xml:"LoadBalancerOperationLock"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancers.go new file mode 100644 index 000000000..726cc321b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_load_balancers.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LoadBalancers is a nested struct in alb response +type LoadBalancers struct { + LoadBalancer []LoadBalancer `json:"loadBalancer" xml:"loadBalancer"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_log_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_log_config.go new file mode 100644 index 000000000..a615756db --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_log_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LogConfig is a nested struct in alb response +type LogConfig struct { + AccessLogRecordCustomizedHeadersEnabled bool `json:"AccessLogRecordCustomizedHeadersEnabled" xml:"AccessLogRecordCustomizedHeadersEnabled"` + AccessLogTracingConfig AccessLogTracingConfig `json:"AccessLogTracingConfig" xml:"AccessLogTracingConfig"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_method_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_method_config.go new file mode 100644 index 000000000..f5143fe75 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_method_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// MethodConfig is a nested struct in alb response +type MethodConfig struct { + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_mirror_group_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_mirror_group_config.go new file mode 100644 index 000000000..c67f42f33 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_mirror_group_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// MirrorGroupConfig is a nested struct in alb response +type MirrorGroupConfig struct { + ServerGroupTuples []ServerGroupTuple `json:"ServerGroupTuples" xml:"ServerGroupTuples"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_modification_protection_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_modification_protection_config.go new file mode 100644 index 000000000..8adc0a8c1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_modification_protection_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ModificationProtectionConfig is a nested struct in alb response +type ModificationProtectionConfig struct { + Reason string `json:"Reason" xml:"Reason"` + Status string `json:"Status" xml:"Status"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_path_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_path_config.go new file mode 100644 index 000000000..61aadad42 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_path_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// PathConfig is a nested struct in alb response +type PathConfig struct { + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_query_string_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_query_string_config.go new file mode 100644 index 000000000..9cf30be9f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_query_string_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// QueryStringConfig is a nested struct in alb response +type QueryStringConfig struct { + Values []Value `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_quic_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_quic_config.go new file mode 100644 index 000000000..b96003c9d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_quic_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// QuicConfig is a nested struct in alb response +type QuicConfig struct { + QuicUpgradeEnabled bool `json:"QuicUpgradeEnabled" xml:"QuicUpgradeEnabled"` + QuicListenerId string `json:"QuicListenerId" xml:"QuicListenerId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_redirect_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_redirect_config.go new file mode 100644 index 000000000..430b0d987 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_redirect_config.go @@ -0,0 +1,26 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RedirectConfig is a nested struct in alb response +type RedirectConfig struct { + Host string `json:"Host" xml:"Host"` + HttpCode string `json:"HttpCode" xml:"HttpCode"` + Path string `json:"Path" xml:"Path"` + Port string `json:"Port" xml:"Port"` + Protocol string `json:"Protocol" xml:"Protocol"` + Query string `json:"Query" xml:"Query"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_region.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_region.go new file mode 100644 index 000000000..d48bf283d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_region.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Region is a nested struct in alb response +type Region struct { + LocalName string `json:"LocalName" xml:"LocalName"` + RegionEndpoint string `json:"RegionEndpoint" xml:"RegionEndpoint"` + RegionId string `json:"RegionId" xml:"RegionId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_regions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_regions.go new file mode 100644 index 000000000..322d03b38 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_regions.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Regions is a nested struct in alb response +type Regions struct { + Region []Region `json:"Region" xml:"Region"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener.go new file mode 100644 index 000000000..7f6f6d98c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener.go @@ -0,0 +1,25 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RelatedListener is a nested struct in alb response +type RelatedListener struct { + ListenerId string `json:"ListenerId" xml:"ListenerId"` + ListenerPort int `json:"ListenerPort" xml:"ListenerPort"` + Status string `json:"Status" xml:"Status"` + ListenerProtocol string `json:"ListenerProtocol" xml:"ListenerProtocol"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener_in_list_security_policy_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener_in_list_security_policy_relations.go new file mode 100644 index 000000000..39459a42c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listener_in_list_security_policy_relations.go @@ -0,0 +1,24 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RelatedListenerInListSecurityPolicyRelations is a nested struct in alb response +type RelatedListenerInListSecurityPolicyRelations struct { + ListenerId string `json:"ListenerId" xml:"ListenerId"` + ListenerPort int64 `json:"ListenerPort" xml:"ListenerPort"` + ListenerProtocol string `json:"ListenerProtocol" xml:"ListenerProtocol"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_acl_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_acl_relations.go new file mode 100644 index 000000000..8f67f5d13 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_acl_relations.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RelatedListenersInListAclRelations is a nested struct in alb response +type RelatedListenersInListAclRelations struct { + RelatedListener []RelatedListener `json:"RelatedListener" xml:"RelatedListener"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_security_policy_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_security_policy_relations.go new file mode 100644 index 000000000..6d87b6a74 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_listeners_in_list_security_policy_relations.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RelatedListenersInListSecurityPolicyRelations is a nested struct in alb response +type RelatedListenersInListSecurityPolicyRelations struct { + RelatedListener []RelatedListenerInListSecurityPolicyRelations `json:"RelatedListener" xml:"RelatedListener"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_load_balancer_ids.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_load_balancer_ids.go new file mode 100644 index 000000000..7ecf0df8a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_related_load_balancer_ids.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RelatedLoadBalancerIds is a nested struct in alb response +type RelatedLoadBalancerIds struct { + RelatedLoadBalancerId []string `json:"RelatedLoadBalancerId" xml:"RelatedLoadBalancerId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_remove_header_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_remove_header_config.go new file mode 100644 index 000000000..f319abd6b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_remove_header_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RemoveHeaderConfig is a nested struct in alb response +type RemoveHeaderConfig struct { + Key string `json:"Key" xml:"Key"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_header_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_header_config.go new file mode 100644 index 000000000..071e496d3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_header_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ResponseHeaderConfig is a nested struct in alb response +type ResponseHeaderConfig struct { + Key string `json:"Key" xml:"Key"` + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_status_code_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_status_code_config.go new file mode 100644 index 000000000..c0fe7341f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_response_status_code_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ResponseStatusCodeConfig is a nested struct in alb response +type ResponseStatusCodeConfig struct { + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rewrite_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rewrite_config.go new file mode 100644 index 000000000..a2f759c6d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rewrite_config.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RewriteConfig is a nested struct in alb response +type RewriteConfig struct { + Host string `json:"Host" xml:"Host"` + Path string `json:"Path" xml:"Path"` + Query string `json:"Query" xml:"Query"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule.go new file mode 100644 index 000000000..a2d132d6c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule.go @@ -0,0 +1,31 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Rule is a nested struct in alb response +type Rule struct { + ListenerId string `json:"ListenerId" xml:"ListenerId"` + LoadBalancerId string `json:"LoadBalancerId" xml:"LoadBalancerId"` + Priority int `json:"Priority" xml:"Priority"` + RuleId string `json:"RuleId" xml:"RuleId"` + RuleName string `json:"RuleName" xml:"RuleName"` + RuleStatus string `json:"RuleStatus" xml:"RuleStatus"` + Direction string `json:"Direction" xml:"Direction"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + RuleActions []Action `json:"RuleActions" xml:"RuleActions"` + RuleConditions []Condition `json:"RuleConditions" xml:"RuleConditions"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_actions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_actions.go new file mode 100644 index 000000000..04199ed57 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_actions.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RuleActions is a nested struct in alb response +type RuleActions struct { + Action []Action `json:"Action" xml:"Action"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_conditions.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_conditions.go new file mode 100644 index 000000000..dcfa2413d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_conditions.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RuleConditions is a nested struct in alb response +type RuleConditions struct { + Condition []Condition `json:"Condition" xml:"Condition"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_id.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_id.go new file mode 100644 index 000000000..783603817 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_id.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RuleId is a nested struct in alb response +type RuleId struct { + RuleId string `json:"RuleId" xml:"RuleId"` + Priority int `json:"Priority" xml:"Priority"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_ids.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_ids.go new file mode 100644 index 000000000..bca177d2d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rule_ids.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// RuleIds is a nested struct in alb response +type RuleIds struct { + RuleId []RuleId `json:"RuleId" xml:"RuleId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rules.go new file mode 100644 index 000000000..d08fd7c8c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_rules.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Rules is a nested struct in alb response +type Rules struct { + Rule []Rule `json:"Rule" xml:"Rule"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relation.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relation.go new file mode 100644 index 000000000..647d905c3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relation.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// SecrityPolicyRelation is a nested struct in alb response +type SecrityPolicyRelation struct { + SecurityPolicyId string `json:"SecurityPolicyId" xml:"SecurityPolicyId"` + RelatedListeners []RelatedListenerInListSecurityPolicyRelations `json:"RelatedListeners" xml:"RelatedListeners"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relations.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relations.go new file mode 100644 index 000000000..ccbdfe7b5 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_secrity_policy_relations.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// SecrityPolicyRelations is a nested struct in alb response +type SecrityPolicyRelations struct { + SecrityPolicyRelation []SecrityPolicyRelation `json:"SecrityPolicyRelation" xml:"SecrityPolicyRelation"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_security_policies.go new file mode 100644 index 000000000..8c5228050 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_security_policies.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// SecurityPoliciesInListSecurityPolicies is a nested struct in alb response +type SecurityPoliciesInListSecurityPolicies struct { + SecurityPolicy []SecurityPolicy `json:"SecurityPolicy" xml:"SecurityPolicy"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_system_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_system_security_policies.go new file mode 100644 index 000000000..bb98929b9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policies_in_list_system_security_policies.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// SecurityPoliciesInListSystemSecurityPolicies is a nested struct in alb response +type SecurityPoliciesInListSystemSecurityPolicies struct { + SecurityPolicy []SecurityPolicy `json:"SecurityPolicy" xml:"SecurityPolicy"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policy.go new file mode 100644 index 000000000..3f3b23912 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_security_policy.go @@ -0,0 +1,28 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// SecurityPolicy is a nested struct in alb response +type SecurityPolicy struct { + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + SecurityPolicyId string `json:"SecurityPolicyId" xml:"SecurityPolicyId"` + SecurityPolicyName string `json:"SecurityPolicyName" xml:"SecurityPolicyName"` + SecurityPolicyStatus string `json:"SecurityPolicyStatus" xml:"SecurityPolicyStatus"` + Ciphers []string `json:"Ciphers" xml:"Ciphers"` + TLSVersions []string `json:"TLSVersions" xml:"TLSVersions"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group.go new file mode 100644 index 000000000..f44f7b8ef --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group.go @@ -0,0 +1,34 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroup is a nested struct in alb response +type ServerGroup struct { + Protocol string `json:"Protocol" xml:"Protocol"` + ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"` + Scheduler string `json:"Scheduler" xml:"Scheduler"` + ServerGroupId string `json:"ServerGroupId" xml:"ServerGroupId"` + ServerGroupName string `json:"ServerGroupName" xml:"ServerGroupName"` + ServerGroupStatus string `json:"ServerGroupStatus" xml:"ServerGroupStatus"` + ServerGroupType string `json:"ServerGroupType" xml:"ServerGroupType"` + VpcId string `json:"VpcId" xml:"VpcId"` + ServiceManagedEnabled bool `json:"ServiceManagedEnabled" xml:"ServiceManagedEnabled"` + ServiceManagedMode string `json:"ServiceManagedMode" xml:"ServiceManagedMode"` + RelatedLoadBalancerIds []string `json:"RelatedLoadBalancerIds" xml:"RelatedLoadBalancerIds"` + HealthCheckConfig HealthCheckConfig `json:"HealthCheckConfig" xml:"HealthCheckConfig"` + StickySessionConfig StickySessionConfig `json:"StickySessionConfig" xml:"StickySessionConfig"` + Tags []Tag `json:"Tags" xml:"Tags"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_sticky_session.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_sticky_session.go new file mode 100644 index 000000000..3d9106403 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_sticky_session.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroupStickySession is a nested struct in alb response +type ServerGroupStickySession struct { + Enabled bool `json:"Enabled" xml:"Enabled"` + Timeout int `json:"Timeout" xml:"Timeout"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuple.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuple.go new file mode 100644 index 000000000..459342e23 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuple.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroupTuple is a nested struct in alb response +type ServerGroupTuple struct { + ServerGroupId string `json:"ServerGroupId" xml:"ServerGroupId"` + Weight int `json:"Weight" xml:"Weight"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_get_listener_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_get_listener_attribute.go new file mode 100644 index 000000000..2eadb1c27 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_get_listener_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroupTuplesInGetListenerAttribute is a nested struct in alb response +type ServerGroupTuplesInGetListenerAttribute struct { + ServerGroupTuple []ServerGroupTuple `json:"serverGroupTuple" xml:"serverGroupTuple"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_listeners.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_listeners.go new file mode 100644 index 000000000..45fe25fb6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_listeners.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroupTuplesInListListeners is a nested struct in alb response +type ServerGroupTuplesInListListeners struct { + ServerGroupTuple []ServerGroupTuple `json:"serverGroupTuple" xml:"serverGroupTuple"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_rules.go new file mode 100644 index 000000000..a3435beab --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_group_tuples_in_list_rules.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroupTuplesInListRules is a nested struct in alb response +type ServerGroupTuplesInListRules struct { + ServerGroupTuple []ServerGroupTuple `json:"ServerGroupTuple" xml:"ServerGroupTuple"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_groups.go new file mode 100644 index 000000000..0340357c2 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_server_groups.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ServerGroups is a nested struct in alb response +type ServerGroups struct { + ServerGroup []ServerGroup `json:"ServerGroup" xml:"ServerGroup"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_servers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_servers.go new file mode 100644 index 000000000..2114958e4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_servers.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Servers is a nested struct in alb response +type Servers struct { + BackendServer []BackendServer `json:"BackendServer" xml:"BackendServer"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_source_ip_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_source_ip_config.go new file mode 100644 index 000000000..a7bfd5134 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_source_ip_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// SourceIpConfig is a nested struct in alb response +type SourceIpConfig struct { + Values []string `json:"Values" xml:"Values"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_sticky_session_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_sticky_session_config.go new file mode 100644 index 000000000..6243b4ed5 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_sticky_session_config.go @@ -0,0 +1,24 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// StickySessionConfig is a nested struct in alb response +type StickySessionConfig struct { + Cookie string `json:"Cookie" xml:"Cookie"` + CookieTimeout int `json:"CookieTimeout" xml:"CookieTimeout"` + StickySessionEnabled bool `json:"StickySessionEnabled" xml:"StickySessionEnabled"` + StickySessionType string `json:"StickySessionType" xml:"StickySessionType"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag.go new file mode 100644 index 000000000..1f3a70281 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Tag is a nested struct in alb response +type Tag struct { + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_key.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_key.go new file mode 100644 index 000000000..096e77d4d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_key.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagKey is a nested struct in alb response +type TagKey struct { + Category string `json:"Category" xml:"Category"` + TagKey string `json:"TagKey" xml:"TagKey"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_keys.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_keys.go new file mode 100644 index 000000000..e02c209b9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_keys.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagKeys is a nested struct in alb response +type TagKeys struct { + TagKey []TagKey `json:"TagKey" xml:"TagKey"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resource.go new file mode 100644 index 000000000..5ec6b5bb0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resource.go @@ -0,0 +1,24 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagResource is a nested struct in alb response +type TagResource struct { + ResourceId string `json:"ResourceId" xml:"ResourceId"` + ResourceType string `json:"ResourceType" xml:"ResourceType"` + TagKey string `json:"TagKey" xml:"TagKey"` + TagValue string `json:"TagValue" xml:"TagValue"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resources.go new file mode 100644 index 000000000..01f3d1fae --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_resources.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagResources is a nested struct in alb response +type TagResources struct { + TagResource []TagResource `json:"TagResource" xml:"TagResource"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_values.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_values.go new file mode 100644 index 000000000..629504155 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tag_values.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagValues is a nested struct in alb response +type TagValues struct { + TagValue []string `json:"TagValue" xml:"TagValue"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_get_load_balancer_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_get_load_balancer_attribute.go new file mode 100644 index 000000000..d62a5dcd6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_get_load_balancer_attribute.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagsInGetLoadBalancerAttribute is a nested struct in alb response +type TagsInGetLoadBalancerAttribute struct { + Tag []Tag `json:"Tag" xml:"Tag"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_load_balancers.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_load_balancers.go new file mode 100644 index 000000000..87965af15 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_load_balancers.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagsInListLoadBalancers is a nested struct in alb response +type TagsInListLoadBalancers struct { + Tag []Tag `json:"Tag" xml:"Tag"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_server_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_server_groups.go new file mode 100644 index 000000000..f280da2ac --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tags_in_list_server_groups.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TagsInListServerGroups is a nested struct in alb response +type TagsInListServerGroups struct { + Tag []Tag `json:"Tag" xml:"Tag"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_security_policies.go new file mode 100644 index 000000000..7bd1a28a1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_security_policies.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TLSVersionsInListSecurityPolicies is a nested struct in alb response +type TLSVersionsInListSecurityPolicies struct { + TLSVersion []string `json:"TLSVersion" xml:"TLSVersion"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_system_security_policies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_system_security_policies.go new file mode 100644 index 000000000..0e36f5d41 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_tls_versions_in_list_system_security_policies.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TLSVersionsInListSystemSecurityPolicies is a nested struct in alb response +type TLSVersionsInListSystemSecurityPolicies struct { + Version []string `json:"Version" xml:"Version"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_limit_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_limit_config.go new file mode 100644 index 000000000..d090e5645 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_limit_config.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TrafficLimitConfig is a nested struct in alb response +type TrafficLimitConfig struct { + QPS int `json:"QPS" xml:"QPS"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_mirror_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_mirror_config.go new file mode 100644 index 000000000..2443fbad4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_traffic_mirror_config.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TrafficMirrorConfig is a nested struct in alb response +type TrafficMirrorConfig struct { + TargetType string `json:"TargetType" xml:"TargetType"` + MirrorGroupConfig MirrorGroupConfig `json:"MirrorGroupConfig" xml:"MirrorGroupConfig"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_value.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_value.go new file mode 100644 index 000000000..6d356fe49 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_value.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Value is a nested struct in alb response +type Value struct { + Key string `json:"Key" xml:"Key"` + Value string `json:"Value" xml:"Value"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_values_in_list_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_values_in_list_rules.go new file mode 100644 index 000000000..c9c332717 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_values_in_list_rules.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ValuesInListRules is a nested struct in alb response +type ValuesInListRules struct { + Value []Value `json:"Value" xml:"Value"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_x_forwarded_for_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_x_forwarded_for_config.go new file mode 100644 index 000000000..ea5ed8a6f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_x_forwarded_for_config.go @@ -0,0 +1,33 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// XForwardedForConfig is a nested struct in alb response +type XForwardedForConfig struct { + XForwardedForClientCertSubjectDNAlias string `json:"XForwardedForClientCertSubjectDNAlias" xml:"XForwardedForClientCertSubjectDNAlias"` + XForwardedForClientCertSubjectDNEnabled bool `json:"XForwardedForClientCertSubjectDNEnabled" xml:"XForwardedForClientCertSubjectDNEnabled"` + XForwardedForProtoEnabled bool `json:"XForwardedForProtoEnabled" xml:"XForwardedForProtoEnabled"` + XForwardedForClientCertIssuerDNEnabled bool `json:"XForwardedForClientCertIssuerDNEnabled" xml:"XForwardedForClientCertIssuerDNEnabled"` + XForwardedForSLBIdEnabled bool `json:"XForwardedForSLBIdEnabled" xml:"XForwardedForSLBIdEnabled"` + XForwardedForClientSrcPortEnabled bool `json:"XForwardedForClientSrcPortEnabled" xml:"XForwardedForClientSrcPortEnabled"` + XForwardedForClientCertFingerprintEnabled bool `json:"XForwardedForClientCertFingerprintEnabled" xml:"XForwardedForClientCertFingerprintEnabled"` + XForwardedForEnabled bool `json:"XForwardedForEnabled" xml:"XForwardedForEnabled"` + XForwardedForSLBPortEnabled bool `json:"XForwardedForSLBPortEnabled" xml:"XForwardedForSLBPortEnabled"` + XForwardedForClientCertClientVerifyAlias string `json:"XForwardedForClientCertClientVerifyAlias" xml:"XForwardedForClientCertClientVerifyAlias"` + XForwardedForClientCertIssuerDNAlias string `json:"XForwardedForClientCertIssuerDNAlias" xml:"XForwardedForClientCertIssuerDNAlias"` + XForwardedForClientCertFingerprintAlias string `json:"XForwardedForClientCertFingerprintAlias" xml:"XForwardedForClientCertFingerprintAlias"` + XForwardedForClientCertClientVerifyEnabled bool `json:"XForwardedForClientCertClientVerifyEnabled" xml:"XForwardedForClientCertClientVerifyEnabled"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone.go new file mode 100644 index 000000000..43ae207e3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone.go @@ -0,0 +1,22 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Zone is a nested struct in alb response +type Zone struct { + LocalName string `json:"LocalName" xml:"LocalName"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mapping.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mapping.go new file mode 100644 index 000000000..2ee882905 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mapping.go @@ -0,0 +1,23 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ZoneMapping is a nested struct in alb response +type ZoneMapping struct { + VSwitchId string `json:"VSwitchId" xml:"VSwitchId"` + ZoneId string `json:"ZoneId" xml:"ZoneId"` + LoadBalancerAddresses []LoadBalancerAddress `json:"LoadBalancerAddresses" xml:"LoadBalancerAddresses"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mappings.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mappings.go new file mode 100644 index 000000000..baa55285c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zone_mappings.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ZoneMappings is a nested struct in alb response +type ZoneMappings struct { + ZoneMapping []ZoneMapping `json:"ZoneMapping" xml:"ZoneMapping"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zones.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zones.go new file mode 100644 index 000000000..6fbca56ee --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/struct_zones.go @@ -0,0 +1,21 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Zones is a nested struct in alb response +type Zones struct { + Zone []Zone `json:"Zone" xml:"Zone"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/tag_resources.go new file mode 100644 index 000000000..7cfda2ca7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/tag_resources.go @@ -0,0 +1,107 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// TagResources invokes the alb.TagResources API synchronously +func (client *Client) TagResources(request *TagResourcesRequest) (response *TagResourcesResponse, err error) { + response = CreateTagResourcesResponse() + err = client.DoAction(request, response) + return +} + +// TagResourcesWithChan invokes the alb.TagResources API asynchronously +func (client *Client) TagResourcesWithChan(request *TagResourcesRequest) (<-chan *TagResourcesResponse, <-chan error) { + responseChan := make(chan *TagResourcesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.TagResources(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// TagResourcesWithCallback invokes the alb.TagResources API asynchronously +func (client *Client) TagResourcesWithCallback(request *TagResourcesRequest, callback func(response *TagResourcesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *TagResourcesResponse + var err error + defer close(result) + response, err = client.TagResources(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// TagResourcesRequest is the request struct for api TagResources +type TagResourcesRequest struct { + *requests.RpcRequest + Tag *[]TagResourcesTag `position:"Query" name:"Tag" type:"Repeated"` + ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` + ResourceType string `position:"Query" name:"ResourceType"` +} + +// TagResourcesTag is a repeated param struct in TagResourcesRequest +type TagResourcesTag struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// TagResourcesResponse is the response struct for api TagResources +type TagResourcesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateTagResourcesRequest creates a request to invoke TagResources API +func CreateTagResourcesRequest() (request *TagResourcesRequest) { + request = &TagResourcesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "TagResources", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateTagResourcesResponse creates a response to parse from TagResources response +func CreateTagResourcesResponse() (response *TagResourcesResponse) { + response = &TagResourcesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/un_tag_resources.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/un_tag_resources.go new file mode 100644 index 000000000..d1062a1ec --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/un_tag_resources.go @@ -0,0 +1,108 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UnTagResources invokes the alb.UnTagResources API synchronously +func (client *Client) UnTagResources(request *UnTagResourcesRequest) (response *UnTagResourcesResponse, err error) { + response = CreateUnTagResourcesResponse() + err = client.DoAction(request, response) + return +} + +// UnTagResourcesWithChan invokes the alb.UnTagResources API asynchronously +func (client *Client) UnTagResourcesWithChan(request *UnTagResourcesRequest) (<-chan *UnTagResourcesResponse, <-chan error) { + responseChan := make(chan *UnTagResourcesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UnTagResources(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UnTagResourcesWithCallback invokes the alb.UnTagResources API asynchronously +func (client *Client) UnTagResourcesWithCallback(request *UnTagResourcesRequest, callback func(response *UnTagResourcesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UnTagResourcesResponse + var err error + defer close(result) + response, err = client.UnTagResources(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UnTagResourcesRequest is the request struct for api UnTagResources +type UnTagResourcesRequest struct { + *requests.RpcRequest + Tag *[]UnTagResourcesTag `position:"Query" name:"Tag" type:"Repeated"` + ResourceId *[]string `position:"Query" name:"ResourceId" type:"Repeated"` + ResourceType string `position:"Query" name:"ResourceType"` + TagKey *[]string `position:"Query" name:"TagKey" type:"Repeated"` +} + +// UnTagResourcesTag is a repeated param struct in UnTagResourcesRequest +type UnTagResourcesTag struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UnTagResourcesResponse is the response struct for api UnTagResources +type UnTagResourcesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUnTagResourcesRequest creates a request to invoke UnTagResources API +func CreateUnTagResourcesRequest() (request *UnTagResourcesRequest) { + request = &UnTagResourcesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UnTagResources", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUnTagResourcesResponse creates a response to parse from UnTagResources response +func CreateUnTagResourcesResponse() (response *UnTagResourcesResponse) { + response = &UnTagResourcesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_acl_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_acl_attribute.go new file mode 100644 index 000000000..921379732 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_acl_attribute.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateAclAttribute invokes the alb.UpdateAclAttribute API synchronously +func (client *Client) UpdateAclAttribute(request *UpdateAclAttributeRequest) (response *UpdateAclAttributeResponse, err error) { + response = CreateUpdateAclAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateAclAttributeWithChan invokes the alb.UpdateAclAttribute API asynchronously +func (client *Client) UpdateAclAttributeWithChan(request *UpdateAclAttributeRequest) (<-chan *UpdateAclAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateAclAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateAclAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateAclAttributeWithCallback invokes the alb.UpdateAclAttribute API asynchronously +func (client *Client) UpdateAclAttributeWithCallback(request *UpdateAclAttributeRequest, callback func(response *UpdateAclAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateAclAttributeResponse + var err error + defer close(result) + response, err = client.UpdateAclAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateAclAttributeRequest is the request struct for api UpdateAclAttribute +type UpdateAclAttributeRequest struct { + *requests.RpcRequest + AclName string `position:"Query" name:"AclName"` + ClientToken string `position:"Query" name:"ClientToken"` + AclId string `position:"Query" name:"AclId"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// UpdateAclAttributeResponse is the response struct for api UpdateAclAttribute +type UpdateAclAttributeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateAclAttributeRequest creates a request to invoke UpdateAclAttribute API +func CreateUpdateAclAttributeRequest() (request *UpdateAclAttributeRequest) { + request = &UpdateAclAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateAclAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateAclAttributeResponse creates a response to parse from UpdateAclAttribute response +func CreateUpdateAclAttributeResponse() (response *UpdateAclAttributeResponse) { + response = &UpdateAclAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_health_check_template_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_health_check_template_attribute.go new file mode 100644 index 000000000..043951728 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_health_check_template_attribute.go @@ -0,0 +1,115 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateHealthCheckTemplateAttribute invokes the alb.UpdateHealthCheckTemplateAttribute API synchronously +func (client *Client) UpdateHealthCheckTemplateAttribute(request *UpdateHealthCheckTemplateAttributeRequest) (response *UpdateHealthCheckTemplateAttributeResponse, err error) { + response = CreateUpdateHealthCheckTemplateAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateHealthCheckTemplateAttributeWithChan invokes the alb.UpdateHealthCheckTemplateAttribute API asynchronously +func (client *Client) UpdateHealthCheckTemplateAttributeWithChan(request *UpdateHealthCheckTemplateAttributeRequest) (<-chan *UpdateHealthCheckTemplateAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateHealthCheckTemplateAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateHealthCheckTemplateAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateHealthCheckTemplateAttributeWithCallback invokes the alb.UpdateHealthCheckTemplateAttribute API asynchronously +func (client *Client) UpdateHealthCheckTemplateAttributeWithCallback(request *UpdateHealthCheckTemplateAttributeRequest, callback func(response *UpdateHealthCheckTemplateAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateHealthCheckTemplateAttributeResponse + var err error + defer close(result) + response, err = client.UpdateHealthCheckTemplateAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateHealthCheckTemplateAttributeRequest is the request struct for api UpdateHealthCheckTemplateAttribute +type UpdateHealthCheckTemplateAttributeRequest struct { + *requests.RpcRequest + HealthCheckTimeout requests.Integer `position:"Query" name:"HealthCheckTimeout"` + ClientToken string `position:"Query" name:"ClientToken"` + HealthCheckProtocol string `position:"Query" name:"HealthCheckProtocol"` + UnhealthyThreshold requests.Integer `position:"Query" name:"UnhealthyThreshold"` + HealthyThreshold requests.Integer `position:"Query" name:"HealthyThreshold"` + HealthCheckTcpFastCloseEnabled requests.Boolean `position:"Query" name:"HealthCheckTcpFastCloseEnabled"` + HealthCheckPath string `position:"Query" name:"HealthCheckPath"` + HealthCheckCodes *[]string `position:"Query" name:"HealthCheckCodes" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + HealthCheckMethod string `position:"Query" name:"HealthCheckMethod"` + HealthCheckHost string `position:"Query" name:"HealthCheckHost"` + HealthCheckInterval requests.Integer `position:"Query" name:"HealthCheckInterval"` + HealthCheckTemplateName string `position:"Query" name:"HealthCheckTemplateName"` + HealthCheckHttpCodes *[]string `position:"Query" name:"HealthCheckHttpCodes" type:"Repeated"` + HealthCheckTemplateId string `position:"Query" name:"HealthCheckTemplateId"` + HealthCheckHttpVersion string `position:"Query" name:"HealthCheckHttpVersion"` + HealthCheckConnectPort requests.Integer `position:"Query" name:"HealthCheckConnectPort"` +} + +// UpdateHealthCheckTemplateAttributeResponse is the response struct for api UpdateHealthCheckTemplateAttribute +type UpdateHealthCheckTemplateAttributeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateHealthCheckTemplateAttributeRequest creates a request to invoke UpdateHealthCheckTemplateAttribute API +func CreateUpdateHealthCheckTemplateAttributeRequest() (request *UpdateHealthCheckTemplateAttributeRequest) { + request = &UpdateHealthCheckTemplateAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateHealthCheckTemplateAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateHealthCheckTemplateAttributeResponse creates a response to parse from UpdateHealthCheckTemplateAttribute response +func CreateUpdateHealthCheckTemplateAttributeResponse() (response *UpdateHealthCheckTemplateAttributeResponse) { + response = &UpdateHealthCheckTemplateAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_attribute.go new file mode 100644 index 000000000..7057c752d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_attribute.go @@ -0,0 +1,163 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateListenerAttribute invokes the alb.UpdateListenerAttribute API synchronously +func (client *Client) UpdateListenerAttribute(request *UpdateListenerAttributeRequest) (response *UpdateListenerAttributeResponse, err error) { + response = CreateUpdateListenerAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateListenerAttributeWithChan invokes the alb.UpdateListenerAttribute API asynchronously +func (client *Client) UpdateListenerAttributeWithChan(request *UpdateListenerAttributeRequest) (<-chan *UpdateListenerAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateListenerAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateListenerAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateListenerAttributeWithCallback invokes the alb.UpdateListenerAttribute API asynchronously +func (client *Client) UpdateListenerAttributeWithCallback(request *UpdateListenerAttributeRequest, callback func(response *UpdateListenerAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateListenerAttributeResponse + var err error + defer close(result) + response, err = client.UpdateListenerAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateListenerAttributeRequest is the request struct for api UpdateListenerAttribute +type UpdateListenerAttributeRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + GzipEnabled requests.Boolean `position:"Query" name:"GzipEnabled"` + ListenerId string `position:"Query" name:"ListenerId"` + QuicConfig UpdateListenerAttributeQuicConfig `position:"Query" name:"QuicConfig" type:"Struct"` + Http2Enabled requests.Boolean `position:"Query" name:"Http2Enabled"` + DefaultActions *[]UpdateListenerAttributeDefaultActions `position:"Query" name:"DefaultActions" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + RequestTimeout requests.Integer `position:"Query" name:"RequestTimeout"` + CaCertificates *[]UpdateListenerAttributeCaCertificates `position:"Query" name:"CaCertificates" type:"Repeated"` + XForwardedForConfig UpdateListenerAttributeXForwardedForConfig `position:"Query" name:"XForwardedForConfig" type:"Struct"` + SecurityPolicyId string `position:"Query" name:"SecurityPolicyId"` + IdleTimeout requests.Integer `position:"Query" name:"IdleTimeout"` + Certificates *[]UpdateListenerAttributeCertificates `position:"Query" name:"Certificates" type:"Repeated"` + ListenerDescription string `position:"Query" name:"ListenerDescription"` + CaEnabled requests.Boolean `position:"Query" name:"CaEnabled"` +} + +// UpdateListenerAttributeDefaultActions is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeDefaultActions struct { + ForwardGroupConfig UpdateListenerAttributeDefaultActionsForwardGroupConfig `name:"ForwardGroupConfig" type:"Struct"` + Type string `name:"Type"` +} + +// UpdateListenerAttributeCaCertificates is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeCaCertificates struct { + CertificateId string `name:"CertificateId"` +} + +// UpdateListenerAttributeCertificates is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeCertificates struct { + CertificateId string `name:"CertificateId"` +} + +// UpdateListenerAttributeDefaultActionsForwardGroupConfig is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeDefaultActionsForwardGroupConfig struct { + ServerGroupTuples *[]UpdateListenerAttributeDefaultActionsForwardGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// UpdateListenerAttributeDefaultActionsForwardGroupConfigServerGroupTuplesItem is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeDefaultActionsForwardGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` +} + +// UpdateListenerAttributeQuicConfig is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeQuicConfig struct { + QuicUpgradeEnabled string `name:"QuicUpgradeEnabled"` + QuicListenerId string `name:"QuicListenerId"` +} + +// UpdateListenerAttributeXForwardedForConfig is a repeated param struct in UpdateListenerAttributeRequest +type UpdateListenerAttributeXForwardedForConfig struct { + XForwardedForClientCertSubjectDNAlias string `name:"XForwardedForClientCertSubjectDNAlias"` + XForwardedForClientCertIssuerDNEnabled string `name:"XForwardedForClientCertIssuerDNEnabled"` + XForwardedForClientCertFingerprintEnabled string `name:"XForwardedForClientCertFingerprintEnabled"` + XForwardedForClientCertIssuerDNAlias string `name:"XForwardedForClientCertIssuerDNAlias"` + XForwardedForProtoEnabled string `name:"XForwardedForProtoEnabled"` + XForwardedForClientCertFingerprintAlias string `name:"XForwardedForClientCertFingerprintAlias"` + XForwardedForClientCertClientVerifyEnabled string `name:"XForwardedForClientCertClientVerifyEnabled"` + XForwardedForSLBPortEnabled string `name:"XForwardedForSLBPortEnabled"` + XForwardedForClientCertSubjectDNEnabled string `name:"XForwardedForClientCertSubjectDNEnabled"` + XForwardedForClientCertClientVerifyAlias string `name:"XForwardedForClientCertClientVerifyAlias"` + XForwardedForClientSrcPortEnabled string `name:"XForwardedForClientSrcPortEnabled"` + XForwardedForEnabled string `name:"XForwardedForEnabled"` + XForwardedForSLBIdEnabled string `name:"XForwardedForSLBIdEnabled"` +} + +// UpdateListenerAttributeResponse is the response struct for api UpdateListenerAttribute +type UpdateListenerAttributeResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateListenerAttributeRequest creates a request to invoke UpdateListenerAttribute API +func CreateUpdateListenerAttributeRequest() (request *UpdateListenerAttributeRequest) { + request = &UpdateListenerAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateListenerAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateListenerAttributeResponse creates a response to parse from UpdateListenerAttribute response +func CreateUpdateListenerAttributeResponse() (response *UpdateListenerAttributeResponse) { + response = &UpdateListenerAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_log_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_log_config.go new file mode 100644 index 000000000..bd1f3617d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_listener_log_config.go @@ -0,0 +1,111 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateListenerLogConfig invokes the alb.UpdateListenerLogConfig API synchronously +func (client *Client) UpdateListenerLogConfig(request *UpdateListenerLogConfigRequest) (response *UpdateListenerLogConfigResponse, err error) { + response = CreateUpdateListenerLogConfigResponse() + err = client.DoAction(request, response) + return +} + +// UpdateListenerLogConfigWithChan invokes the alb.UpdateListenerLogConfig API asynchronously +func (client *Client) UpdateListenerLogConfigWithChan(request *UpdateListenerLogConfigRequest) (<-chan *UpdateListenerLogConfigResponse, <-chan error) { + responseChan := make(chan *UpdateListenerLogConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateListenerLogConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateListenerLogConfigWithCallback invokes the alb.UpdateListenerLogConfig API asynchronously +func (client *Client) UpdateListenerLogConfigWithCallback(request *UpdateListenerLogConfigRequest, callback func(response *UpdateListenerLogConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateListenerLogConfigResponse + var err error + defer close(result) + response, err = client.UpdateListenerLogConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateListenerLogConfigRequest is the request struct for api UpdateListenerLogConfig +type UpdateListenerLogConfigRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ListenerId string `position:"Query" name:"ListenerId"` + AccessLogRecordCustomizedHeadersEnabled requests.Boolean `position:"Query" name:"AccessLogRecordCustomizedHeadersEnabled"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + AccessLogTracingConfig UpdateListenerLogConfigAccessLogTracingConfig `position:"Query" name:"AccessLogTracingConfig" type:"Struct"` +} + +// UpdateListenerLogConfigAccessLogTracingConfig is a repeated param struct in UpdateListenerLogConfigRequest +type UpdateListenerLogConfigAccessLogTracingConfig struct { + TracingType string `name:"TracingType"` + TracingEnabled string `name:"TracingEnabled"` + TracingSample string `name:"TracingSample"` +} + +// UpdateListenerLogConfigResponse is the response struct for api UpdateListenerLogConfig +type UpdateListenerLogConfigResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateListenerLogConfigRequest creates a request to invoke UpdateListenerLogConfig API +func CreateUpdateListenerLogConfigRequest() (request *UpdateListenerLogConfigRequest) { + request = &UpdateListenerLogConfigRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateListenerLogConfig", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateListenerLogConfigResponse creates a response to parse from UpdateListenerLogConfig response +func CreateUpdateListenerLogConfigResponse() (response *UpdateListenerLogConfigResponse) { + response = &UpdateListenerLogConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_attribute.go new file mode 100644 index 000000000..660ce3104 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_attribute.go @@ -0,0 +1,110 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateLoadBalancerAttribute invokes the alb.UpdateLoadBalancerAttribute API synchronously +func (client *Client) UpdateLoadBalancerAttribute(request *UpdateLoadBalancerAttributeRequest) (response *UpdateLoadBalancerAttributeResponse, err error) { + response = CreateUpdateLoadBalancerAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateLoadBalancerAttributeWithChan invokes the alb.UpdateLoadBalancerAttribute API asynchronously +func (client *Client) UpdateLoadBalancerAttributeWithChan(request *UpdateLoadBalancerAttributeRequest) (<-chan *UpdateLoadBalancerAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateLoadBalancerAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateLoadBalancerAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateLoadBalancerAttributeWithCallback invokes the alb.UpdateLoadBalancerAttribute API asynchronously +func (client *Client) UpdateLoadBalancerAttributeWithCallback(request *UpdateLoadBalancerAttributeRequest, callback func(response *UpdateLoadBalancerAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateLoadBalancerAttributeResponse + var err error + defer close(result) + response, err = client.UpdateLoadBalancerAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateLoadBalancerAttributeRequest is the request struct for api UpdateLoadBalancerAttribute +type UpdateLoadBalancerAttributeRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ModificationProtectionConfig UpdateLoadBalancerAttributeModificationProtectionConfig `position:"Query" name:"ModificationProtectionConfig" type:"Struct"` + LoadBalancerName string `position:"Query" name:"LoadBalancerName"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` +} + +// UpdateLoadBalancerAttributeModificationProtectionConfig is a repeated param struct in UpdateLoadBalancerAttributeRequest +type UpdateLoadBalancerAttributeModificationProtectionConfig struct { + Reason string `name:"Reason"` + Status string `name:"Status"` +} + +// UpdateLoadBalancerAttributeResponse is the response struct for api UpdateLoadBalancerAttribute +type UpdateLoadBalancerAttributeResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateLoadBalancerAttributeRequest creates a request to invoke UpdateLoadBalancerAttribute API +func CreateUpdateLoadBalancerAttributeRequest() (request *UpdateLoadBalancerAttributeRequest) { + request = &UpdateLoadBalancerAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateLoadBalancerAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateLoadBalancerAttributeResponse creates a response to parse from UpdateLoadBalancerAttribute response +func CreateUpdateLoadBalancerAttributeResponse() (response *UpdateLoadBalancerAttributeResponse) { + response = &UpdateLoadBalancerAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_edition.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_edition.go new file mode 100644 index 000000000..eadec4264 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_load_balancer_edition.go @@ -0,0 +1,102 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateLoadBalancerEdition invokes the alb.UpdateLoadBalancerEdition API synchronously +func (client *Client) UpdateLoadBalancerEdition(request *UpdateLoadBalancerEditionRequest) (response *UpdateLoadBalancerEditionResponse, err error) { + response = CreateUpdateLoadBalancerEditionResponse() + err = client.DoAction(request, response) + return +} + +// UpdateLoadBalancerEditionWithChan invokes the alb.UpdateLoadBalancerEdition API asynchronously +func (client *Client) UpdateLoadBalancerEditionWithChan(request *UpdateLoadBalancerEditionRequest) (<-chan *UpdateLoadBalancerEditionResponse, <-chan error) { + responseChan := make(chan *UpdateLoadBalancerEditionResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateLoadBalancerEdition(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateLoadBalancerEditionWithCallback invokes the alb.UpdateLoadBalancerEdition API asynchronously +func (client *Client) UpdateLoadBalancerEditionWithCallback(request *UpdateLoadBalancerEditionRequest, callback func(response *UpdateLoadBalancerEditionResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateLoadBalancerEditionResponse + var err error + defer close(result) + response, err = client.UpdateLoadBalancerEdition(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateLoadBalancerEditionRequest is the request struct for api UpdateLoadBalancerEdition +type UpdateLoadBalancerEditionRequest struct { + *requests.RpcRequest + LoadBalancerEdition string `position:"Query" name:"LoadBalancerEdition"` + ClientToken string `position:"Query" name:"ClientToken"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + LoadBalancerId string `position:"Query" name:"LoadBalancerId"` +} + +// UpdateLoadBalancerEditionResponse is the response struct for api UpdateLoadBalancerEdition +type UpdateLoadBalancerEditionResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateLoadBalancerEditionRequest creates a request to invoke UpdateLoadBalancerEdition API +func CreateUpdateLoadBalancerEditionRequest() (request *UpdateLoadBalancerEditionRequest) { + request = &UpdateLoadBalancerEditionRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateLoadBalancerEdition", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateLoadBalancerEditionResponse creates a response to parse from UpdateLoadBalancerEdition response +func CreateUpdateLoadBalancerEditionResponse() (response *UpdateLoadBalancerEditionResponse) { + response = &UpdateLoadBalancerEditionResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rule_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rule_attribute.go new file mode 100644 index 000000000..e270814a1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rule_attribute.go @@ -0,0 +1,269 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateRuleAttribute invokes the alb.UpdateRuleAttribute API synchronously +func (client *Client) UpdateRuleAttribute(request *UpdateRuleAttributeRequest) (response *UpdateRuleAttributeResponse, err error) { + response = CreateUpdateRuleAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateRuleAttributeWithChan invokes the alb.UpdateRuleAttribute API asynchronously +func (client *Client) UpdateRuleAttributeWithChan(request *UpdateRuleAttributeRequest) (<-chan *UpdateRuleAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateRuleAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateRuleAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateRuleAttributeWithCallback invokes the alb.UpdateRuleAttribute API asynchronously +func (client *Client) UpdateRuleAttributeWithCallback(request *UpdateRuleAttributeRequest, callback func(response *UpdateRuleAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateRuleAttributeResponse + var err error + defer close(result) + response, err = client.UpdateRuleAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateRuleAttributeRequest is the request struct for api UpdateRuleAttribute +type UpdateRuleAttributeRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + RuleName string `position:"Query" name:"RuleName"` + RuleActions *[]UpdateRuleAttributeRuleActions `position:"Query" name:"RuleActions" type:"Repeated"` + RuleConditions *[]UpdateRuleAttributeRuleConditions `position:"Query" name:"RuleConditions" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + Priority requests.Integer `position:"Query" name:"Priority"` + RuleId string `position:"Query" name:"RuleId"` +} + +// UpdateRuleAttributeRuleActions is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActions struct { + FixedResponseConfig UpdateRuleAttributeRuleActionsFixedResponseConfig `name:"FixedResponseConfig" type:"Struct"` + TrafficMirrorConfig UpdateRuleAttributeRuleActionsTrafficMirrorConfig `name:"TrafficMirrorConfig" type:"Struct"` + ForwardGroupConfig UpdateRuleAttributeRuleActionsForwardGroupConfig `name:"ForwardGroupConfig" type:"Struct"` + RemoveHeaderConfig UpdateRuleAttributeRuleActionsRemoveHeaderConfig `name:"RemoveHeaderConfig" type:"Struct"` + InsertHeaderConfig UpdateRuleAttributeRuleActionsInsertHeaderConfig `name:"InsertHeaderConfig" type:"Struct"` + TrafficLimitConfig UpdateRuleAttributeRuleActionsTrafficLimitConfig `name:"TrafficLimitConfig" type:"Struct"` + RedirectConfig UpdateRuleAttributeRuleActionsRedirectConfig `name:"RedirectConfig" type:"Struct"` + Type string `name:"Type"` + Order string `name:"Order"` + RewriteConfig UpdateRuleAttributeRuleActionsRewriteConfig `name:"RewriteConfig" type:"Struct"` +} + +// UpdateRuleAttributeRuleConditions is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditions struct { + MethodConfig UpdateRuleAttributeRuleConditionsMethodConfig `name:"MethodConfig" type:"Struct"` + SourceIpConfig UpdateRuleAttributeRuleConditionsSourceIpConfig `name:"SourceIpConfig" type:"Struct"` + HostConfig UpdateRuleAttributeRuleConditionsHostConfig `name:"HostConfig" type:"Struct"` + QueryStringConfig UpdateRuleAttributeRuleConditionsQueryStringConfig `name:"QueryStringConfig" type:"Struct"` + ResponseStatusCodeConfig UpdateRuleAttributeRuleConditionsResponseStatusCodeConfig `name:"ResponseStatusCodeConfig" type:"Struct"` + PathConfig UpdateRuleAttributeRuleConditionsPathConfig `name:"PathConfig" type:"Struct"` + CookieConfig UpdateRuleAttributeRuleConditionsCookieConfig `name:"CookieConfig" type:"Struct"` + Type string `name:"Type"` + HeaderConfig UpdateRuleAttributeRuleConditionsHeaderConfig `name:"HeaderConfig" type:"Struct"` + ResponseHeaderConfig UpdateRuleAttributeRuleConditionsResponseHeaderConfig `name:"ResponseHeaderConfig" type:"Struct"` +} + +// UpdateRuleAttributeRuleActionsFixedResponseConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsFixedResponseConfig struct { + HttpCode string `name:"HttpCode"` + Content string `name:"Content"` + ContentType string `name:"ContentType"` +} + +// UpdateRuleAttributeRuleActionsTrafficMirrorConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsTrafficMirrorConfig struct { + MirrorGroupConfig UpdateRuleAttributeRuleActionsTrafficMirrorConfigMirrorGroupConfig `name:"MirrorGroupConfig" type:"Struct"` + TargetType string `name:"TargetType"` +} + +// UpdateRuleAttributeRuleActionsForwardGroupConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsForwardGroupConfig struct { + ServerGroupStickySession UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupStickySession `name:"ServerGroupStickySession" type:"Struct"` + ServerGroupTuples *[]UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// UpdateRuleAttributeRuleActionsRemoveHeaderConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsRemoveHeaderConfig struct { + Key string `name:"Key"` +} + +// UpdateRuleAttributeRuleActionsInsertHeaderConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsInsertHeaderConfig struct { + ValueType string `name:"ValueType"` + CoverEnabled string `name:"CoverEnabled"` + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UpdateRuleAttributeRuleActionsTrafficLimitConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsTrafficLimitConfig struct { + QPS string `name:"QPS"` +} + +// UpdateRuleAttributeRuleActionsRedirectConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsRedirectConfig struct { + Path string `name:"Path"` + Protocol string `name:"Protocol"` + Port string `name:"Port"` + Query string `name:"Query"` + Host string `name:"Host"` + HttpCode string `name:"HttpCode"` +} + +// UpdateRuleAttributeRuleActionsRewriteConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsRewriteConfig struct { + Path string `name:"Path"` + Query string `name:"Query"` + Host string `name:"Host"` +} + +// UpdateRuleAttributeRuleConditionsMethodConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsMethodConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsSourceIpConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsSourceIpConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsHostConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsHostConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsQueryStringConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsQueryStringConfig struct { + Values *[]UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsResponseStatusCodeConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsResponseStatusCodeConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsPathConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsPathConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsCookieConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsCookieConfig struct { + Values *[]UpdateRuleAttributeRuleConditionsCookieConfigValuesItem `name:"Values" type:"Repeated"` +} + +// UpdateRuleAttributeRuleConditionsHeaderConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// UpdateRuleAttributeRuleConditionsResponseHeaderConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsResponseHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// UpdateRuleAttributeRuleActionsTrafficMirrorConfigMirrorGroupConfig is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsTrafficMirrorConfigMirrorGroupConfig struct { + ServerGroupTuples *[]UpdateRuleAttributeRuleActionsTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupStickySession is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupStickySession struct { + Enabled string `name:"Enabled"` + Timeout string `name:"Timeout"` +} + +// UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsForwardGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` + Weight string `name:"Weight"` +} + +// UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsQueryStringConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UpdateRuleAttributeRuleConditionsCookieConfigValuesItem is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleConditionsCookieConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UpdateRuleAttributeRuleActionsTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem is a repeated param struct in UpdateRuleAttributeRequest +type UpdateRuleAttributeRuleActionsTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` +} + +// UpdateRuleAttributeResponse is the response struct for api UpdateRuleAttribute +type UpdateRuleAttributeResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateRuleAttributeRequest creates a request to invoke UpdateRuleAttribute API +func CreateUpdateRuleAttributeRequest() (request *UpdateRuleAttributeRequest) { + request = &UpdateRuleAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateRuleAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateRuleAttributeResponse creates a response to parse from UpdateRuleAttribute response +func CreateUpdateRuleAttributeResponse() (response *UpdateRuleAttributeResponse) { + response = &UpdateRuleAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rules_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rules_attribute.go new file mode 100644 index 000000000..e3df2d96f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_rules_attribute.go @@ -0,0 +1,274 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateRulesAttribute invokes the alb.UpdateRulesAttribute API synchronously +func (client *Client) UpdateRulesAttribute(request *UpdateRulesAttributeRequest) (response *UpdateRulesAttributeResponse, err error) { + response = CreateUpdateRulesAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateRulesAttributeWithChan invokes the alb.UpdateRulesAttribute API asynchronously +func (client *Client) UpdateRulesAttributeWithChan(request *UpdateRulesAttributeRequest) (<-chan *UpdateRulesAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateRulesAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateRulesAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateRulesAttributeWithCallback invokes the alb.UpdateRulesAttribute API asynchronously +func (client *Client) UpdateRulesAttributeWithCallback(request *UpdateRulesAttributeRequest, callback func(response *UpdateRulesAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateRulesAttributeResponse + var err error + defer close(result) + response, err = client.UpdateRulesAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateRulesAttributeRequest is the request struct for api UpdateRulesAttribute +type UpdateRulesAttributeRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + Rules *[]UpdateRulesAttributeRules `position:"Query" name:"Rules" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// UpdateRulesAttributeRules is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRules struct { + RuleConditions *[]UpdateRulesAttributeRulesRuleConditionsItem `name:"RuleConditions" type:"Repeated"` + RuleName string `name:"RuleName"` + Priority string `name:"Priority"` + RuleId string `name:"RuleId"` + RuleActions *[]UpdateRulesAttributeRulesRuleActionsItem `name:"RuleActions" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItem is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItem struct { + MethodConfig UpdateRulesAttributeRulesRuleConditionsItemMethodConfig `name:"MethodConfig" type:"Struct"` + SourceIpConfig UpdateRulesAttributeRulesRuleConditionsItemSourceIpConfig `name:"SourceIpConfig" type:"Struct"` + HostConfig UpdateRulesAttributeRulesRuleConditionsItemHostConfig `name:"HostConfig" type:"Struct"` + QueryStringConfig UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfig `name:"QueryStringConfig" type:"Struct"` + ResponseStatusCodeConfig UpdateRulesAttributeRulesRuleConditionsItemResponseStatusCodeConfig `name:"ResponseStatusCodeConfig" type:"Struct"` + PathConfig UpdateRulesAttributeRulesRuleConditionsItemPathConfig `name:"PathConfig" type:"Struct"` + CookieConfig UpdateRulesAttributeRulesRuleConditionsItemCookieConfig `name:"CookieConfig" type:"Struct"` + Type string `name:"Type"` + HeaderConfig UpdateRulesAttributeRulesRuleConditionsItemHeaderConfig `name:"HeaderConfig" type:"Struct"` + ResponseHeaderConfig UpdateRulesAttributeRulesRuleConditionsItemResponseHeaderConfig `name:"ResponseHeaderConfig" type:"Struct"` +} + +// UpdateRulesAttributeRulesRuleActionsItem is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItem struct { + FixedResponseConfig UpdateRulesAttributeRulesRuleActionsItemFixedResponseConfig `name:"FixedResponseConfig" type:"Struct"` + TrafficMirrorConfig UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfig `name:"TrafficMirrorConfig" type:"Struct"` + ForwardGroupConfig UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfig `name:"ForwardGroupConfig" type:"Struct"` + RemoveHeaderConfig UpdateRulesAttributeRulesRuleActionsItemRemoveHeaderConfig `name:"RemoveHeaderConfig" type:"Struct"` + InsertHeaderConfig UpdateRulesAttributeRulesRuleActionsItemInsertHeaderConfig `name:"InsertHeaderConfig" type:"Struct"` + TrafficLimitConfig UpdateRulesAttributeRulesRuleActionsItemTrafficLimitConfig `name:"TrafficLimitConfig" type:"Struct"` + RedirectConfig UpdateRulesAttributeRulesRuleActionsItemRedirectConfig `name:"RedirectConfig" type:"Struct"` + Type string `name:"Type"` + Order string `name:"Order"` + RewriteConfig UpdateRulesAttributeRulesRuleActionsItemRewriteConfig `name:"RewriteConfig" type:"Struct"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemMethodConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemMethodConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemSourceIpConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemSourceIpConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemHostConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemHostConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfig struct { + Values *[]UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemResponseStatusCodeConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemResponseStatusCodeConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemPathConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemPathConfig struct { + Values *[]string `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemCookieConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemCookieConfig struct { + Values *[]UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem `name:"Values" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemHeaderConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemResponseHeaderConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemResponseHeaderConfig struct { + Values *[]string `name:"Values" type:"Repeated"` + Key string `name:"Key"` +} + +// UpdateRulesAttributeRulesRuleActionsItemFixedResponseConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemFixedResponseConfig struct { + HttpCode string `name:"HttpCode"` + Content string `name:"Content"` + ContentType string `name:"ContentType"` +} + +// UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfig struct { + MirrorGroupConfig UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfig `name:"MirrorGroupConfig" type:"Struct"` + TargetType string `name:"TargetType"` +} + +// UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfig struct { + ServerGroupStickySession UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupStickySession `name:"ServerGroupStickySession" type:"Struct"` + ServerGroupTuples *[]UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleActionsItemRemoveHeaderConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemRemoveHeaderConfig struct { + Key string `name:"Key"` +} + +// UpdateRulesAttributeRulesRuleActionsItemInsertHeaderConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemInsertHeaderConfig struct { + ValueType string `name:"ValueType"` + CoverEnabled string `name:"CoverEnabled"` + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UpdateRulesAttributeRulesRuleActionsItemTrafficLimitConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemTrafficLimitConfig struct { + QPS string `name:"QPS"` +} + +// UpdateRulesAttributeRulesRuleActionsItemRedirectConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemRedirectConfig struct { + Path string `name:"Path"` + Protocol string `name:"Protocol"` + Port string `name:"Port"` + Query string `name:"Query"` + Host string `name:"Host"` + HttpCode string `name:"HttpCode"` +} + +// UpdateRulesAttributeRulesRuleActionsItemRewriteConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemRewriteConfig struct { + Path string `name:"Path"` + Query string `name:"Query"` + Host string `name:"Host"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemQueryStringConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleConditionsItemCookieConfigValuesItem struct { + Value string `name:"Value"` + Key string `name:"Key"` +} + +// UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfig is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfig struct { + ServerGroupTuples *[]UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem `name:"ServerGroupTuples" type:"Repeated"` +} + +// UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupStickySession is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupStickySession struct { + Enabled string `name:"Enabled"` + Timeout string `name:"Timeout"` +} + +// UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemForwardGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` + Weight string `name:"Weight"` +} + +// UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem is a repeated param struct in UpdateRulesAttributeRequest +type UpdateRulesAttributeRulesRuleActionsItemTrafficMirrorConfigMirrorGroupConfigServerGroupTuplesItem struct { + ServerGroupId string `name:"ServerGroupId"` +} + +// UpdateRulesAttributeResponse is the response struct for api UpdateRulesAttribute +type UpdateRulesAttributeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + JobId string `json:"JobId" xml:"JobId"` +} + +// CreateUpdateRulesAttributeRequest creates a request to invoke UpdateRulesAttribute API +func CreateUpdateRulesAttributeRequest() (request *UpdateRulesAttributeRequest) { + request = &UpdateRulesAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateRulesAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateRulesAttributeResponse creates a response to parse from UpdateRulesAttribute response +func CreateUpdateRulesAttributeResponse() (response *UpdateRulesAttributeResponse) { + response = &UpdateRulesAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_security_policy_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_security_policy_attribute.go new file mode 100644 index 000000000..2d30623ba --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_security_policy_attribute.go @@ -0,0 +1,105 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateSecurityPolicyAttribute invokes the alb.UpdateSecurityPolicyAttribute API synchronously +func (client *Client) UpdateSecurityPolicyAttribute(request *UpdateSecurityPolicyAttributeRequest) (response *UpdateSecurityPolicyAttributeResponse, err error) { + response = CreateUpdateSecurityPolicyAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateSecurityPolicyAttributeWithChan invokes the alb.UpdateSecurityPolicyAttribute API asynchronously +func (client *Client) UpdateSecurityPolicyAttributeWithChan(request *UpdateSecurityPolicyAttributeRequest) (<-chan *UpdateSecurityPolicyAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateSecurityPolicyAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateSecurityPolicyAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateSecurityPolicyAttributeWithCallback invokes the alb.UpdateSecurityPolicyAttribute API asynchronously +func (client *Client) UpdateSecurityPolicyAttributeWithCallback(request *UpdateSecurityPolicyAttributeRequest, callback func(response *UpdateSecurityPolicyAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateSecurityPolicyAttributeResponse + var err error + defer close(result) + response, err = client.UpdateSecurityPolicyAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateSecurityPolicyAttributeRequest is the request struct for api UpdateSecurityPolicyAttribute +type UpdateSecurityPolicyAttributeRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + Ciphers *[]string `position:"Query" name:"Ciphers" type:"Repeated"` + TLSVersions *[]string `position:"Query" name:"TLSVersions" type:"Repeated"` + SecurityPolicyName string `position:"Query" name:"SecurityPolicyName"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` + SecurityPolicyId string `position:"Query" name:"SecurityPolicyId"` +} + +// UpdateSecurityPolicyAttributeResponse is the response struct for api UpdateSecurityPolicyAttribute +type UpdateSecurityPolicyAttributeResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateSecurityPolicyAttributeRequest creates a request to invoke UpdateSecurityPolicyAttribute API +func CreateUpdateSecurityPolicyAttributeRequest() (request *UpdateSecurityPolicyAttributeRequest) { + request = &UpdateSecurityPolicyAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateSecurityPolicyAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateSecurityPolicyAttributeResponse creates a response to parse from UpdateSecurityPolicyAttribute response +func CreateUpdateSecurityPolicyAttributeResponse() (response *UpdateSecurityPolicyAttributeResponse) { + response = &UpdateSecurityPolicyAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_attribute.go new file mode 100644 index 000000000..ee4c48852 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_attribute.go @@ -0,0 +1,132 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateServerGroupAttribute invokes the alb.UpdateServerGroupAttribute API synchronously +func (client *Client) UpdateServerGroupAttribute(request *UpdateServerGroupAttributeRequest) (response *UpdateServerGroupAttributeResponse, err error) { + response = CreateUpdateServerGroupAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateServerGroupAttributeWithChan invokes the alb.UpdateServerGroupAttribute API asynchronously +func (client *Client) UpdateServerGroupAttributeWithChan(request *UpdateServerGroupAttributeRequest) (<-chan *UpdateServerGroupAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateServerGroupAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateServerGroupAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateServerGroupAttributeWithCallback invokes the alb.UpdateServerGroupAttribute API asynchronously +func (client *Client) UpdateServerGroupAttributeWithCallback(request *UpdateServerGroupAttributeRequest, callback func(response *UpdateServerGroupAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateServerGroupAttributeResponse + var err error + defer close(result) + response, err = client.UpdateServerGroupAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateServerGroupAttributeRequest is the request struct for api UpdateServerGroupAttribute +type UpdateServerGroupAttributeRequest struct { + *requests.RpcRequest + ServerGroupName string `position:"Query" name:"ServerGroupName"` + ClientToken string `position:"Query" name:"ClientToken"` + HealthCheckConfig UpdateServerGroupAttributeHealthCheckConfig `position:"Query" name:"HealthCheckConfig" type:"Struct"` + Scheduler string `position:"Query" name:"Scheduler"` + ServerGroupId string `position:"Query" name:"ServerGroupId"` + StickySessionConfig UpdateServerGroupAttributeStickySessionConfig `position:"Query" name:"StickySessionConfig" type:"Struct"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// UpdateServerGroupAttributeHealthCheckConfig is a repeated param struct in UpdateServerGroupAttributeRequest +type UpdateServerGroupAttributeHealthCheckConfig struct { + HealthCheckCodes *[]string `name:"HealthCheckCodes" type:"Repeated"` + HealthCheckEnabled string `name:"HealthCheckEnabled"` + HealthCheckTimeout string `name:"HealthCheckTimeout"` + HealthCheckMethod string `name:"HealthCheckMethod"` + HealthCheckHost string `name:"HealthCheckHost"` + HealthCheckProtocol string `name:"HealthCheckProtocol"` + UnhealthyThreshold string `name:"UnhealthyThreshold"` + HealthyThreshold string `name:"HealthyThreshold"` + HealthCheckTcpFastCloseEnabled string `name:"HealthCheckTcpFastCloseEnabled"` + HealthCheckPath string `name:"HealthCheckPath"` + HealthCheckInterval string `name:"HealthCheckInterval"` + HealthCheckHttpCodes *[]string `name:"HealthCheckHttpCodes" type:"Repeated"` + HealthCheckHttpVersion string `name:"HealthCheckHttpVersion"` + HealthCheckConnectPort string `name:"HealthCheckConnectPort"` +} + +// UpdateServerGroupAttributeStickySessionConfig is a repeated param struct in UpdateServerGroupAttributeRequest +type UpdateServerGroupAttributeStickySessionConfig struct { + StickySessionEnabled string `name:"StickySessionEnabled"` + Cookie string `name:"Cookie"` + CookieTimeout string `name:"CookieTimeout"` + StickySessionType string `name:"StickySessionType"` +} + +// UpdateServerGroupAttributeResponse is the response struct for api UpdateServerGroupAttribute +type UpdateServerGroupAttributeResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateServerGroupAttributeRequest creates a request to invoke UpdateServerGroupAttribute API +func CreateUpdateServerGroupAttributeRequest() (request *UpdateServerGroupAttributeRequest) { + request = &UpdateServerGroupAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateServerGroupAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateServerGroupAttributeResponse creates a response to parse from UpdateServerGroupAttribute response +func CreateUpdateServerGroupAttributeResponse() (response *UpdateServerGroupAttributeResponse) { + response = &UpdateServerGroupAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_servers_attribute.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_servers_attribute.go new file mode 100644 index 000000000..e87639d9b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alb/update_server_group_servers_attribute.go @@ -0,0 +1,113 @@ +package alb + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateServerGroupServersAttribute invokes the alb.UpdateServerGroupServersAttribute API synchronously +func (client *Client) UpdateServerGroupServersAttribute(request *UpdateServerGroupServersAttributeRequest) (response *UpdateServerGroupServersAttributeResponse, err error) { + response = CreateUpdateServerGroupServersAttributeResponse() + err = client.DoAction(request, response) + return +} + +// UpdateServerGroupServersAttributeWithChan invokes the alb.UpdateServerGroupServersAttribute API asynchronously +func (client *Client) UpdateServerGroupServersAttributeWithChan(request *UpdateServerGroupServersAttributeRequest) (<-chan *UpdateServerGroupServersAttributeResponse, <-chan error) { + responseChan := make(chan *UpdateServerGroupServersAttributeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateServerGroupServersAttribute(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateServerGroupServersAttributeWithCallback invokes the alb.UpdateServerGroupServersAttribute API asynchronously +func (client *Client) UpdateServerGroupServersAttributeWithCallback(request *UpdateServerGroupServersAttributeRequest, callback func(response *UpdateServerGroupServersAttributeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateServerGroupServersAttributeResponse + var err error + defer close(result) + response, err = client.UpdateServerGroupServersAttribute(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateServerGroupServersAttributeRequest is the request struct for api UpdateServerGroupServersAttribute +type UpdateServerGroupServersAttributeRequest struct { + *requests.RpcRequest + ClientToken string `position:"Query" name:"ClientToken"` + ServerGroupId string `position:"Query" name:"ServerGroupId"` + Servers *[]UpdateServerGroupServersAttributeServers `position:"Query" name:"Servers" type:"Repeated"` + DryRun requests.Boolean `position:"Query" name:"DryRun"` +} + +// UpdateServerGroupServersAttributeServers is a repeated param struct in UpdateServerGroupServersAttributeRequest +type UpdateServerGroupServersAttributeServers struct { + ServerType string `name:"ServerType"` + Port string `name:"Port"` + Description string `name:"Description"` + ServerIp string `name:"ServerIp"` + Weight string `name:"Weight"` + ServerId string `name:"ServerId"` +} + +// UpdateServerGroupServersAttributeResponse is the response struct for api UpdateServerGroupServersAttribute +type UpdateServerGroupServersAttributeResponse struct { + *responses.BaseResponse + JobId string `json:"JobId" xml:"JobId"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateServerGroupServersAttributeRequest creates a request to invoke UpdateServerGroupServersAttribute API +func CreateUpdateServerGroupServersAttributeRequest() (request *UpdateServerGroupServersAttributeRequest) { + request = &UpdateServerGroupServersAttributeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alb", "2020-06-16", "UpdateServerGroupServersAttribute", "alb", "openAPI") + request.Method = requests.POST + return +} + +// CreateUpdateServerGroupServersAttributeResponse creates a response to parse from UpdateServerGroupServersAttribute response +func CreateUpdateServerGroupServersAttributeResponse() (response *UpdateServerGroupServersAttributeResponse) { + response = &UpdateServerGroupServersAttributeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/client.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/client.go new file mode 100644 index 000000000..df27530f8 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/client.go @@ -0,0 +1,129 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "reflect" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider" +) + +// Client is the sdk client struct, each func corresponds to an OpenAPI +type Client struct { + sdk.Client +} + +// SetClientProperty Set Property by Reflect +func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) { + v := reflect.ValueOf(client).Elem() + if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() { + v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue)) + } +} + +// SetEndpointDataToClient Set EndpointMap and ENdpointType +func SetEndpointDataToClient(client *Client) { + SetClientProperty(client, "EndpointMap", GetEndpointMap()) + SetClientProperty(client, "EndpointType", GetEndpointType()) +} + +// NewClient creates a sdk client with environment variables +func NewClient() (client *Client, err error) { + client = &Client{} + err = client.Init() + SetEndpointDataToClient(client) + return +} + +// NewClientWithProvider creates a sdk client with providers +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) { + client = &Client{} + var pc provider.Provider + if len(providers) == 0 { + pc = provider.DefaultChain + } else { + pc = provider.NewProviderChain(providers) + } + err = client.InitWithProviderChain(regionId, pc) + SetEndpointDataToClient(client) + return +} + +// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential +// this is the common api to create a sdk client +func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) { + client = &Client{} + err = client.InitWithOptions(regionId, config, credential) + SetEndpointDataToClient(client) + return +} + +// NewClientWithAccessKey is a shortcut to create sdk client with accesskey +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) { + client = &Client{} + err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret) + SetEndpointDataToClient(client) + return +} + +// NewClientWithStsToken is a shortcut to create sdk client with sts token +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) { + client = &Client{} + err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy) + SetEndpointDataToClient(client) + return +} + +// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) { + client = &Client{} + err = client.InitWithEcsRamRole(regionId, roleName) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) { + client = &Client{} + err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration) + SetEndpointDataToClient(client) + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate.go new file mode 100644 index 000000000..d66808c76 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate.go @@ -0,0 +1,102 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateSSLCertificate invokes the cas.CreateSSLCertificate API synchronously +func (client *Client) CreateSSLCertificate(request *CreateSSLCertificateRequest) (response *CreateSSLCertificateResponse, err error) { + response = CreateCreateSSLCertificateResponse() + err = client.DoAction(request, response) + return +} + +// CreateSSLCertificateWithChan invokes the cas.CreateSSLCertificate API asynchronously +func (client *Client) CreateSSLCertificateWithChan(request *CreateSSLCertificateRequest) (<-chan *CreateSSLCertificateResponse, <-chan error) { + responseChan := make(chan *CreateSSLCertificateResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateSSLCertificate(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateSSLCertificateWithCallback invokes the cas.CreateSSLCertificate API asynchronously +func (client *Client) CreateSSLCertificateWithCallback(request *CreateSSLCertificateRequest, callback func(response *CreateSSLCertificateResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateSSLCertificateResponse + var err error + defer close(result) + response, err = client.CreateSSLCertificate(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateSSLCertificateRequest is the request struct for api CreateSSLCertificate +type CreateSSLCertificateRequest struct { + *requests.RpcRequest + Certificate string `position:"Query" name:"Certificate"` + PrivateKey string `position:"Query" name:"PrivateKey"` + SourceIp string `position:"Query" name:"SourceIp"` +} + +// CreateSSLCertificateResponse is the response struct for api CreateSSLCertificate +type CreateSSLCertificateResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + CertIdentifier string `json:"CertIdentifier" xml:"CertIdentifier"` +} + +// CreateCreateSSLCertificateRequest creates a request to invoke CreateSSLCertificate API +func CreateCreateSSLCertificateRequest() (request *CreateSSLCertificateRequest) { + request = &CreateSSLCertificateRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "CreateSSLCertificate", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateSSLCertificateResponse creates a response to parse from CreateSSLCertificate response +func CreateCreateSSLCertificateResponse() (response *CreateSSLCertificateResponse) { + response = &CreateSSLCertificateResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate_with_name.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate_with_name.go new file mode 100644 index 000000000..49638e454 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/create_ssl_certificate_with_name.go @@ -0,0 +1,103 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateSSLCertificateWithName invokes the cas.CreateSSLCertificateWithName API synchronously +func (client *Client) CreateSSLCertificateWithName(request *CreateSSLCertificateWithNameRequest) (response *CreateSSLCertificateWithNameResponse, err error) { + response = CreateCreateSSLCertificateWithNameResponse() + err = client.DoAction(request, response) + return +} + +// CreateSSLCertificateWithNameWithChan invokes the cas.CreateSSLCertificateWithName API asynchronously +func (client *Client) CreateSSLCertificateWithNameWithChan(request *CreateSSLCertificateWithNameRequest) (<-chan *CreateSSLCertificateWithNameResponse, <-chan error) { + responseChan := make(chan *CreateSSLCertificateWithNameResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateSSLCertificateWithName(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateSSLCertificateWithNameWithCallback invokes the cas.CreateSSLCertificateWithName API asynchronously +func (client *Client) CreateSSLCertificateWithNameWithCallback(request *CreateSSLCertificateWithNameRequest, callback func(response *CreateSSLCertificateWithNameResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateSSLCertificateWithNameResponse + var err error + defer close(result) + response, err = client.CreateSSLCertificateWithName(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateSSLCertificateWithNameRequest is the request struct for api CreateSSLCertificateWithName +type CreateSSLCertificateWithNameRequest struct { + *requests.RpcRequest + Certificate string `position:"Query" name:"Certificate"` + PrivateKey string `position:"Query" name:"PrivateKey"` + SourceIp string `position:"Query" name:"SourceIp"` + CertName string `position:"Query" name:"CertName"` +} + +// CreateSSLCertificateWithNameResponse is the response struct for api CreateSSLCertificateWithName +type CreateSSLCertificateWithNameResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + CertIdentifier string `json:"CertIdentifier" xml:"CertIdentifier"` +} + +// CreateCreateSSLCertificateWithNameRequest creates a request to invoke CreateSSLCertificateWithName API +func CreateCreateSSLCertificateWithNameRequest() (request *CreateSSLCertificateWithNameRequest) { + request = &CreateSSLCertificateWithNameRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "CreateSSLCertificateWithName", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateCreateSSLCertificateWithNameResponse creates a response to parse from CreateSSLCertificateWithName response +func CreateCreateSSLCertificateWithNameResponse() (response *CreateSSLCertificateWithNameResponse) { + response = &CreateSSLCertificateWithNameResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/delete_ssl_certificate.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/delete_ssl_certificate.go new file mode 100644 index 000000000..db322895f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/delete_ssl_certificate.go @@ -0,0 +1,100 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteSSLCertificate invokes the cas.DeleteSSLCertificate API synchronously +func (client *Client) DeleteSSLCertificate(request *DeleteSSLCertificateRequest) (response *DeleteSSLCertificateResponse, err error) { + response = CreateDeleteSSLCertificateResponse() + err = client.DoAction(request, response) + return +} + +// DeleteSSLCertificateWithChan invokes the cas.DeleteSSLCertificate API asynchronously +func (client *Client) DeleteSSLCertificateWithChan(request *DeleteSSLCertificateRequest) (<-chan *DeleteSSLCertificateResponse, <-chan error) { + responseChan := make(chan *DeleteSSLCertificateResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteSSLCertificate(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteSSLCertificateWithCallback invokes the cas.DeleteSSLCertificate API asynchronously +func (client *Client) DeleteSSLCertificateWithCallback(request *DeleteSSLCertificateRequest, callback func(response *DeleteSSLCertificateResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteSSLCertificateResponse + var err error + defer close(result) + response, err = client.DeleteSSLCertificate(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteSSLCertificateRequest is the request struct for api DeleteSSLCertificate +type DeleteSSLCertificateRequest struct { + *requests.RpcRequest + SourceIp string `position:"Query" name:"SourceIp"` + CertIdentifier string `position:"Query" name:"CertIdentifier"` +} + +// DeleteSSLCertificateResponse is the response struct for api DeleteSSLCertificate +type DeleteSSLCertificateResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteSSLCertificateRequest creates a request to invoke DeleteSSLCertificate API +func CreateDeleteSSLCertificateRequest() (request *DeleteSSLCertificateRequest) { + request = &DeleteSSLCertificateRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "DeleteSSLCertificate", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateDeleteSSLCertificateResponse creates a response to parse from DeleteSSLCertificate response +func CreateDeleteSSLCertificateResponse() (response *DeleteSSLCertificateResponse) { + response = &DeleteSSLCertificateResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_count.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_count.go new file mode 100644 index 000000000..6f3dc6e35 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_count.go @@ -0,0 +1,101 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSSLCertificateCount invokes the cas.DescribeSSLCertificateCount API synchronously +func (client *Client) DescribeSSLCertificateCount(request *DescribeSSLCertificateCountRequest) (response *DescribeSSLCertificateCountResponse, err error) { + response = CreateDescribeSSLCertificateCountResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSSLCertificateCountWithChan invokes the cas.DescribeSSLCertificateCount API asynchronously +func (client *Client) DescribeSSLCertificateCountWithChan(request *DescribeSSLCertificateCountRequest) (<-chan *DescribeSSLCertificateCountResponse, <-chan error) { + responseChan := make(chan *DescribeSSLCertificateCountResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSSLCertificateCount(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSSLCertificateCountWithCallback invokes the cas.DescribeSSLCertificateCount API asynchronously +func (client *Client) DescribeSSLCertificateCountWithCallback(request *DescribeSSLCertificateCountRequest, callback func(response *DescribeSSLCertificateCountResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSSLCertificateCountResponse + var err error + defer close(result) + response, err = client.DescribeSSLCertificateCount(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSSLCertificateCountRequest is the request struct for api DescribeSSLCertificateCount +type DescribeSSLCertificateCountRequest struct { + *requests.RpcRequest + SourceIp string `position:"Query" name:"SourceIp"` + SearchValue string `position:"Query" name:"SearchValue"` +} + +// DescribeSSLCertificateCountResponse is the response struct for api DescribeSSLCertificateCount +type DescribeSSLCertificateCountResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` +} + +// CreateDescribeSSLCertificateCountRequest creates a request to invoke DescribeSSLCertificateCount API +func CreateDescribeSSLCertificateCountRequest() (request *DescribeSSLCertificateCountRequest) { + request = &DescribeSSLCertificateCountRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "DescribeSSLCertificateCount", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeSSLCertificateCountResponse creates a response to parse from DescribeSSLCertificateCount response +func CreateDescribeSSLCertificateCountResponse() (response *DescribeSSLCertificateCountResponse) { + response = &DescribeSSLCertificateCountResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_list.go new file mode 100644 index 000000000..17a7f8659 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_list.go @@ -0,0 +1,107 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSSLCertificateList invokes the cas.DescribeSSLCertificateList API synchronously +func (client *Client) DescribeSSLCertificateList(request *DescribeSSLCertificateListRequest) (response *DescribeSSLCertificateListResponse, err error) { + response = CreateDescribeSSLCertificateListResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSSLCertificateListWithChan invokes the cas.DescribeSSLCertificateList API asynchronously +func (client *Client) DescribeSSLCertificateListWithChan(request *DescribeSSLCertificateListRequest) (<-chan *DescribeSSLCertificateListResponse, <-chan error) { + responseChan := make(chan *DescribeSSLCertificateListResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSSLCertificateList(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSSLCertificateListWithCallback invokes the cas.DescribeSSLCertificateList API asynchronously +func (client *Client) DescribeSSLCertificateListWithCallback(request *DescribeSSLCertificateListRequest, callback func(response *DescribeSSLCertificateListResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSSLCertificateListResponse + var err error + defer close(result) + response, err = client.DescribeSSLCertificateList(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSSLCertificateListRequest is the request struct for api DescribeSSLCertificateList +type DescribeSSLCertificateListRequest struct { + *requests.RpcRequest + ShowSize requests.Integer `position:"Query" name:"ShowSize"` + CurrentPage requests.Integer `position:"Query" name:"CurrentPage"` + SourceIp string `position:"Query" name:"SourceIp"` + SearchValue string `position:"Query" name:"SearchValue"` +} + +// DescribeSSLCertificateListResponse is the response struct for api DescribeSSLCertificateList +type DescribeSSLCertificateListResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + ShowSize int `json:"ShowSize" xml:"ShowSize"` + CurrentPage int `json:"CurrentPage" xml:"CurrentPage"` + PageCount int `json:"PageCount" xml:"PageCount"` + CertMetaList []CertificateInfo `json:"CertMetaList" xml:"CertMetaList"` +} + +// CreateDescribeSSLCertificateListRequest creates a request to invoke DescribeSSLCertificateList API +func CreateDescribeSSLCertificateListRequest() (request *DescribeSSLCertificateListRequest) { + request = &DescribeSSLCertificateListRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "DescribeSSLCertificateList", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeSSLCertificateListResponse creates a response to parse from DescribeSSLCertificateList response +func CreateDescribeSSLCertificateListResponse() (response *DescribeSSLCertificateListResponse) { + response = &DescribeSSLCertificateListResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_match_domain_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_match_domain_list.go new file mode 100644 index 000000000..310e0a70d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_match_domain_list.go @@ -0,0 +1,107 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSSLCertificateMatchDomainList invokes the cas.DescribeSSLCertificateMatchDomainList API synchronously +func (client *Client) DescribeSSLCertificateMatchDomainList(request *DescribeSSLCertificateMatchDomainListRequest) (response *DescribeSSLCertificateMatchDomainListResponse, err error) { + response = CreateDescribeSSLCertificateMatchDomainListResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSSLCertificateMatchDomainListWithChan invokes the cas.DescribeSSLCertificateMatchDomainList API asynchronously +func (client *Client) DescribeSSLCertificateMatchDomainListWithChan(request *DescribeSSLCertificateMatchDomainListRequest) (<-chan *DescribeSSLCertificateMatchDomainListResponse, <-chan error) { + responseChan := make(chan *DescribeSSLCertificateMatchDomainListResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSSLCertificateMatchDomainList(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSSLCertificateMatchDomainListWithCallback invokes the cas.DescribeSSLCertificateMatchDomainList API asynchronously +func (client *Client) DescribeSSLCertificateMatchDomainListWithCallback(request *DescribeSSLCertificateMatchDomainListRequest, callback func(response *DescribeSSLCertificateMatchDomainListResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSSLCertificateMatchDomainListResponse + var err error + defer close(result) + response, err = client.DescribeSSLCertificateMatchDomainList(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSSLCertificateMatchDomainListRequest is the request struct for api DescribeSSLCertificateMatchDomainList +type DescribeSSLCertificateMatchDomainListRequest struct { + *requests.RpcRequest + SourceIp string `position:"Query" name:"SourceIp"` + ShowSize requests.Integer `position:"Query" name:"ShowSize"` + CurrentPage requests.Integer `position:"Query" name:"CurrentPage"` + Domain string `position:"Query" name:"Domain"` +} + +// DescribeSSLCertificateMatchDomainListResponse is the response struct for api DescribeSSLCertificateMatchDomainList +type DescribeSSLCertificateMatchDomainListResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + ShowSize int `json:"ShowSize" xml:"ShowSize"` + CurrentPage int `json:"CurrentPage" xml:"CurrentPage"` + PageCount int `json:"PageCount" xml:"PageCount"` + CertMetaList []CertificateInfo `json:"CertMetaList" xml:"CertMetaList"` +} + +// CreateDescribeSSLCertificateMatchDomainListRequest creates a request to invoke DescribeSSLCertificateMatchDomainList API +func CreateDescribeSSLCertificateMatchDomainListRequest() (request *DescribeSSLCertificateMatchDomainListRequest) { + request = &DescribeSSLCertificateMatchDomainListRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "DescribeSSLCertificateMatchDomainList", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeSSLCertificateMatchDomainListResponse creates a response to parse from DescribeSSLCertificateMatchDomainList response +func CreateDescribeSSLCertificateMatchDomainListResponse() (response *DescribeSSLCertificateMatchDomainListResponse) { + response = &DescribeSSLCertificateMatchDomainListResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_private_key.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_private_key.go new file mode 100644 index 000000000..80d6efdbb --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_private_key.go @@ -0,0 +1,102 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSSLCertificatePrivateKey invokes the cas.DescribeSSLCertificatePrivateKey API synchronously +func (client *Client) DescribeSSLCertificatePrivateKey(request *DescribeSSLCertificatePrivateKeyRequest) (response *DescribeSSLCertificatePrivateKeyResponse, err error) { + response = CreateDescribeSSLCertificatePrivateKeyResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSSLCertificatePrivateKeyWithChan invokes the cas.DescribeSSLCertificatePrivateKey API asynchronously +func (client *Client) DescribeSSLCertificatePrivateKeyWithChan(request *DescribeSSLCertificatePrivateKeyRequest) (<-chan *DescribeSSLCertificatePrivateKeyResponse, <-chan error) { + responseChan := make(chan *DescribeSSLCertificatePrivateKeyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSSLCertificatePrivateKey(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSSLCertificatePrivateKeyWithCallback invokes the cas.DescribeSSLCertificatePrivateKey API asynchronously +func (client *Client) DescribeSSLCertificatePrivateKeyWithCallback(request *DescribeSSLCertificatePrivateKeyRequest, callback func(response *DescribeSSLCertificatePrivateKeyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSSLCertificatePrivateKeyResponse + var err error + defer close(result) + response, err = client.DescribeSSLCertificatePrivateKey(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSSLCertificatePrivateKeyRequest is the request struct for api DescribeSSLCertificatePrivateKey +type DescribeSSLCertificatePrivateKeyRequest struct { + *requests.RpcRequest + SourceIp string `position:"Query" name:"SourceIp"` + EncryptedCode string `position:"Query" name:"EncryptedCode"` + CertIdentifier string `position:"Query" name:"CertIdentifier"` +} + +// DescribeSSLCertificatePrivateKeyResponse is the response struct for api DescribeSSLCertificatePrivateKey +type DescribeSSLCertificatePrivateKeyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + X509PrivateKey string `json:"X509PrivateKey" xml:"X509PrivateKey"` +} + +// CreateDescribeSSLCertificatePrivateKeyRequest creates a request to invoke DescribeSSLCertificatePrivateKey API +func CreateDescribeSSLCertificatePrivateKeyRequest() (request *DescribeSSLCertificatePrivateKeyRequest) { + request = &DescribeSSLCertificatePrivateKeyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "DescribeSSLCertificatePrivateKey", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeSSLCertificatePrivateKeyResponse creates a response to parse from DescribeSSLCertificatePrivateKey response +func CreateDescribeSSLCertificatePrivateKeyResponse() (response *DescribeSSLCertificatePrivateKeyResponse) { + response = &DescribeSSLCertificatePrivateKeyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_public_key_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_public_key_detail.go new file mode 100644 index 000000000..7cb9516d0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/describe_ssl_certificate_public_key_detail.go @@ -0,0 +1,102 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeSSLCertificatePublicKeyDetail invokes the cas.DescribeSSLCertificatePublicKeyDetail API synchronously +func (client *Client) DescribeSSLCertificatePublicKeyDetail(request *DescribeSSLCertificatePublicKeyDetailRequest) (response *DescribeSSLCertificatePublicKeyDetailResponse, err error) { + response = CreateDescribeSSLCertificatePublicKeyDetailResponse() + err = client.DoAction(request, response) + return +} + +// DescribeSSLCertificatePublicKeyDetailWithChan invokes the cas.DescribeSSLCertificatePublicKeyDetail API asynchronously +func (client *Client) DescribeSSLCertificatePublicKeyDetailWithChan(request *DescribeSSLCertificatePublicKeyDetailRequest) (<-chan *DescribeSSLCertificatePublicKeyDetailResponse, <-chan error) { + responseChan := make(chan *DescribeSSLCertificatePublicKeyDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeSSLCertificatePublicKeyDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeSSLCertificatePublicKeyDetailWithCallback invokes the cas.DescribeSSLCertificatePublicKeyDetail API asynchronously +func (client *Client) DescribeSSLCertificatePublicKeyDetailWithCallback(request *DescribeSSLCertificatePublicKeyDetailRequest, callback func(response *DescribeSSLCertificatePublicKeyDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeSSLCertificatePublicKeyDetailResponse + var err error + defer close(result) + response, err = client.DescribeSSLCertificatePublicKeyDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeSSLCertificatePublicKeyDetailRequest is the request struct for api DescribeSSLCertificatePublicKeyDetail +type DescribeSSLCertificatePublicKeyDetailRequest struct { + *requests.RpcRequest + SourceIp string `position:"Query" name:"SourceIp"` + CertIdentifier string `position:"Query" name:"CertIdentifier"` +} + +// DescribeSSLCertificatePublicKeyDetailResponse is the response struct for api DescribeSSLCertificatePublicKeyDetail +type DescribeSSLCertificatePublicKeyDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + X509Certificate string `json:"X509Certificate" xml:"X509Certificate"` + CertificateInfo CertificateInfo `json:"CertificateInfo" xml:"CertificateInfo"` +} + +// CreateDescribeSSLCertificatePublicKeyDetailRequest creates a request to invoke DescribeSSLCertificatePublicKeyDetail API +func CreateDescribeSSLCertificatePublicKeyDetailRequest() (request *DescribeSSLCertificatePublicKeyDetailRequest) { + request = &DescribeSSLCertificatePublicKeyDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("cas", "2020-06-19", "DescribeSSLCertificatePublicKeyDetail", "cas", "openAPI") + request.Method = requests.POST + return +} + +// CreateDescribeSSLCertificatePublicKeyDetailResponse creates a response to parse from DescribeSSLCertificatePublicKeyDetail response +func CreateDescribeSSLCertificatePublicKeyDetailResponse() (response *DescribeSSLCertificatePublicKeyDetailResponse) { + response = &DescribeSSLCertificatePublicKeyDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/endpoint.go new file mode 100644 index 000000000..bb618750e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/endpoint.go @@ -0,0 +1,70 @@ +package cas + +// EndpointMap Endpoint Data +var EndpointMap map[string]string + +// EndpointType regional or central +var EndpointType = "regional" + +// GetEndpointMap Get Endpoint Data Map +func GetEndpointMap() map[string]string { + if EndpointMap == nil { + EndpointMap = map[string]string{ + "cn-shanghai-internal-test-1": "cas.aliyuncs.com", + "cn-shenzhen-su18-b01": "cas.aliyuncs.com", + "cn-beijing": "cas.aliyuncs.com", + "cn-shanghai-inner": "cas.aliyuncs.com", + "cn-hangzhou-internal-prod-1": "cas.aliyuncs.com", + "cn-north-2-gov-1": "cas.aliyuncs.com", + "cn-yushanfang": "cas.aliyuncs.com", + "cn-qingdao-nebula": "cas.aliyuncs.com", + "cn-beijing-finance-pop": "cas.aliyuncs.com", + "cn-wuhan": "cas.aliyuncs.com", + "cn-zhangjiakou": "cas.aliyuncs.com", + "us-west-1": "cas.aliyuncs.com", + "rus-west-1-pop": "cas.aliyuncs.com", + "cn-shanghai-et15-b01": "cas.aliyuncs.com", + "cn-hangzhou-bj-b01": "cas.aliyuncs.com", + "cn-zhangbei-na61-b01": "cas.aliyuncs.com", + "cn-shanghai-et2-b01": "cas.aliyuncs.com", + "ap-southeast-1": "cas.aliyuncs.com", + "ap-southeast-3": "cas.aliyuncs.com", + "ap-southeast-5": "cas.aliyuncs.com", + "us-east-1": "cas.aliyuncs.com", + "cn-shenzhen-inner": "cas.aliyuncs.com", + "cn-zhangjiakou-na62-a01": "cas.aliyuncs.com", + "cn-beijing-gov-1": "cas.aliyuncs.com", + "cn-shenzhen-st4-d01": "cas.aliyuncs.com", + "cn-haidian-cm12-c01": "cas.aliyuncs.com", + "cn-qingdao": "cas.aliyuncs.com", + "cn-hongkong-finance-pop": "cas.aliyuncs.com", + "cn-shanghai": "cas.aliyuncs.com", + "cn-shanghai-finance-1": "cas.aliyuncs.com", + "cn-hongkong": "cas.aliyuncs.com", + "cn-shenzhen": "cas.aliyuncs.com", + "cn-zhengzhou-nebula-1": "cas.aliyuncs.com", + "eu-west-1": "cas.aliyuncs.com", + "cn-hangzhou-internal-test-1": "cas.aliyuncs.com", + "eu-west-1-oxs": "cas.aliyuncs.com", + "cn-beijing-finance-1": "cas.aliyuncs.com", + "cn-hangzhou-internal-test-3": "cas.aliyuncs.com", + "cn-hangzhou-internal-test-2": "cas.aliyuncs.com", + "cn-shenzhen-finance-1": "cas.aliyuncs.com", + "cn-chengdu": "cas.aliyuncs.com", + "cn-hangzhou-test-306": "cas.aliyuncs.com", + "cn-hangzhou-finance": "cas.aliyuncs.com", + "cn-beijing-nu16-b01": "cas.aliyuncs.com", + "cn-edge-1": "cas.aliyuncs.com", + "cn-huhehaote": "cas.aliyuncs.com", + "cn-fujian": "cas.aliyuncs.com", + "ap-northeast-2-pop": "cas.aliyuncs.com", + "cn-hangzhou": "cas.aliyuncs.com", + } + } + return EndpointMap +} + +// GetEndpointType Get Endpoint Type Value +func GetEndpointType() string { + return EndpointType +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_list.go new file mode 100644 index 000000000..144f7ce7e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_list.go @@ -0,0 +1,21 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CertMetaListInDescribeSSLCertificateList is a nested struct in cas response +type CertMetaListInDescribeSSLCertificateList struct { + CertificateInfo []CertificateInfo `json:"CertificateInfo" xml:"CertificateInfo"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_match_domain_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_match_domain_list.go new file mode 100644 index 000000000..d59c6fc5b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_cert_meta_list_in_describe_ssl_certificate_match_domain_list.go @@ -0,0 +1,21 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CertMetaListInDescribeSSLCertificateMatchDomainList is a nested struct in cas response +type CertMetaListInDescribeSSLCertificateMatchDomainList struct { + CertificateInfo []CertificateInfo `json:"CertificateInfo" xml:"CertificateInfo"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_certificate_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_certificate_info.go new file mode 100644 index 000000000..e2b5b1cd3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/cas/struct_certificate_info.go @@ -0,0 +1,34 @@ +package cas + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CertificateInfo is a nested struct in cas response +type CertificateInfo struct { + CommonName string `json:"CommonName" xml:"CommonName"` + CertName string `json:"CertName" xml:"CertName"` + Issuer string `json:"Issuer" xml:"Issuer"` + Algorithm string `json:"Algorithm" xml:"Algorithm"` + CertIdentifier string `json:"CertIdentifier" xml:"CertIdentifier"` + KeySize int `json:"KeySize" xml:"KeySize"` + BeforeDate int64 `json:"BeforeDate" xml:"BeforeDate"` + Sha2 string `json:"Sha2" xml:"Sha2"` + SignAlgorithm string `json:"SignAlgorithm" xml:"SignAlgorithm"` + AfterDate int64 `json:"AfterDate" xml:"AfterDate"` + DomainMatchCert bool `json:"DomainMatchCert" xml:"DomainMatchCert"` + Md5 string `json:"Md5" xml:"Md5"` + SerialNo string `json:"SerialNo" xml:"SerialNo"` + Sans string `json:"Sans" xml:"Sans"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_app_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_app_log.go new file mode 100644 index 000000000..8eec0d209 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_app_log.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AnalyzeAppLog invokes the sls.AnalyzeAppLog API synchronously +func (client *Client) AnalyzeAppLog(request *AnalyzeAppLogRequest) (response *AnalyzeAppLogResponse, err error) { + response = CreateAnalyzeAppLogResponse() + err = client.DoAction(request, response) + return +} + +// AnalyzeAppLogWithChan invokes the sls.AnalyzeAppLog API asynchronously +func (client *Client) AnalyzeAppLogWithChan(request *AnalyzeAppLogRequest) (<-chan *AnalyzeAppLogResponse, <-chan error) { + responseChan := make(chan *AnalyzeAppLogResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AnalyzeAppLog(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AnalyzeAppLogWithCallback invokes the sls.AnalyzeAppLog API asynchronously +func (client *Client) AnalyzeAppLogWithCallback(request *AnalyzeAppLogRequest, callback func(response *AnalyzeAppLogResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AnalyzeAppLogResponse + var err error + defer close(result) + response, err = client.AnalyzeAppLog(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AnalyzeAppLogRequest is the request struct for api AnalyzeAppLog +type AnalyzeAppLogRequest struct { + *requests.RpcRequest + AppType string `position:"Query" name:"AppType"` + VariableMap string `position:"Query" name:"VariableMap"` + DisplayName string `position:"Query" name:"DisplayName"` +} + +// AnalyzeAppLogResponse is the response struct for api AnalyzeAppLog +type AnalyzeAppLogResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` +} + +// CreateAnalyzeAppLogRequest creates a request to invoke AnalyzeAppLog API +func CreateAnalyzeAppLogRequest() (request *AnalyzeAppLogRequest) { + request = &AnalyzeAppLogRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "AnalyzeAppLog", "", "") + request.Method = requests.POST + return +} + +// CreateAnalyzeAppLogResponse creates a response to parse from AnalyzeAppLog response +func CreateAnalyzeAppLogResponse() (response *AnalyzeAppLogResponse) { + response = &AnalyzeAppLogResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go new file mode 100644 index 000000000..abdea785a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/analyze_product_log.go @@ -0,0 +1,111 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AnalyzeProductLog invokes the sls.AnalyzeProductLog API synchronously +func (client *Client) AnalyzeProductLog(request *AnalyzeProductLogRequest) (response *AnalyzeProductLogResponse, err error) { + response = CreateAnalyzeProductLogResponse() + err = client.DoAction(request, response) + return +} + +// AnalyzeProductLogWithChan invokes the sls.AnalyzeProductLog API asynchronously +func (client *Client) AnalyzeProductLogWithChan(request *AnalyzeProductLogRequest) (<-chan *AnalyzeProductLogResponse, <-chan error) { + responseChan := make(chan *AnalyzeProductLogResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AnalyzeProductLog(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AnalyzeProductLogWithCallback invokes the sls.AnalyzeProductLog API asynchronously +func (client *Client) AnalyzeProductLogWithCallback(request *AnalyzeProductLogRequest, callback func(response *AnalyzeProductLogResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AnalyzeProductLogResponse + var err error + defer close(result) + response, err = client.AnalyzeProductLog(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AnalyzeProductLogRequest is the request struct for api AnalyzeProductLog +type AnalyzeProductLogRequest struct { + *requests.RpcRequest + Project string `position:"Query" name:"Project"` + CloudProduct string `position:"Query" name:"CloudProduct"` + ResourceQuota string `position:"Query" name:"ResourceQuota"` + VariableMap string `position:"Query" name:"VariableMap"` + TTL requests.Integer `position:"Query" name:"TTL"` + ClientIp string `position:"Query" name:"ClientIp"` + Region string `position:"Query" name:"Region"` + Lang string `position:"Query" name:"Lang"` + Logstore string `position:"Query" name:"Logstore"` + Overwrite requests.Boolean `position:"Query" name:"Overwrite"` +} + +// AnalyzeProductLogResponse is the response struct for api AnalyzeProductLog +type AnalyzeProductLogResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` +} + +// CreateAnalyzeProductLogRequest creates a request to invoke AnalyzeProductLog API +func CreateAnalyzeProductLogRequest() (request *AnalyzeProductLogRequest) { + request = &AnalyzeProductLogRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2018-06-13", "AnalyzeProductLog", "", "") + request.Method = requests.POST + return +} + +// CreateAnalyzeProductLogResponse creates a response to parse from AnalyzeProductLog response +func CreateAnalyzeProductLogResponse() (response *AnalyzeProductLogResponse) { + response = &AnalyzeProductLogResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/check_resource_orchestration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/check_resource_orchestration.go new file mode 100644 index 000000000..3c6e1718d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/check_resource_orchestration.go @@ -0,0 +1,105 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CheckResourceOrchestration invokes the sls.CheckResourceOrchestration API synchronously +func (client *Client) CheckResourceOrchestration(request *CheckResourceOrchestrationRequest) (response *CheckResourceOrchestrationResponse, err error) { + response = CreateCheckResourceOrchestrationResponse() + err = client.DoAction(request, response) + return +} + +// CheckResourceOrchestrationWithChan invokes the sls.CheckResourceOrchestration API asynchronously +func (client *Client) CheckResourceOrchestrationWithChan(request *CheckResourceOrchestrationRequest) (<-chan *CheckResourceOrchestrationResponse, <-chan error) { + responseChan := make(chan *CheckResourceOrchestrationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CheckResourceOrchestration(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CheckResourceOrchestrationWithCallback invokes the sls.CheckResourceOrchestration API asynchronously +func (client *Client) CheckResourceOrchestrationWithCallback(request *CheckResourceOrchestrationRequest, callback func(response *CheckResourceOrchestrationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CheckResourceOrchestrationResponse + var err error + defer close(result) + response, err = client.CheckResourceOrchestration(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CheckResourceOrchestrationRequest is the request struct for api CheckResourceOrchestration +type CheckResourceOrchestrationRequest struct { + *requests.RpcRequest + Language string `position:"Query" name:"Language"` + OperationPolicy string `position:"Query" name:"OperationPolicy"` + AssetsId string `position:"Query" name:"AssetsId"` +} + +// CheckResourceOrchestrationResponse is the response struct for api CheckResourceOrchestration +type CheckResourceOrchestrationResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + Data string `json:"Data" xml:"Data"` +} + +// CreateCheckResourceOrchestrationRequest creates a request to invoke CheckResourceOrchestration API +func CreateCheckResourceOrchestrationRequest() (request *CheckResourceOrchestrationRequest) { + request = &CheckResourceOrchestrationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "CheckResourceOrchestration", "", "") + request.Method = requests.POST + return +} + +// CreateCheckResourceOrchestrationResponse creates a response to parse from CheckResourceOrchestration response +func CreateCheckResourceOrchestrationResponse() (response *CheckResourceOrchestrationResponse) { + response = &CheckResourceOrchestrationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/client.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/client.go new file mode 100644 index 000000000..ff3e180a3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/client.go @@ -0,0 +1,129 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "reflect" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider" +) + +// Client is the sdk client struct, each func corresponds to an OpenAPI +type Client struct { + sdk.Client +} + +// SetClientProperty Set Property by Reflect +func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) { + v := reflect.ValueOf(client).Elem() + if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() { + v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue)) + } +} + +// SetEndpointDataToClient Set EndpointMap and ENdpointType +func SetEndpointDataToClient(client *Client) { + SetClientProperty(client, "EndpointMap", GetEndpointMap()) + SetClientProperty(client, "EndpointType", GetEndpointType()) +} + +// NewClient creates a sdk client with environment variables +func NewClient() (client *Client, err error) { + client = &Client{} + err = client.Init() + SetEndpointDataToClient(client) + return +} + +// NewClientWithProvider creates a sdk client with providers +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) { + client = &Client{} + var pc provider.Provider + if len(providers) == 0 { + pc = provider.DefaultChain + } else { + pc = provider.NewProviderChain(providers) + } + err = client.InitWithProviderChain(regionId, pc) + SetEndpointDataToClient(client) + return +} + +// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential +// this is the common api to create a sdk client +func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) { + client = &Client{} + err = client.InitWithOptions(regionId, config, credential) + SetEndpointDataToClient(client) + return +} + +// NewClientWithAccessKey is a shortcut to create sdk client with accesskey +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) { + client = &Client{} + err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret) + SetEndpointDataToClient(client) + return +} + +// NewClientWithStsToken is a shortcut to create sdk client with sts token +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) { + client = &Client{} + err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy) + SetEndpointDataToClient(client) + return +} + +// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) { + client = &Client{} + err = client.InitWithEcsRamRole(regionId, roleName) + SetEndpointDataToClient(client) + return +} + +// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair +// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md +func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) { + client = &Client{} + err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration) + SetEndpointDataToClient(client) + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go new file mode 100644 index 000000000..e2e61abc0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_app.go @@ -0,0 +1,105 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateApp invokes the sls.CreateApp API synchronously +func (client *Client) CreateApp(request *CreateAppRequest) (response *CreateAppResponse, err error) { + response = CreateCreateAppResponse() + err = client.DoAction(request, response) + return +} + +// CreateAppWithChan invokes the sls.CreateApp API asynchronously +func (client *Client) CreateAppWithChan(request *CreateAppRequest) (<-chan *CreateAppResponse, <-chan error) { + responseChan := make(chan *CreateAppResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateApp(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateAppWithCallback invokes the sls.CreateApp API asynchronously +func (client *Client) CreateAppWithCallback(request *CreateAppRequest, callback func(response *CreateAppResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateAppResponse + var err error + defer close(result) + response, err = client.CreateApp(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateAppRequest is the request struct for api CreateApp +type CreateAppRequest struct { + *requests.RpcRequest + AppName string `position:"Query" name:"AppName"` + DisplayName string `position:"Query" name:"DisplayName"` + Config string `position:"Body" name:"Config"` +} + +// CreateAppResponse is the response struct for api CreateApp +type CreateAppResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` + AppName string `json:"AppName" xml:"AppName"` +} + +// CreateCreateAppRequest creates a request to invoke CreateApp API +func CreateCreateAppRequest() (request *CreateAppRequest) { + request = &CreateAppRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "CreateApp", "", "") + request.Method = requests.POST + return +} + +// CreateCreateAppResponse creates a response to parse from CreateApp response +func CreateCreateAppResponse() (response *CreateAppResponse) { + response = &CreateAppResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_resource_orchestration.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_resource_orchestration.go new file mode 100644 index 000000000..dac054e5e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/create_resource_orchestration.go @@ -0,0 +1,106 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateResourceOrchestration invokes the sls.CreateResourceOrchestration API synchronously +func (client *Client) CreateResourceOrchestration(request *CreateResourceOrchestrationRequest) (response *CreateResourceOrchestrationResponse, err error) { + response = CreateCreateResourceOrchestrationResponse() + err = client.DoAction(request, response) + return +} + +// CreateResourceOrchestrationWithChan invokes the sls.CreateResourceOrchestration API asynchronously +func (client *Client) CreateResourceOrchestrationWithChan(request *CreateResourceOrchestrationRequest) (<-chan *CreateResourceOrchestrationResponse, <-chan error) { + responseChan := make(chan *CreateResourceOrchestrationResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateResourceOrchestration(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateResourceOrchestrationWithCallback invokes the sls.CreateResourceOrchestration API asynchronously +func (client *Client) CreateResourceOrchestrationWithCallback(request *CreateResourceOrchestrationRequest, callback func(response *CreateResourceOrchestrationResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateResourceOrchestrationResponse + var err error + defer close(result) + response, err = client.CreateResourceOrchestration(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateResourceOrchestrationRequest is the request struct for api CreateResourceOrchestration +type CreateResourceOrchestrationRequest struct { + *requests.RpcRequest + Language string `position:"Query" name:"Language"` + OperationPolicy string `position:"Query" name:"OperationPolicy"` + Tokens string `position:"Query" name:"Tokens"` + AssetsId string `position:"Query" name:"AssetsId"` +} + +// CreateResourceOrchestrationResponse is the response struct for api CreateResourceOrchestration +type CreateResourceOrchestrationResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` + Data string `json:"Data" xml:"Data"` +} + +// CreateCreateResourceOrchestrationRequest creates a request to invoke CreateResourceOrchestration API +func CreateCreateResourceOrchestrationRequest() (request *CreateResourceOrchestrationRequest) { + request = &CreateResourceOrchestrationRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "CreateResourceOrchestration", "", "") + request.Method = requests.POST + return +} + +// CreateCreateResourceOrchestrationResponse creates a response to parse from CreateResourceOrchestration response +func CreateCreateResourceOrchestrationResponse() (response *CreateResourceOrchestrationResponse) { + response = &CreateResourceOrchestrationResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go new file mode 100644 index 000000000..b2ac92465 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_app.go @@ -0,0 +1,102 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteApp invokes the sls.DeleteApp API synchronously +func (client *Client) DeleteApp(request *DeleteAppRequest) (response *DeleteAppResponse, err error) { + response = CreateDeleteAppResponse() + err = client.DoAction(request, response) + return +} + +// DeleteAppWithChan invokes the sls.DeleteApp API asynchronously +func (client *Client) DeleteAppWithChan(request *DeleteAppRequest) (<-chan *DeleteAppResponse, <-chan error) { + responseChan := make(chan *DeleteAppResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteApp(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteAppWithCallback invokes the sls.DeleteApp API asynchronously +func (client *Client) DeleteAppWithCallback(request *DeleteAppRequest, callback func(response *DeleteAppResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteAppResponse + var err error + defer close(result) + response, err = client.DeleteApp(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteAppRequest is the request struct for api DeleteApp +type DeleteAppRequest struct { + *requests.RpcRequest + AppName string `position:"Query" name:"AppName"` +} + +// DeleteAppResponse is the response struct for api DeleteApp +type DeleteAppResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteAppRequest creates a request to invoke DeleteApp API +func CreateDeleteAppRequest() (request *DeleteAppRequest) { + request = &DeleteAppRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "DeleteApp", "", "") + request.Method = requests.POST + return +} + +// CreateDeleteAppResponse creates a response to parse from DeleteApp response +func CreateDeleteAppResponse() (response *DeleteAppResponse) { + response = &DeleteAppResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go new file mode 100644 index 000000000..180c61de6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/delete_log_resource.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteLogResource invokes the sls.DeleteLogResource API synchronously +func (client *Client) DeleteLogResource(request *DeleteLogResourceRequest) (response *DeleteLogResourceResponse, err error) { + response = CreateDeleteLogResourceResponse() + err = client.DoAction(request, response) + return +} + +// DeleteLogResourceWithChan invokes the sls.DeleteLogResource API asynchronously +func (client *Client) DeleteLogResourceWithChan(request *DeleteLogResourceRequest) (<-chan *DeleteLogResourceResponse, <-chan error) { + responseChan := make(chan *DeleteLogResourceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteLogResource(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteLogResourceWithCallback invokes the sls.DeleteLogResource API asynchronously +func (client *Client) DeleteLogResourceWithCallback(request *DeleteLogResourceRequest, callback func(response *DeleteLogResourceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteLogResourceResponse + var err error + defer close(result) + response, err = client.DeleteLogResource(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteLogResourceRequest is the request struct for api DeleteLogResource +type DeleteLogResourceRequest struct { + *requests.RpcRequest + Project string `position:"Query" name:"Project"` + Region string `position:"Query" name:"Region"` + Logstore string `position:"Query" name:"Logstore"` +} + +// DeleteLogResourceResponse is the response struct for api DeleteLogResource +type DeleteLogResourceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` +} + +// CreateDeleteLogResourceRequest creates a request to invoke DeleteLogResource API +func CreateDeleteLogResourceRequest() (request *DeleteLogResourceRequest) { + request = &DeleteLogResourceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2018-06-13", "DeleteLogResource", "", "") + request.Method = requests.POST + return +} + +// CreateDeleteLogResourceResponse creates a response to parse from DeleteLogResource response +func CreateDeleteLogResourceResponse() (response *DeleteLogResourceResponse) { + response = &DeleteLogResourceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go new file mode 100644 index 000000000..95cb89fe4 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/describe_app.go @@ -0,0 +1,103 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeApp invokes the sls.DescribeApp API synchronously +func (client *Client) DescribeApp(request *DescribeAppRequest) (response *DescribeAppResponse, err error) { + response = CreateDescribeAppResponse() + err = client.DoAction(request, response) + return +} + +// DescribeAppWithChan invokes the sls.DescribeApp API asynchronously +func (client *Client) DescribeAppWithChan(request *DescribeAppRequest) (<-chan *DescribeAppResponse, <-chan error) { + responseChan := make(chan *DescribeAppResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeApp(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeAppWithCallback invokes the sls.DescribeApp API asynchronously +func (client *Client) DescribeAppWithCallback(request *DescribeAppRequest, callback func(response *DescribeAppResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeAppResponse + var err error + defer close(result) + response, err = client.DescribeApp(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeAppRequest is the request struct for api DescribeApp +type DescribeAppRequest struct { + *requests.RpcRequest + AppName string `position:"Query" name:"AppName"` +} + +// DescribeAppResponse is the response struct for api DescribeApp +type DescribeAppResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` + AppModel AppModel `json:"AppModel" xml:"AppModel"` +} + +// CreateDescribeAppRequest creates a request to invoke DescribeApp API +func CreateDescribeAppRequest() (request *DescribeAppRequest) { + request = &DescribeAppRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "DescribeApp", "", "") + request.Method = requests.POST + return +} + +// CreateDescribeAppResponse creates a response to parse from DescribeApp response +func CreateDescribeAppResponse() (response *DescribeAppResponse) { + response = &DescribeAppResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/disable_alert.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/disable_alert.go new file mode 100644 index 000000000..581e45c08 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/disable_alert.go @@ -0,0 +1,105 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DisableAlert invokes the sls.DisableAlert API synchronously +func (client *Client) DisableAlert(request *DisableAlertRequest) (response *DisableAlertResponse, err error) { + response = CreateDisableAlertResponse() + err = client.DoAction(request, response) + return +} + +// DisableAlertWithChan invokes the sls.DisableAlert API asynchronously +func (client *Client) DisableAlertWithChan(request *DisableAlertRequest) (<-chan *DisableAlertResponse, <-chan error) { + responseChan := make(chan *DisableAlertResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DisableAlert(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DisableAlertWithCallback invokes the sls.DisableAlert API asynchronously +func (client *Client) DisableAlertWithCallback(request *DisableAlertRequest, callback func(response *DisableAlertResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DisableAlertResponse + var err error + defer close(result) + response, err = client.DisableAlert(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DisableAlertRequest is the request struct for api DisableAlert +type DisableAlertRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + ProjectName string `position:"Body" name:"ProjectName"` + Endpoint string `position:"Body" name:"Endpoint"` + AlertId string `position:"Body" name:"AlertId"` +} + +// DisableAlertResponse is the response struct for api DisableAlert +type DisableAlertResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateDisableAlertRequest creates a request to invoke DisableAlert API +func CreateDisableAlertRequest() (request *DisableAlertRequest) { + request = &DisableAlertRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "DisableAlert", "", "") + request.Method = requests.POST + return +} + +// CreateDisableAlertResponse creates a response to parse from DisableAlert response +func CreateDisableAlertResponse() (response *DisableAlertResponse) { + response = &DisableAlertResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/enable_alert.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/enable_alert.go new file mode 100644 index 000000000..59fa95aa6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/enable_alert.go @@ -0,0 +1,110 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// EnableAlert invokes the sls.EnableAlert API synchronously +func (client *Client) EnableAlert(request *EnableAlertRequest) (response *EnableAlertResponse, err error) { + response = CreateEnableAlertResponse() + err = client.DoAction(request, response) + return +} + +// EnableAlertWithChan invokes the sls.EnableAlert API asynchronously +func (client *Client) EnableAlertWithChan(request *EnableAlertRequest) (<-chan *EnableAlertResponse, <-chan error) { + responseChan := make(chan *EnableAlertResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.EnableAlert(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// EnableAlertWithCallback invokes the sls.EnableAlert API asynchronously +func (client *Client) EnableAlertWithCallback(request *EnableAlertRequest, callback func(response *EnableAlertResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *EnableAlertResponse + var err error + defer close(result) + response, err = client.EnableAlert(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// EnableAlertRequest is the request struct for api EnableAlert +type EnableAlertRequest struct { + *requests.RpcRequest + Language string `position:"Body" name:"Language"` + RuleVersion string `position:"Body" name:"RuleVersion"` + Endpoint string `position:"Body" name:"Endpoint"` + Tokens string `position:"Body" name:"Tokens"` + App string `position:"Body" name:"App"` + ProjectName string `position:"Body" name:"ProjectName"` + AlertId string `position:"Body" name:"AlertId"` + RuleId string `position:"Body" name:"RuleId"` + Region string `position:"Body" name:"Region"` +} + +// EnableAlertResponse is the response struct for api EnableAlert +type EnableAlertResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` +} + +// CreateEnableAlertRequest creates a request to invoke EnableAlert API +func CreateEnableAlertRequest() (request *EnableAlertRequest) { + request = &EnableAlertRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "EnableAlert", "", "") + request.Method = requests.POST + return +} + +// CreateEnableAlertResponse creates a response to parse from EnableAlert response +func CreateEnableAlertResponse() (response *EnableAlertResponse) { + response = &EnableAlertResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/endpoint.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/endpoint.go new file mode 100644 index 000000000..10a4fe052 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/endpoint.go @@ -0,0 +1,29 @@ +package sls + +// EndpointMap Endpoint Data +var EndpointMap map[string]string + +// EndpointType regional or central +var EndpointType = "central" + +// GetEndpointMap Get Endpoint Data Map +func GetEndpointMap() map[string]string { + if EndpointMap == nil { + EndpointMap = map[string]string{ + "cn-shenzhen": "sls.cn-shenzhen.aliyuncs.com", + "cn-shanghai": "sls.cn-shanghai.aliyuncs.com", + "cn-hongkong": "sls.cn-hongkong.aliyuncs.com", + "ap-southeast-1": "sls.ap-southeast-1.aliyuncs.com", + "eu-central-1": "sls.eu-central-1.aliyuncs.com", + "cn-huhehaote": "sls.cn-huhehaote.aliyuncs.com", + "cn-zhangjiakou": "sls.cn-zhangjiakou.aliyuncs.com", + "cn-hangzhou": "sls.cn-hangzhou.aliyuncs.com", + } + } + return EndpointMap +} + +// GetEndpointType Get Endpoint Type Value +func GetEndpointType() string { + return EndpointType +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert.go new file mode 100644 index 000000000..537d232db --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert.go @@ -0,0 +1,106 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetAlert invokes the sls.GetAlert API synchronously +func (client *Client) GetAlert(request *GetAlertRequest) (response *GetAlertResponse, err error) { + response = CreateGetAlertResponse() + err = client.DoAction(request, response) + return +} + +// GetAlertWithChan invokes the sls.GetAlert API asynchronously +func (client *Client) GetAlertWithChan(request *GetAlertRequest) (<-chan *GetAlertResponse, <-chan error) { + responseChan := make(chan *GetAlertResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetAlert(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetAlertWithCallback invokes the sls.GetAlert API asynchronously +func (client *Client) GetAlertWithCallback(request *GetAlertRequest, callback func(response *GetAlertResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetAlertResponse + var err error + defer close(result) + response, err = client.GetAlert(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetAlertRequest is the request struct for api GetAlert +type GetAlertRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + ProjectName string `position:"Body" name:"ProjectName"` + Endpoint string `position:"Body" name:"Endpoint"` + AlertId string `position:"Body" name:"AlertId"` +} + +// GetAlertResponse is the response struct for api GetAlert +type GetAlertResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Success bool `json:"Success" xml:"Success"` + Data string `json:"Data" xml:"Data"` +} + +// CreateGetAlertRequest creates a request to invoke GetAlert API +func CreateGetAlertRequest() (request *GetAlertRequest) { + request = &GetAlertRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "GetAlert", "", "") + request.Method = requests.POST + return +} + +// CreateGetAlertResponse creates a response to parse from GetAlert response +func CreateGetAlertResponse() (response *GetAlertResponse) { + response = &GetAlertResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert_histories.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert_histories.go new file mode 100644 index 000000000..ee50327e6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_alert_histories.go @@ -0,0 +1,111 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetAlertHistories invokes the sls.GetAlertHistories API synchronously +func (client *Client) GetAlertHistories(request *GetAlertHistoriesRequest) (response *GetAlertHistoriesResponse, err error) { + response = CreateGetAlertHistoriesResponse() + err = client.DoAction(request, response) + return +} + +// GetAlertHistoriesWithChan invokes the sls.GetAlertHistories API asynchronously +func (client *Client) GetAlertHistoriesWithChan(request *GetAlertHistoriesRequest) (<-chan *GetAlertHistoriesResponse, <-chan error) { + responseChan := make(chan *GetAlertHistoriesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetAlertHistories(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetAlertHistoriesWithCallback invokes the sls.GetAlertHistories API asynchronously +func (client *Client) GetAlertHistoriesWithCallback(request *GetAlertHistoriesRequest, callback func(response *GetAlertHistoriesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetAlertHistoriesResponse + var err error + defer close(result) + response, err = client.GetAlertHistories(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetAlertHistoriesRequest is the request struct for api GetAlertHistories +type GetAlertHistoriesRequest struct { + *requests.RpcRequest + Line requests.Integer `position:"Body" name:"Line"` + ToTs requests.Integer `position:"Body" name:"ToTs"` + Endpoint string `position:"Body" name:"Endpoint"` + App string `position:"Body" name:"App"` + FromTs requests.Integer `position:"Body" name:"FromTs"` + ProjectName string `position:"Body" name:"ProjectName"` + Offset requests.Integer `position:"Body" name:"Offset"` + AlertId string `position:"Body" name:"AlertId"` + Region string `position:"Body" name:"Region"` +} + +// GetAlertHistoriesResponse is the response struct for api GetAlertHistories +type GetAlertHistoriesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data string `json:"Data" xml:"Data"` +} + +// CreateGetAlertHistoriesRequest creates a request to invoke GetAlertHistories API +func CreateGetAlertHistoriesRequest() (request *GetAlertHistoriesRequest) { + request = &GetAlertHistoriesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "GetAlertHistories", "", "") + request.Method = requests.POST + return +} + +// CreateGetAlertHistoriesResponse creates a response to parse from GetAlertHistories response +func CreateGetAlertHistoriesResponse() (response *GetAlertHistoriesResponse) { + response = &GetAlertHistoriesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_sls_service.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_sls_service.go new file mode 100644 index 000000000..382df4fd8 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/get_sls_service.go @@ -0,0 +1,102 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// GetSlsService invokes the sls.GetSlsService API synchronously +func (client *Client) GetSlsService(request *GetSlsServiceRequest) (response *GetSlsServiceResponse, err error) { + response = CreateGetSlsServiceResponse() + err = client.DoAction(request, response) + return +} + +// GetSlsServiceWithChan invokes the sls.GetSlsService API asynchronously +func (client *Client) GetSlsServiceWithChan(request *GetSlsServiceRequest) (<-chan *GetSlsServiceResponse, <-chan error) { + responseChan := make(chan *GetSlsServiceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.GetSlsService(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// GetSlsServiceWithCallback invokes the sls.GetSlsService API asynchronously +func (client *Client) GetSlsServiceWithCallback(request *GetSlsServiceRequest, callback func(response *GetSlsServiceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *GetSlsServiceResponse + var err error + defer close(result) + response, err = client.GetSlsService(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// GetSlsServiceRequest is the request struct for api GetSlsService +type GetSlsServiceRequest struct { + *requests.RpcRequest +} + +// GetSlsServiceResponse is the response struct for api GetSlsService +type GetSlsServiceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Enabled bool `json:"Enabled" xml:"Enabled"` + Code string `json:"Code" xml:"Code"` +} + +// CreateGetSlsServiceRequest creates a request to invoke GetSlsService API +func CreateGetSlsServiceRequest() (request *GetSlsServiceRequest) { + request = &GetSlsServiceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "GetSlsService", "", "") + request.Method = requests.POST + return +} + +// CreateGetSlsServiceResponse creates a response to parse from GetSlsService response +func CreateGetSlsServiceResponse() (response *GetSlsServiceResponse) { + response = &GetSlsServiceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/open_sls_service.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/open_sls_service.go new file mode 100644 index 000000000..f6c6b2913 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/open_sls_service.go @@ -0,0 +1,101 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// OpenSlsService invokes the sls.OpenSlsService API synchronously +func (client *Client) OpenSlsService(request *OpenSlsServiceRequest) (response *OpenSlsServiceResponse, err error) { + response = CreateOpenSlsServiceResponse() + err = client.DoAction(request, response) + return +} + +// OpenSlsServiceWithChan invokes the sls.OpenSlsService API asynchronously +func (client *Client) OpenSlsServiceWithChan(request *OpenSlsServiceRequest) (<-chan *OpenSlsServiceResponse, <-chan error) { + responseChan := make(chan *OpenSlsServiceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.OpenSlsService(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// OpenSlsServiceWithCallback invokes the sls.OpenSlsService API asynchronously +func (client *Client) OpenSlsServiceWithCallback(request *OpenSlsServiceRequest, callback func(response *OpenSlsServiceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *OpenSlsServiceResponse + var err error + defer close(result) + response, err = client.OpenSlsService(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// OpenSlsServiceRequest is the request struct for api OpenSlsService +type OpenSlsServiceRequest struct { + *requests.RpcRequest +} + +// OpenSlsServiceResponse is the response struct for api OpenSlsService +type OpenSlsServiceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` +} + +// CreateOpenSlsServiceRequest creates a request to invoke OpenSlsService API +func CreateOpenSlsServiceRequest() (request *OpenSlsServiceRequest) { + request = &OpenSlsServiceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "OpenSlsService", "", "") + request.Method = requests.POST + return +} + +// CreateOpenSlsServiceResponse creates a response to parse from OpenSlsService response +func CreateOpenSlsServiceResponse() (response *OpenSlsServiceResponse) { + response = &OpenSlsServiceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/query_saf_service.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/query_saf_service.go new file mode 100644 index 000000000..8bfc7a4cf --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/query_saf_service.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// QuerySafService invokes the sls.QuerySafService API synchronously +func (client *Client) QuerySafService(request *QuerySafServiceRequest) (response *QuerySafServiceResponse, err error) { + response = CreateQuerySafServiceResponse() + err = client.DoAction(request, response) + return +} + +// QuerySafServiceWithChan invokes the sls.QuerySafService API asynchronously +func (client *Client) QuerySafServiceWithChan(request *QuerySafServiceRequest) (<-chan *QuerySafServiceResponse, <-chan error) { + responseChan := make(chan *QuerySafServiceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.QuerySafService(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// QuerySafServiceWithCallback invokes the sls.QuerySafService API asynchronously +func (client *Client) QuerySafServiceWithCallback(request *QuerySafServiceRequest, callback func(response *QuerySafServiceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *QuerySafServiceResponse + var err error + defer close(result) + response, err = client.QuerySafService(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// QuerySafServiceRequest is the request struct for api QuerySafService +type QuerySafServiceRequest struct { + *requests.RpcRequest + ParamType string `position:"Query" name:"ParamType"` + ProjectName string `position:"Query" name:"ProjectName"` + ParamValue string `position:"Query" name:"ParamValue"` +} + +// QuerySafServiceResponse is the response struct for api QuerySafService +type QuerySafServiceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Code string `json:"Code" xml:"Code"` + Score string `json:"Score" xml:"Score"` + Ext map[string]interface{} `json:"Ext" xml:"Ext"` +} + +// CreateQuerySafServiceRequest creates a request to invoke QuerySafService API +func CreateQuerySafServiceRequest() (request *QuerySafServiceRequest) { + request = &QuerySafServiceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "QuerySafService", "", "") + request.Method = requests.POST + return +} + +// CreateQuerySafServiceResponse creates a response to parse from QuerySafService response +func CreateQuerySafServiceResponse() (response *QuerySafServiceResponse) { + response = &QuerySafServiceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go new file mode 100644 index 000000000..c3ca142a8 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_action_policy.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SetAlertActionPolicy invokes the sls.SetAlertActionPolicy API synchronously +func (client *Client) SetAlertActionPolicy(request *SetAlertActionPolicyRequest) (response *SetAlertActionPolicyResponse, err error) { + response = CreateSetAlertActionPolicyResponse() + err = client.DoAction(request, response) + return +} + +// SetAlertActionPolicyWithChan invokes the sls.SetAlertActionPolicy API asynchronously +func (client *Client) SetAlertActionPolicyWithChan(request *SetAlertActionPolicyRequest) (<-chan *SetAlertActionPolicyResponse, <-chan error) { + responseChan := make(chan *SetAlertActionPolicyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SetAlertActionPolicy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SetAlertActionPolicyWithCallback invokes the sls.SetAlertActionPolicy API asynchronously +func (client *Client) SetAlertActionPolicyWithCallback(request *SetAlertActionPolicyRequest, callback func(response *SetAlertActionPolicyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SetAlertActionPolicyResponse + var err error + defer close(result) + response, err = client.SetAlertActionPolicy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SetAlertActionPolicyRequest is the request struct for api SetAlertActionPolicy +type SetAlertActionPolicyRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + PolicyId string `position:"Body" name:"PolicyId"` + Policy string `position:"Body" name:"Policy"` +} + +// SetAlertActionPolicyResponse is the response struct for api SetAlertActionPolicy +type SetAlertActionPolicyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` +} + +// CreateSetAlertActionPolicyRequest creates a request to invoke SetAlertActionPolicy API +func CreateSetAlertActionPolicyRequest() (request *SetAlertActionPolicyRequest) { + request = &SetAlertActionPolicyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "SetAlertActionPolicy", "", "") + request.Method = requests.POST + return +} + +// CreateSetAlertActionPolicyResponse creates a response to parse from SetAlertActionPolicy response +func CreateSetAlertActionPolicyResponse() (response *SetAlertActionPolicyResponse) { + response = &SetAlertActionPolicyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource.go new file mode 100644 index 000000000..495b95d21 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/set_alert_center_resource.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SetAlertCenterResource invokes the sls.SetAlertCenterResource API synchronously +func (client *Client) SetAlertCenterResource(request *SetAlertCenterResourceRequest) (response *SetAlertCenterResourceResponse, err error) { + response = CreateSetAlertCenterResourceResponse() + err = client.DoAction(request, response) + return +} + +// SetAlertCenterResourceWithChan invokes the sls.SetAlertCenterResource API asynchronously +func (client *Client) SetAlertCenterResourceWithChan(request *SetAlertCenterResourceRequest) (<-chan *SetAlertCenterResourceResponse, <-chan error) { + responseChan := make(chan *SetAlertCenterResourceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SetAlertCenterResource(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SetAlertCenterResourceWithCallback invokes the sls.SetAlertCenterResource API asynchronously +func (client *Client) SetAlertCenterResourceWithCallback(request *SetAlertCenterResourceRequest, callback func(response *SetAlertCenterResourceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SetAlertCenterResourceResponse + var err error + defer close(result) + response, err = client.SetAlertCenterResource(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SetAlertCenterResourceRequest is the request struct for api SetAlertCenterResource +type SetAlertCenterResourceRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + Language string `position:"Body" name:"Language"` + Region string `position:"Body" name:"Region"` +} + +// SetAlertCenterResourceResponse is the response struct for api SetAlertCenterResource +type SetAlertCenterResourceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + Code string `json:"Code" xml:"Code"` +} + +// CreateSetAlertCenterResourceRequest creates a request to invoke SetAlertCenterResource API +func CreateSetAlertCenterResourceRequest() (request *SetAlertCenterResourceRequest) { + request = &SetAlertCenterResourceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "SetAlertCenterResource", "", "") + request.Method = requests.POST + return +} + +// CreateSetAlertCenterResourceResponse creates a response to parse from SetAlertCenterResource response +func CreateSetAlertCenterResourceResponse() (response *SetAlertCenterResourceResponse) { + response = &SetAlertCenterResourceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/struct_app_model.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/struct_app_model.go new file mode 100644 index 000000000..d04d6ee99 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/struct_app_model.go @@ -0,0 +1,24 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AppModel is a nested struct in sls response +type AppModel struct { + Uid int64 `json:"Uid" xml:"Uid"` + AppName string `json:"AppName" xml:"AppName"` + Config string `json:"Config" xml:"Config"` + DisplayName string `json:"DisplayName" xml:"DisplayName"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_groups.go new file mode 100644 index 000000000..513454c7b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_groups.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SyncAlertGroups invokes the sls.SyncAlertGroups API synchronously +func (client *Client) SyncAlertGroups(request *SyncAlertGroupsRequest) (response *SyncAlertGroupsResponse, err error) { + response = CreateSyncAlertGroupsResponse() + err = client.DoAction(request, response) + return +} + +// SyncAlertGroupsWithChan invokes the sls.SyncAlertGroups API asynchronously +func (client *Client) SyncAlertGroupsWithChan(request *SyncAlertGroupsRequest) (<-chan *SyncAlertGroupsResponse, <-chan error) { + responseChan := make(chan *SyncAlertGroupsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SyncAlertGroups(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SyncAlertGroupsWithCallback invokes the sls.SyncAlertGroups API asynchronously +func (client *Client) SyncAlertGroupsWithCallback(request *SyncAlertGroupsRequest, callback func(response *SyncAlertGroupsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SyncAlertGroupsResponse + var err error + defer close(result) + response, err = client.SyncAlertGroups(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SyncAlertGroupsRequest is the request struct for api SyncAlertGroups +type SyncAlertGroupsRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + Groups string `position:"Body" name:"Groups"` +} + +// SyncAlertGroupsResponse is the response struct for api SyncAlertGroups +type SyncAlertGroupsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + Message string `json:"Message" xml:"Message"` + Data string `json:"Data" xml:"Data"` +} + +// CreateSyncAlertGroupsRequest creates a request to invoke SyncAlertGroups API +func CreateSyncAlertGroupsRequest() (request *SyncAlertGroupsRequest) { + request = &SyncAlertGroupsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "SyncAlertGroups", "", "") + request.Method = requests.POST + return +} + +// CreateSyncAlertGroupsResponse creates a response to parse from SyncAlertGroups response +func CreateSyncAlertGroupsResponse() (response *SyncAlertGroupsResponse) { + response = &SyncAlertGroupsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go new file mode 100644 index 000000000..7dd68e56f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/sync_alert_users.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SyncAlertUsers invokes the sls.SyncAlertUsers API synchronously +func (client *Client) SyncAlertUsers(request *SyncAlertUsersRequest) (response *SyncAlertUsersResponse, err error) { + response = CreateSyncAlertUsersResponse() + err = client.DoAction(request, response) + return +} + +// SyncAlertUsersWithChan invokes the sls.SyncAlertUsers API asynchronously +func (client *Client) SyncAlertUsersWithChan(request *SyncAlertUsersRequest) (<-chan *SyncAlertUsersResponse, <-chan error) { + responseChan := make(chan *SyncAlertUsersResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SyncAlertUsers(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SyncAlertUsersWithCallback invokes the sls.SyncAlertUsers API asynchronously +func (client *Client) SyncAlertUsersWithCallback(request *SyncAlertUsersRequest, callback func(response *SyncAlertUsersResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SyncAlertUsersResponse + var err error + defer close(result) + response, err = client.SyncAlertUsers(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SyncAlertUsersRequest is the request struct for api SyncAlertUsers +type SyncAlertUsersRequest struct { + *requests.RpcRequest + App string `position:"Body" name:"App"` + Users string `position:"Body" name:"Users"` +} + +// SyncAlertUsersResponse is the response struct for api SyncAlertUsers +type SyncAlertUsersResponse struct { + *responses.BaseResponse + Code bool `json:"Code" xml:"Code"` + Data string `json:"Data" xml:"Data"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` +} + +// CreateSyncAlertUsersRequest creates a request to invoke SyncAlertUsers API +func CreateSyncAlertUsersRequest() (request *SyncAlertUsersRequest) { + request = &SyncAlertUsersRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2018-06-13", "SyncAlertUsers", "", "") + request.Method = requests.POST + return +} + +// CreateSyncAlertUsersResponse creates a response to parse from SyncAlertUsers response +func CreateSyncAlertUsersResponse() (response *SyncAlertUsersResponse) { + response = &SyncAlertUsersResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go new file mode 100644 index 000000000..d4c1b0601 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/sls/update_app.go @@ -0,0 +1,104 @@ +package sls + +//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 Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateApp invokes the sls.UpdateApp API synchronously +func (client *Client) UpdateApp(request *UpdateAppRequest) (response *UpdateAppResponse, err error) { + response = CreateUpdateAppResponse() + err = client.DoAction(request, response) + return +} + +// UpdateAppWithChan invokes the sls.UpdateApp API asynchronously +func (client *Client) UpdateAppWithChan(request *UpdateAppRequest) (<-chan *UpdateAppResponse, <-chan error) { + responseChan := make(chan *UpdateAppResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateApp(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateAppWithCallback invokes the sls.UpdateApp API asynchronously +func (client *Client) UpdateAppWithCallback(request *UpdateAppRequest, callback func(response *UpdateAppResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateAppResponse + var err error + defer close(result) + response, err = client.UpdateApp(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateAppRequest is the request struct for api UpdateApp +type UpdateAppRequest struct { + *requests.RpcRequest + AppName string `position:"Query" name:"AppName"` + DisplayName string `position:"Query" name:"DisplayName"` + Config string `position:"Body" name:"Config"` +} + +// UpdateAppResponse is the response struct for api UpdateApp +type UpdateAppResponse struct { + *responses.BaseResponse + Code string `json:"Code" xml:"Code"` + Success string `json:"Success" xml:"Success"` + Message string `json:"Message" xml:"Message"` + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateAppRequest creates a request to invoke UpdateApp API +func CreateUpdateAppRequest() (request *UpdateAppRequest) { + request = &UpdateAppRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Sls", "2019-10-23", "UpdateApp", "", "") + request.Method = requests.POST + return +} + +// CreateUpdateAppResponse creates a response to parse from UpdateApp response +func CreateUpdateAppResponse() (response *UpdateAppResponse) { + response = &UpdateAppResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/eapache/channels/.gitignore b/vendor/github.com/eapache/channels/.gitignore new file mode 100644 index 000000000..00268614f --- /dev/null +++ b/vendor/github.com/eapache/channels/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/vendor/github.com/eapache/channels/.travis.yml b/vendor/github.com/eapache/channels/.travis.yml new file mode 100644 index 000000000..b072a4c85 --- /dev/null +++ b/vendor/github.com/eapache/channels/.travis.yml @@ -0,0 +1,11 @@ +language: go +sudo: false + +script: go test -v -race -timeout 10s ./... + +go: + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - 1.5 diff --git a/vendor/github.com/eapache/channels/CHANGELOG.md b/vendor/github.com/eapache/channels/CHANGELOG.md new file mode 100644 index 000000000..63825cd2f --- /dev/null +++ b/vendor/github.com/eapache/channels/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +#### Version 1.1.0 (2015-11-22) + +Bug Fixes: + - The `Len()` and `Cap()` methods on several implementations were racy + ([#18](https://github.com/eapache/channels/issues/18)). + +Note: Fixing the above issue led to a fairly substantial performance hit +(anywhere from 10-25% in benchmarks depending on use case) and involved fairly +major refactoring, which is why this is being released as v1.1.0 instead +of v1.0.1. + +#### Version 1.0.0 (2015-01-24) + +Version 1.0.0 is the first tagged release. All core functionality was available +at this point. diff --git a/vendor/github.com/eapache/channels/LICENSE b/vendor/github.com/eapache/channels/LICENSE new file mode 100644 index 000000000..8c4bddf75 --- /dev/null +++ b/vendor/github.com/eapache/channels/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Evan Huus + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/eapache/channels/README.md b/vendor/github.com/eapache/channels/README.md new file mode 100644 index 000000000..aab2a53a3 --- /dev/null +++ b/vendor/github.com/eapache/channels/README.md @@ -0,0 +1,27 @@ +channels +======== + +[![Build Status](https://travis-ci.org/eapache/channels.svg?branch=master)](https://travis-ci.org/eapache/channels) +[![GoDoc](https://godoc.org/github.com/eapache/channels?status.png)](https://godoc.org/github.com/eapache/channels) +[![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-active-blue.svg)](https://eapache.github.io/conduct.html) + +A collection of helper functions and special types for working with and +extending [Go](https://golang.org/)'s existing channels. Due to limitations +of Go's type system, importing this library directly is often not practical for +production code. It serves equally well, however, as a reference guide and +template for implementing many common idioms; if you use it in this way I would +appreciate the inclusion of some sort of credit in the resulting code. + +See https://godoc.org/github.com/eapache/channels for full documentation or +https://gopkg.in/eapache/channels.v1 for a versioned import path. + +Requires Go version 1.1 or later, as certain necessary elements of the `reflect` +package were not present in 1.0. + +Most of the buffered channel types in this package are backed by a very fast +queue implementation that used to be built into this package but has now been +extracted into its own package at https://github.com/eapache/queue. + +*Note:* Several types in this package provide so-called "infinite" buffers. Be +very careful using these, as no buffer is truly infinite. If such a buffer +grows too large your program will run out of memory and crash. Caveat emptor. diff --git a/vendor/github.com/eapache/channels/batching_channel.go b/vendor/github.com/eapache/channels/batching_channel.go new file mode 100644 index 000000000..5be622f2f --- /dev/null +++ b/vendor/github.com/eapache/channels/batching_channel.go @@ -0,0 +1,87 @@ +package channels + +// BatchingChannel implements the Channel interface, with the change that instead of producing individual elements +// on Out(), it batches together the entire internal buffer each time. Trying to construct an unbuffered batching channel +// will panic, that configuration is not supported (and provides no benefit over an unbuffered NativeChannel). +type BatchingChannel struct { + input, output chan interface{} + length chan int + buffer []interface{} + size BufferCap +} + +func NewBatchingChannel(size BufferCap) *BatchingChannel { + if size == None { + panic("channels: BatchingChannel does not support unbuffered behaviour") + } + if size < 0 && size != Infinity { + panic("channels: invalid negative size in NewBatchingChannel") + } + ch := &BatchingChannel{ + input: make(chan interface{}), + output: make(chan interface{}), + length: make(chan int), + size: size, + } + go ch.batchingBuffer() + return ch +} + +func (ch *BatchingChannel) In() chan<- interface{} { + return ch.input +} + +// Out returns a <-chan interface{} in order that BatchingChannel conforms to the standard Channel interface provided +// by this package, however each output value is guaranteed to be of type []interface{} - a slice collecting the most +// recent batch of values sent on the In channel. The slice is guaranteed to not be empty or nil. In practice the net +// result is that you need an additional type assertion to access the underlying values. +func (ch *BatchingChannel) Out() <-chan interface{} { + return ch.output +} + +func (ch *BatchingChannel) Len() int { + return <-ch.length +} + +func (ch *BatchingChannel) Cap() BufferCap { + return ch.size +} + +func (ch *BatchingChannel) Close() { + close(ch.input) +} + +func (ch *BatchingChannel) batchingBuffer() { + var input, output, nextInput chan interface{} + nextInput = ch.input + input = nextInput + + for input != nil || output != nil { + select { + case elem, open := <-input: + if open { + ch.buffer = append(ch.buffer, elem) + } else { + input = nil + nextInput = nil + } + case output <- ch.buffer: + ch.buffer = nil + case ch.length <- len(ch.buffer): + } + + if len(ch.buffer) == 0 { + input = nextInput + output = nil + } else if ch.size != Infinity && len(ch.buffer) >= int(ch.size) { + input = nil + output = ch.output + } else { + input = nextInput + output = ch.output + } + } + + close(ch.output) + close(ch.length) +} diff --git a/vendor/github.com/eapache/channels/black_hole.go b/vendor/github.com/eapache/channels/black_hole.go new file mode 100644 index 000000000..0d1ba97b3 --- /dev/null +++ b/vendor/github.com/eapache/channels/black_hole.go @@ -0,0 +1,54 @@ +package channels + +// BlackHole implements the InChannel interface and provides an analogue for the "Discard" variable in +// the ioutil package - it never blocks, and simply discards every value it reads. The number of items +// discarded in this way is counted and returned from Len. +type BlackHole struct { + input chan interface{} + length chan int + count int +} + +func NewBlackHole() *BlackHole { + ch := &BlackHole{ + input: make(chan interface{}), + length: make(chan int), + } + go ch.discard() + return ch +} + +func (ch *BlackHole) In() chan<- interface{} { + return ch.input +} + +func (ch *BlackHole) Len() int { + val, open := <-ch.length + if open { + return val + } else { + return ch.count + } +} + +func (ch *BlackHole) Cap() BufferCap { + return Infinity +} + +func (ch *BlackHole) Close() { + close(ch.input) +} + +func (ch *BlackHole) discard() { + for { + select { + case _, open := <-ch.input: + if !open { + close(ch.length) + return + } + ch.count++ + case ch.length <- ch.count: + } + } +} diff --git a/vendor/github.com/eapache/channels/channels.go b/vendor/github.com/eapache/channels/channels.go new file mode 100644 index 000000000..efcb2b5c5 --- /dev/null +++ b/vendor/github.com/eapache/channels/channels.go @@ -0,0 +1,277 @@ +/* +Package channels provides a collection of helper functions, interfaces and implementations for +working with and extending the capabilities of golang's existing channels. The main interface of +interest is Channel, though sub-interfaces are also provided for cases where the full Channel interface +cannot be met (for example, InChannel for write-only channels). + +For integration with native typed golang channels, functions Wrap and Unwrap are provided which do the +appropriate type conversions. The NativeChannel, NativeInChannel and NativeOutChannel type definitions +are also provided for use with native channels which already carry values of type interface{}. + +The heart of the package consists of several distinct implementations of the Channel interface, including +channels backed by special buffers (resizable, infinite, ring buffers, etc) and other useful types. A +"black hole" channel for discarding unwanted values (similar in purpose to ioutil.Discard or /dev/null) +rounds out the set. + +Helper functions for operating on Channels include Pipe and Tee (which behave much like their Unix +namesakes), as well as Multiplex and Distribute. "Weak" versions of these functions also exist, which +do not close their output channel(s) on completion. + +Due to limitations of Go's type system, importing this library directly is often not practical for +production code. It serves equally well, however, as a reference guide and template for implementing +many common idioms; if you use it in this way I would appreciate the inclusion of some sort of credit +in the resulting code. + +Warning: several types in this package provide so-called "infinite" buffers. Be *very* careful using +these, as no buffer is truly infinite - if such a buffer grows too large your program will run out of +memory and crash. Caveat emptor. +*/ +package channels + +import "reflect" + +// BufferCap represents the capacity of the buffer backing a channel. Valid values consist of all +// positive integers, as well as the special values below. +type BufferCap int + +const ( + // None is the capacity for channels that have no buffer at all. + None BufferCap = 0 + // Infinity is the capacity for channels with no limit on their buffer size. + Infinity BufferCap = -1 +) + +// Buffer is an interface for any channel that provides access to query the state of its buffer. +// Even unbuffered channels can implement this interface by simply returning 0 from Len() and None from Cap(). +type Buffer interface { + Len() int // The number of elements currently buffered. + Cap() BufferCap // The maximum number of elements that can be buffered. +} + +// SimpleInChannel is an interface representing a writeable channel that does not necessarily +// implement the Buffer interface. +type SimpleInChannel interface { + In() chan<- interface{} // The writeable end of the channel. + Close() // Closes the channel. It is an error to write to In() after calling Close(). +} + +// InChannel is an interface representing a writeable channel with a buffer. +type InChannel interface { + SimpleInChannel + Buffer +} + +// SimpleOutChannel is an interface representing a readable channel that does not necessarily +// implement the Buffer interface. +type SimpleOutChannel interface { + Out() <-chan interface{} // The readable end of the channel. +} + +// OutChannel is an interface representing a readable channel implementing the Buffer interface. +type OutChannel interface { + SimpleOutChannel + Buffer +} + +// SimpleChannel is an interface representing a channel that is both readable and writeable, +// but does not necessarily implement the Buffer interface. +type SimpleChannel interface { + SimpleInChannel + SimpleOutChannel +} + +// Channel is an interface representing a channel that is readable, writeable and implements +// the Buffer interface +type Channel interface { + SimpleChannel + Buffer +} + +func pipe(input SimpleOutChannel, output SimpleInChannel, closeWhenDone bool) { + for elem := range input.Out() { + output.In() <- elem + } + if closeWhenDone { + output.Close() + } +} + +func multiplex(output SimpleInChannel, inputs []SimpleOutChannel, closeWhenDone bool) { + inputCount := len(inputs) + cases := make([]reflect.SelectCase, inputCount) + for i := range cases { + cases[i].Dir = reflect.SelectRecv + cases[i].Chan = reflect.ValueOf(inputs[i].Out()) + } + for inputCount > 0 { + chosen, recv, recvOK := reflect.Select(cases) + if recvOK { + output.In() <- recv.Interface() + } else { + cases[chosen].Chan = reflect.ValueOf(nil) + inputCount-- + } + } + if closeWhenDone { + output.Close() + } +} + +func tee(input SimpleOutChannel, outputs []SimpleInChannel, closeWhenDone bool) { + cases := make([]reflect.SelectCase, len(outputs)) + for i := range cases { + cases[i].Dir = reflect.SelectSend + } + for elem := range input.Out() { + for i := range cases { + cases[i].Chan = reflect.ValueOf(outputs[i].In()) + cases[i].Send = reflect.ValueOf(elem) + } + for _ = range cases { + chosen, _, _ := reflect.Select(cases) + cases[chosen].Chan = reflect.ValueOf(nil) + } + } + if closeWhenDone { + for i := range outputs { + outputs[i].Close() + } + } +} + +func distribute(input SimpleOutChannel, outputs []SimpleInChannel, closeWhenDone bool) { + cases := make([]reflect.SelectCase, len(outputs)) + for i := range cases { + cases[i].Dir = reflect.SelectSend + cases[i].Chan = reflect.ValueOf(outputs[i].In()) + } + for elem := range input.Out() { + for i := range cases { + cases[i].Send = reflect.ValueOf(elem) + } + reflect.Select(cases) + } + if closeWhenDone { + for i := range outputs { + outputs[i].Close() + } + } +} + +// Pipe connects the input channel to the output channel so that +// they behave as if a single channel. +func Pipe(input SimpleOutChannel, output SimpleInChannel) { + go pipe(input, output, true) +} + +// Multiplex takes an arbitrary number of input channels and multiplexes their output into a single output +// channel. When all input channels have been closed, the output channel is closed. Multiplex with a single +// input channel is equivalent to Pipe (though slightly less efficient). +func Multiplex(output SimpleInChannel, inputs ...SimpleOutChannel) { + if len(inputs) == 0 { + panic("channels: Multiplex requires at least one input") + } + go multiplex(output, inputs, true) +} + +// Tee (like its Unix namesake) takes a single input channel and an arbitrary number of output channels +// and duplicates each input into every output. When the input channel is closed, all outputs channels are closed. +// Tee with a single output channel is equivalent to Pipe (though slightly less efficient). +func Tee(input SimpleOutChannel, outputs ...SimpleInChannel) { + if len(outputs) == 0 { + panic("channels: Tee requires at least one output") + } + go tee(input, outputs, true) +} + +// Distribute takes a single input channel and an arbitrary number of output channels and duplicates each input +// into *one* available output. If multiple outputs are waiting for a value, one is chosen at random. When the +// input channel is closed, all outputs channels are closed. Distribute with a single output channel is +// equivalent to Pipe (though slightly less efficient). +func Distribute(input SimpleOutChannel, outputs ...SimpleInChannel) { + if len(outputs) == 0 { + panic("channels: Distribute requires at least one output") + } + go distribute(input, outputs, true) +} + +// WeakPipe behaves like Pipe (connecting the two channels) except that it does not close +// the output channel when the input channel is closed. +func WeakPipe(input SimpleOutChannel, output SimpleInChannel) { + go pipe(input, output, false) +} + +// WeakMultiplex behaves like Multiplex (multiplexing multiple inputs into a single output) except that it does not close +// the output channel when the input channels are closed. +func WeakMultiplex(output SimpleInChannel, inputs ...SimpleOutChannel) { + if len(inputs) == 0 { + panic("channels: WeakMultiplex requires at least one input") + } + go multiplex(output, inputs, false) +} + +// WeakTee behaves like Tee (duplicating a single input into multiple outputs) except that it does not close +// the output channels when the input channel is closed. +func WeakTee(input SimpleOutChannel, outputs ...SimpleInChannel) { + if len(outputs) == 0 { + panic("channels: WeakTee requires at least one output") + } + go tee(input, outputs, false) +} + +// WeakDistribute behaves like Distribute (distributing a single input amongst multiple outputs) except that +// it does not close the output channels when the input channel is closed. +func WeakDistribute(input SimpleOutChannel, outputs ...SimpleInChannel) { + if len(outputs) == 0 { + panic("channels: WeakDistribute requires at least one output") + } + go distribute(input, outputs, false) +} + +// Wrap takes any readable channel type (chan or <-chan but not chan<-) and +// exposes it as a SimpleOutChannel for easy integration with existing channel sources. +// It panics if the input is not a readable channel. +func Wrap(ch interface{}) SimpleOutChannel { + t := reflect.TypeOf(ch) + if t.Kind() != reflect.Chan || t.ChanDir()&reflect.RecvDir == 0 { + panic("channels: input to Wrap must be readable channel") + } + realChan := make(chan interface{}) + + go func() { + v := reflect.ValueOf(ch) + for { + x, ok := v.Recv() + if !ok { + close(realChan) + return + } + realChan <- x.Interface() + } + }() + + return NativeOutChannel(realChan) +} + +// Unwrap takes a SimpleOutChannel and uses reflection to pipe it to a typed native channel for +// easy integration with existing channel sources. Output can be any writable channel type (chan or chan<-). +// It panics if the output is not a writable channel, or if a value is received that cannot be sent on the +// output channel. +func Unwrap(input SimpleOutChannel, output interface{}) { + t := reflect.TypeOf(output) + if t.Kind() != reflect.Chan || t.ChanDir()&reflect.SendDir == 0 { + panic("channels: input to Unwrap must be readable channel") + } + + go func() { + v := reflect.ValueOf(output) + for { + x, ok := <-input.Out() + if !ok { + v.Close() + return + } + v.Send(reflect.ValueOf(x)) + } + }() +} diff --git a/vendor/github.com/eapache/channels/infinite_channel.go b/vendor/github.com/eapache/channels/infinite_channel.go new file mode 100644 index 000000000..3aa9e8e7e --- /dev/null +++ b/vendor/github.com/eapache/channels/infinite_channel.go @@ -0,0 +1,72 @@ +package channels + +import "github.com/eapache/queue" + +// InfiniteChannel implements the Channel interface with an infinite buffer between the input and the output. +type InfiniteChannel struct { + input, output chan interface{} + length chan int + buffer *queue.Queue +} + +func NewInfiniteChannel() *InfiniteChannel { + ch := &InfiniteChannel{ + input: make(chan interface{}), + output: make(chan interface{}), + length: make(chan int), + buffer: queue.New(), + } + go ch.infiniteBuffer() + return ch +} + +func (ch *InfiniteChannel) In() chan<- interface{} { + return ch.input +} + +func (ch *InfiniteChannel) Out() <-chan interface{} { + return ch.output +} + +func (ch *InfiniteChannel) Len() int { + return <-ch.length +} + +func (ch *InfiniteChannel) Cap() BufferCap { + return Infinity +} + +func (ch *InfiniteChannel) Close() { + close(ch.input) +} + +func (ch *InfiniteChannel) infiniteBuffer() { + var input, output chan interface{} + var next interface{} + input = ch.input + + for input != nil || output != nil { + select { + case elem, open := <-input: + if open { + ch.buffer.Add(elem) + } else { + input = nil + } + case output <- next: + ch.buffer.Remove() + case ch.length <- ch.buffer.Length(): + } + + if ch.buffer.Length() > 0 { + output = ch.output + next = ch.buffer.Peek() + } else { + output = nil + next = nil + } + } + + close(ch.output) + close(ch.length) +} diff --git a/vendor/github.com/eapache/channels/native_channel.go b/vendor/github.com/eapache/channels/native_channel.go new file mode 100644 index 000000000..3807a1991 --- /dev/null +++ b/vendor/github.com/eapache/channels/native_channel.go @@ -0,0 +1,92 @@ +package channels + +// NativeInChannel implements the InChannel interface by wrapping a native go write-only channel. +type NativeInChannel chan<- interface{} + +func (ch NativeInChannel) In() chan<- interface{} { + return ch +} + +func (ch NativeInChannel) Len() int { + return len(ch) +} + +func (ch NativeInChannel) Cap() BufferCap { + return BufferCap(cap(ch)) +} + +func (ch NativeInChannel) Close() { + close(ch) +} + +// NativeOutChannel implements the OutChannel interface by wrapping a native go read-only channel. +type NativeOutChannel <-chan interface{} + +func (ch NativeOutChannel) Out() <-chan interface{} { + return ch +} + +func (ch NativeOutChannel) Len() int { + return len(ch) +} + +func (ch NativeOutChannel) Cap() BufferCap { + return BufferCap(cap(ch)) +} + +// NativeChannel implements the Channel interface by wrapping a native go channel. +type NativeChannel chan interface{} + +// NewNativeChannel makes a new NativeChannel with the given buffer size. Just a convenience wrapper +// to avoid having to cast the result of make(). +func NewNativeChannel(size BufferCap) NativeChannel { + return make(chan interface{}, size) +} + +func (ch NativeChannel) In() chan<- interface{} { + return ch +} + +func (ch NativeChannel) Out() <-chan interface{} { + return ch +} + +func (ch NativeChannel) Len() int { + return len(ch) +} + +func (ch NativeChannel) Cap() BufferCap { + return BufferCap(cap(ch)) +} + +func (ch NativeChannel) Close() { + close(ch) +} + +// DeadChannel is a placeholder implementation of the Channel interface with no buffer +// that is never ready for reading or writing. Closing a dead channel is a no-op. +// Behaves almost like NativeChannel(nil) except that closing a nil NativeChannel will panic. +type DeadChannel struct{} + +func NewDeadChannel() DeadChannel { + return DeadChannel{} +} + +func (ch DeadChannel) In() chan<- interface{} { + return nil +} + +func (ch DeadChannel) Out() <-chan interface{} { + return nil +} + +func (ch DeadChannel) Len() int { + return 0 +} + +func (ch DeadChannel) Cap() BufferCap { + return BufferCap(0) +} + +func (ch DeadChannel) Close() { +} diff --git a/vendor/github.com/eapache/channels/overflowing_channel.go b/vendor/github.com/eapache/channels/overflowing_channel.go new file mode 100644 index 000000000..35090f8e8 --- /dev/null +++ b/vendor/github.com/eapache/channels/overflowing_channel.go @@ -0,0 +1,113 @@ +package channels + +import "github.com/eapache/queue" + +// OverflowingChannel implements the Channel interface in a way that never blocks the writer. +// Specifically, if a value is written to an OverflowingChannel when its buffer is full +// (or, in an unbuffered case, when the recipient is not ready) then that value is simply discarded. +// Note that Go's scheduler can cause discarded values when they could be avoided, simply by scheduling +// the writer before the reader, so caveat emptor. +// For the opposite behaviour (discarding the oldest element, not the newest) see RingChannel. +type OverflowingChannel struct { + input, output chan interface{} + length chan int + buffer *queue.Queue + size BufferCap +} + +func NewOverflowingChannel(size BufferCap) *OverflowingChannel { + if size < 0 && size != Infinity { + panic("channels: invalid negative size in NewOverflowingChannel") + } + ch := &OverflowingChannel{ + input: make(chan interface{}), + output: make(chan interface{}), + length: make(chan int), + size: size, + } + if size == None { + go ch.overflowingDirect() + } else { + ch.buffer = queue.New() + go ch.overflowingBuffer() + } + return ch +} + +func (ch *OverflowingChannel) In() chan<- interface{} { + return ch.input +} + +func (ch *OverflowingChannel) Out() <-chan interface{} { + return ch.output +} + +func (ch *OverflowingChannel) Len() int { + if ch.size == None { + return 0 + } else { + return <-ch.length + } +} + +func (ch *OverflowingChannel) Cap() BufferCap { + return ch.size +} + +func (ch *OverflowingChannel) Close() { + close(ch.input) +} + +// for entirely unbuffered cases +func (ch *OverflowingChannel) overflowingDirect() { + for elem := range ch.input { + // if we can't write it immediately, drop it and move on + select { + case ch.output <- elem: + default: + } + } + close(ch.output) +} + +// for all buffered cases +func (ch *OverflowingChannel) overflowingBuffer() { + var input, output chan interface{} + var next interface{} + input = ch.input + + for input != nil || output != nil { + select { + // Prefer to write if possible, which is surprisingly effective in reducing + // dropped elements due to overflow. The naive read/write select chooses randomly + // when both channels are ready, which produces unnecessary drops 50% of the time. + case output <- next: + ch.buffer.Remove() + default: + select { + case elem, open := <-input: + if open { + if ch.size == Infinity || ch.buffer.Length() < int(ch.size) { + ch.buffer.Add(elem) + } + } else { + input = nil + } + case output <- next: + ch.buffer.Remove() + case ch.length <- ch.buffer.Length(): + } + } + + if ch.buffer.Length() > 0 { + output = ch.output + next = ch.buffer.Peek() + } else { + output = nil + next = nil + } + } + + close(ch.output) + close(ch.length) +} diff --git a/vendor/github.com/eapache/channels/resizable_channel.go b/vendor/github.com/eapache/channels/resizable_channel.go new file mode 100644 index 000000000..fafed0a29 --- /dev/null +++ b/vendor/github.com/eapache/channels/resizable_channel.go @@ -0,0 +1,109 @@ +package channels + +import "github.com/eapache/queue" + +// ResizableChannel implements the Channel interface with a resizable buffer between the input and the output. +// The channel initially has a buffer size of 1, but can be resized by calling Resize(). +// +// Resizing to a buffer capacity of None is, unfortunately, not supported and will panic +// (see https://github.com/eapache/channels/issues/1). +// Resizing back and forth between a finite and infinite buffer is fully supported. +type ResizableChannel struct { + input, output chan interface{} + length chan int + capacity, resize chan BufferCap + size BufferCap + buffer *queue.Queue +} + +func NewResizableChannel() *ResizableChannel { + ch := &ResizableChannel{ + input: make(chan interface{}), + output: make(chan interface{}), + length: make(chan int), + capacity: make(chan BufferCap), + resize: make(chan BufferCap), + size: 1, + buffer: queue.New(), + } + go ch.magicBuffer() + return ch +} + +func (ch *ResizableChannel) In() chan<- interface{} { + return ch.input +} + +func (ch *ResizableChannel) Out() <-chan interface{} { + return ch.output +} + +func (ch *ResizableChannel) Len() int { + return <-ch.length +} + +func (ch *ResizableChannel) Cap() BufferCap { + val, open := <-ch.capacity + if open { + return val + } else { + return ch.size + } +} + +func (ch *ResizableChannel) Close() { + close(ch.input) +} + +func (ch *ResizableChannel) Resize(newSize BufferCap) { + if newSize == None { + panic("channels: ResizableChannel does not support unbuffered behaviour") + } + if newSize < 0 && newSize != Infinity { + panic("channels: invalid negative size trying to resize channel") + } + ch.resize <- newSize +} + +func (ch *ResizableChannel) magicBuffer() { + var input, output, nextInput chan interface{} + var next interface{} + nextInput = ch.input + input = nextInput + + for input != nil || output != nil { + select { + case elem, open := <-input: + if open { + ch.buffer.Add(elem) + } else { + input = nil + nextInput = nil + } + case output <- next: + ch.buffer.Remove() + case ch.size = <-ch.resize: + case ch.length <- ch.buffer.Length(): + case ch.capacity <- ch.size: + } + + if ch.buffer.Length() == 0 { + output = nil + next = nil + } else { + output = ch.output + next = ch.buffer.Peek() + } + + if ch.size != Infinity && ch.buffer.Length() >= int(ch.size) { + input = nil + } else { + input = nextInput + } + } + + close(ch.output) + close(ch.resize) + close(ch.length) + close(ch.capacity) +} diff --git a/vendor/github.com/eapache/channels/ring_channel.go b/vendor/github.com/eapache/channels/ring_channel.go new file mode 100644 index 000000000..7aec207bd --- /dev/null +++ b/vendor/github.com/eapache/channels/ring_channel.go @@ -0,0 +1,114 @@ +package channels + +import "github.com/eapache/queue" + +// RingChannel implements the Channel interface in a way that never blocks the writer. +// Specifically, if a value is written to a RingChannel when its buffer is full then the oldest +// value in the buffer is discarded to make room (just like a standard ring-buffer). +// Note that Go's scheduler can cause discarded values when they could be avoided, simply by scheduling +// the writer before the reader, so caveat emptor. +// For the opposite behaviour (discarding the newest element, not the oldest) see OverflowingChannel. +type RingChannel struct { + input, output chan interface{} + length chan int + buffer *queue.Queue + size BufferCap +} + +func NewRingChannel(size BufferCap) *RingChannel { + if size < 0 && size != Infinity { + panic("channels: invalid negative size in NewRingChannel") + } + ch := &RingChannel{ + input: make(chan interface{}), + output: make(chan interface{}), + buffer: queue.New(), + size: size, + } + if size == None { + go ch.overflowingDirect() + } else { + ch.length = make(chan int) + go ch.ringBuffer() + } + return ch +} + +func (ch *RingChannel) In() chan<- interface{} { + return ch.input +} + +func (ch *RingChannel) Out() <-chan interface{} { + return ch.output +} + +func (ch *RingChannel) Len() int { + if ch.size == None { + return 0 + } else { + return <-ch.length + } +} + +func (ch *RingChannel) Cap() BufferCap { + return ch.size +} + +func (ch *RingChannel) Close() { + close(ch.input) +} + +// for entirely unbuffered cases +func (ch *RingChannel) overflowingDirect() { + for elem := range ch.input { + // if we can't write it immediately, drop it and move on + select { + case ch.output <- elem: + default: + } + } + close(ch.output) +} + +// for all buffered cases +func (ch *RingChannel) ringBuffer() { + var input, output chan interface{} + var next interface{} + input = ch.input + + for input != nil || output != nil { + select { + // Prefer to write if possible, which is surprisingly effective in reducing + // dropped elements due to overflow. The naive read/write select chooses randomly + // when both channels are ready, which produces unnecessary drops 50% of the time. + case output <- next: + ch.buffer.Remove() + default: + select { + case elem, open := <-input: + if open { + ch.buffer.Add(elem) + if ch.size != Infinity && ch.buffer.Length() > int(ch.size) { + ch.buffer.Remove() + } + } else { + input = nil + } + case output <- next: + ch.buffer.Remove() + case ch.length <- ch.buffer.Length(): + } + } + + if ch.buffer.Length() > 0 { + output = ch.output + next = ch.buffer.Peek() + } else { + output = nil + next = nil + } + } + + close(ch.output) + close(ch.length) +} diff --git a/vendor/github.com/eapache/channels/shared_buffer.go b/vendor/github.com/eapache/channels/shared_buffer.go new file mode 100644 index 000000000..556dc190a --- /dev/null +++ b/vendor/github.com/eapache/channels/shared_buffer.go @@ -0,0 +1,167 @@ +package channels + +import ( + "reflect" + + "github.com/eapache/queue" +) + +//sharedBufferChannel implements SimpleChannel and is created by the public +//SharedBuffer type below +type sharedBufferChannel struct { + in chan interface{} + out chan interface{} + buf *queue.Queue + closed bool +} + +func (sch *sharedBufferChannel) In() chan<- interface{} { + return sch.in +} + +func (sch *sharedBufferChannel) Out() <-chan interface{} { + return sch.out +} + +func (sch *sharedBufferChannel) Close() { + close(sch.in) +} + +//SharedBuffer implements the Buffer interface, and permits multiple SimpleChannel instances to "share" a single buffer. +//Each channel spawned by NewChannel has its own internal queue (so values flowing through do not get mixed up with +//other channels) but the total number of elements buffered by all spawned channels is limited to a single capacity. This +//means *all* such channels block and unblock for writing together. The primary use case is for implementing pipeline-style +//parallelism with goroutines, limiting the total number of elements in the pipeline without limiting the number of elements +//at any particular step. +type SharedBuffer struct { + cases []reflect.SelectCase // 2n+1 of these; [0] is for control, [1,3,5...] for recv, [2,4,6...] for send + chans []*sharedBufferChannel // n of these + count int + size BufferCap + in chan *sharedBufferChannel +} + +func NewSharedBuffer(size BufferCap) *SharedBuffer { + if size < 0 && size != Infinity { + panic("channels: invalid negative size in NewSharedBuffer") + } else if size == None { + panic("channels: SharedBuffer does not support unbuffered behaviour") + } + + buf := &SharedBuffer{ + size: size, + in: make(chan *sharedBufferChannel), + } + + buf.cases = append(buf.cases, reflect.SelectCase{ + Dir: reflect.SelectRecv, + Chan: reflect.ValueOf(buf.in), + }) + + go buf.mainLoop() + + return buf +} + +//NewChannel spawns and returns a new channel sharing the underlying buffer. +func (buf *SharedBuffer) NewChannel() SimpleChannel { + ch := &sharedBufferChannel{ + in: make(chan interface{}), + out: make(chan interface{}), + buf: queue.New(), + } + buf.in <- ch + return ch +} + +//Close shuts down the SharedBuffer. It is an error to call Close while channels are still using +//the buffer (I'm not really sure what would happen if you do so). +func (buf *SharedBuffer) Close() { + // TODO: what if there are still active channels using this buffer? + close(buf.in) +} + +func (buf *SharedBuffer) mainLoop() { + for { + i, val, ok := reflect.Select(buf.cases) + + if i == 0 { + if !ok { + //Close was called on the SharedBuffer itself + return + } + + //NewChannel was called on the SharedBuffer + ch := val.Interface().(*sharedBufferChannel) + buf.chans = append(buf.chans, ch) + buf.cases = append(buf.cases, + reflect.SelectCase{Dir: reflect.SelectRecv}, + reflect.SelectCase{Dir: reflect.SelectSend}, + ) + if buf.size == Infinity || buf.count < int(buf.size) { + buf.cases[len(buf.cases)-2].Chan = reflect.ValueOf(ch.in) + } + } else if i%2 == 0 { + //Send + if buf.count == int(buf.size) { + //room in the buffer again, re-enable all recv cases + for j := range buf.chans { + if !buf.chans[j].closed { + buf.cases[(j*2)+1].Chan = reflect.ValueOf(buf.chans[j].in) + } + } + } + buf.count-- + ch := buf.chans[(i-1)/2] + if ch.buf.Length() > 0 { + buf.cases[i].Send = reflect.ValueOf(ch.buf.Peek()) + ch.buf.Remove() + } else { + //nothing left for this channel to send, disable sending + buf.cases[i].Chan = reflect.Value{} + buf.cases[i].Send = reflect.Value{} + if ch.closed { + // and it was closed, so close the output channel + //TODO: shrink slice + close(ch.out) + } + } + } else { + ch := buf.chans[i/2] + if ok { + //Receive + buf.count++ + if ch.buf.Length() == 0 && !buf.cases[i+1].Chan.IsValid() { + //this channel now has something to send + buf.cases[i+1].Chan = reflect.ValueOf(ch.out) + buf.cases[i+1].Send = val + } else { + ch.buf.Add(val.Interface()) + } + if buf.count == int(buf.size) { + //buffer full, disable recv cases + for j := range buf.chans { + buf.cases[(j*2)+1].Chan = reflect.Value{} + } + } + } else { + //Close + buf.cases[i].Chan = reflect.Value{} + ch.closed = true + if ch.buf.Length() == 0 && !buf.cases[i+1].Chan.IsValid() { + //nothing pending, close the out channel right away + //TODO: shrink slice + close(ch.out) + } + } + } + } +} + +func (buf *SharedBuffer) Len() int { + return buf.count +} + +func (buf *SharedBuffer) Cap() BufferCap { + return buf.size +} diff --git a/vendor/github.com/eapache/queue/.gitignore b/vendor/github.com/eapache/queue/.gitignore new file mode 100644 index 000000000..836562412 --- /dev/null +++ b/vendor/github.com/eapache/queue/.gitignore @@ -0,0 +1,23 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test diff --git a/vendor/github.com/eapache/queue/.travis.yml b/vendor/github.com/eapache/queue/.travis.yml new file mode 100644 index 000000000..235a40a49 --- /dev/null +++ b/vendor/github.com/eapache/queue/.travis.yml @@ -0,0 +1,7 @@ +language: go +sudo: false + +go: + - 1.2 + - 1.3 + - 1.4 diff --git a/vendor/github.com/eapache/queue/LICENSE b/vendor/github.com/eapache/queue/LICENSE new file mode 100644 index 000000000..d5f36dbca --- /dev/null +++ b/vendor/github.com/eapache/queue/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Evan Huus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/eapache/queue/README.md b/vendor/github.com/eapache/queue/README.md new file mode 100644 index 000000000..8e782335c --- /dev/null +++ b/vendor/github.com/eapache/queue/README.md @@ -0,0 +1,16 @@ +Queue +===== + +[![Build Status](https://travis-ci.org/eapache/queue.svg)](https://travis-ci.org/eapache/queue) +[![GoDoc](https://godoc.org/github.com/eapache/queue?status.png)](https://godoc.org/github.com/eapache/queue) +[![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-active-blue.svg)](https://eapache.github.io/conduct.html) + +A fast Golang queue using a ring-buffer, based on the version suggested by Dariusz Górecki. +Using this instead of other, simpler, queue implementations (slice+append or linked list) provides +substantial memory and time benefits, and fewer GC pauses. + +The queue implemented here is as fast as it is in part because it is *not* thread-safe. + +Follows semantic versioning using https://gopkg.in/ - import from +[`gopkg.in/eapache/queue.v1`](https://gopkg.in/eapache/queue.v1) +for guaranteed API stability. diff --git a/vendor/github.com/eapache/queue/queue.go b/vendor/github.com/eapache/queue/queue.go new file mode 100644 index 000000000..71d1acdf2 --- /dev/null +++ b/vendor/github.com/eapache/queue/queue.go @@ -0,0 +1,102 @@ +/* +Package queue provides a fast, ring-buffer queue based on the version suggested by Dariusz Górecki. +Using this instead of other, simpler, queue implementations (slice+append or linked list) provides +substantial memory and time benefits, and fewer GC pauses. + +The queue implemented here is as fast as it is for an additional reason: it is *not* thread-safe. +*/ +package queue + +// minQueueLen is smallest capacity that queue may have. +// Must be power of 2 for bitwise modulus: x % n == x & (n - 1). +const minQueueLen = 16 + +// Queue represents a single instance of the queue data structure. +type Queue struct { + buf []interface{} + head, tail, count int +} + +// New constructs and returns a new Queue. +func New() *Queue { + return &Queue{ + buf: make([]interface{}, minQueueLen), + } +} + +// Length returns the number of elements currently stored in the queue. +func (q *Queue) Length() int { + return q.count +} + +// resizes the queue to fit exactly twice its current contents +// this can result in shrinking if the queue is less than half-full +func (q *Queue) resize() { + newBuf := make([]interface{}, q.count<<1) + + if q.tail > q.head { + copy(newBuf, q.buf[q.head:q.tail]) + } else { + n := copy(newBuf, q.buf[q.head:]) + copy(newBuf[n:], q.buf[:q.tail]) + } + + q.head = 0 + q.tail = q.count + q.buf = newBuf +} + +// Add puts an element on the end of the queue. +func (q *Queue) Add(elem interface{}) { + if q.count == len(q.buf) { + q.resize() + } + + q.buf[q.tail] = elem + // bitwise modulus + q.tail = (q.tail + 1) & (len(q.buf) - 1) + q.count++ +} + +// Peek returns the element at the head of the queue. This call panics +// if the queue is empty. +func (q *Queue) Peek() interface{} { + if q.count <= 0 { + panic("queue: Peek() called on empty queue") + } + return q.buf[q.head] +} + +// Get returns the element at index i in the queue. If the index is +// invalid, the call will panic. This method accepts both positive and +// negative index values. Index 0 refers to the first element, and +// index -1 refers to the last. +func (q *Queue) Get(i int) interface{} { + // If indexing backwards, convert to positive index. + if i < 0 { + i += q.count + } + if i < 0 || i >= q.count { + panic("queue: Get() called with index out of range") + } + // bitwise modulus + return q.buf[(q.head+i)&(len(q.buf)-1)] +} + +// Remove removes and returns the element from the front of the queue. If the +// queue is empty, the call will panic. +func (q *Queue) Remove() interface{} { + if q.count <= 0 { + panic("queue: Remove() called on empty queue") + } + ret := q.buf[q.head] + q.buf[q.head] = nil + // bitwise modulus + q.head = (q.head + 1) & (len(q.buf) - 1) + q.count-- + // Resize down if buffer 1/4 full. + if len(q.buf) > minQueueLen && (q.count<<2) == len(q.buf) { + q.resize() + } + return ret +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go new file mode 100644 index 000000000..e4ffca838 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go @@ -0,0 +1,148 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package cmpopts provides common options for the cmp package. +package cmpopts + +import ( + "math" + "reflect" + "time" + + "github.com/google/go-cmp/cmp" +) + +func equateAlways(_, _ interface{}) bool { return true } + +// EquateEmpty returns a Comparer option that determines all maps and slices +// with a length of zero to be equal, regardless of whether they are nil. +// +// EquateEmpty can be used in conjunction with SortSlices and SortMaps. +func EquateEmpty() cmp.Option { + return cmp.FilterValues(isEmpty, cmp.Comparer(equateAlways)) +} + +func isEmpty(x, y interface{}) bool { + vx, vy := reflect.ValueOf(x), reflect.ValueOf(y) + return (x != nil && y != nil && vx.Type() == vy.Type()) && + (vx.Kind() == reflect.Slice || vx.Kind() == reflect.Map) && + (vx.Len() == 0 && vy.Len() == 0) +} + +// EquateApprox returns a Comparer option that determines float32 or float64 +// values to be equal if they are within a relative fraction or absolute margin. +// This option is not used when either x or y is NaN or infinite. +// +// The fraction determines that the difference of two values must be within the +// smaller fraction of the two values, while the margin determines that the two +// values must be within some absolute margin. +// To express only a fraction or only a margin, use 0 for the other parameter. +// The fraction and margin must be non-negative. +// +// The mathematical expression used is equivalent to: +// |x-y| ≤ max(fraction*min(|x|, |y|), margin) +// +// EquateApprox can be used in conjunction with EquateNaNs. +func EquateApprox(fraction, margin float64) cmp.Option { + if margin < 0 || fraction < 0 || math.IsNaN(margin) || math.IsNaN(fraction) { + panic("margin or fraction must be a non-negative number") + } + a := approximator{fraction, margin} + return cmp.Options{ + cmp.FilterValues(areRealF64s, cmp.Comparer(a.compareF64)), + cmp.FilterValues(areRealF32s, cmp.Comparer(a.compareF32)), + } +} + +type approximator struct{ frac, marg float64 } + +func areRealF64s(x, y float64) bool { + return !math.IsNaN(x) && !math.IsNaN(y) && !math.IsInf(x, 0) && !math.IsInf(y, 0) +} +func areRealF32s(x, y float32) bool { + return areRealF64s(float64(x), float64(y)) +} +func (a approximator) compareF64(x, y float64) bool { + relMarg := a.frac * math.Min(math.Abs(x), math.Abs(y)) + return math.Abs(x-y) <= math.Max(a.marg, relMarg) +} +func (a approximator) compareF32(x, y float32) bool { + return a.compareF64(float64(x), float64(y)) +} + +// EquateNaNs returns a Comparer option that determines float32 and float64 +// NaN values to be equal. +// +// EquateNaNs can be used in conjunction with EquateApprox. +func EquateNaNs() cmp.Option { + return cmp.Options{ + cmp.FilterValues(areNaNsF64s, cmp.Comparer(equateAlways)), + cmp.FilterValues(areNaNsF32s, cmp.Comparer(equateAlways)), + } +} + +func areNaNsF64s(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) +} +func areNaNsF32s(x, y float32) bool { + return areNaNsF64s(float64(x), float64(y)) +} + +// EquateApproxTime returns a Comparer option that determines two non-zero +// time.Time values to be equal if they are within some margin of one another. +// If both times have a monotonic clock reading, then the monotonic time +// difference will be used. The margin must be non-negative. +func EquateApproxTime(margin time.Duration) cmp.Option { + if margin < 0 { + panic("margin must be a non-negative number") + } + a := timeApproximator{margin} + return cmp.FilterValues(areNonZeroTimes, cmp.Comparer(a.compare)) +} + +func areNonZeroTimes(x, y time.Time) bool { + return !x.IsZero() && !y.IsZero() +} + +type timeApproximator struct { + margin time.Duration +} + +func (a timeApproximator) compare(x, y time.Time) bool { + // Avoid subtracting times to avoid overflow when the + // difference is larger than the largest representible duration. + if x.After(y) { + // Ensure x is always before y + x, y = y, x + } + // We're within the margin if x+margin >= y. + // Note: time.Time doesn't have AfterOrEqual method hence the negation. + return !x.Add(a.margin).Before(y) +} + +// AnyError is an error that matches any non-nil error. +var AnyError anyError + +type anyError struct{} + +func (anyError) Error() string { return "any error" } +func (anyError) Is(err error) bool { return err != nil } + +// EquateErrors returns a Comparer option that determines errors to be equal +// if errors.Is reports them to match. The AnyError error can be used to +// match any non-nil error. +func EquateErrors() cmp.Option { + return cmp.FilterValues(areConcreteErrors, cmp.Comparer(compareErrors)) +} + +// areConcreteErrors reports whether x and y are types that implement error. +// The input types are deliberately of the interface{} type rather than the +// error type so that we can handle situations where the current type is an +// interface{}, but the underlying concrete types both happen to implement +// the error interface. +func areConcreteErrors(x, y interface{}) bool { + _, ok1 := x.(error) + _, ok2 := y.(error) + return ok1 && ok2 +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/errors_go113.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/errors_go113.go new file mode 100644 index 000000000..26fe25d6a --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/errors_go113.go @@ -0,0 +1,15 @@ +// Copyright 2021, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.13 + +package cmpopts + +import "errors" + +func compareErrors(x, y interface{}) bool { + xe := x.(error) + ye := y.(error) + return errors.Is(xe, ye) || errors.Is(ye, xe) +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/errors_xerrors.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/errors_xerrors.go new file mode 100644 index 000000000..6eeb8d6e6 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/errors_xerrors.go @@ -0,0 +1,18 @@ +// Copyright 2021, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !go1.13 + +// TODO(≥go1.13): For support on = 0 && (ss.less(v, start, i-1) || ss.less(v, i-1, start)) { + panic(fmt.Sprintf("incomparable values detected: want equal elements: %v", v.Slice(start, i))) + } + start = -1 + } else if start == -1 { + start = i + } + } +} +func (ss sliceSorter) less(v reflect.Value, i, j int) bool { + vx, vy := v.Index(i), v.Index(j) + return ss.fnc.Call([]reflect.Value{vx, vy})[0].Bool() +} + +// SortMaps returns a Transformer option that flattens map[K]V types to be a +// sorted []struct{K, V}. The less function must be of the form +// "func(T, T) bool" which is used to sort any map with key K that is +// assignable to T. +// +// Flattening the map into a slice has the property that cmp.Equal is able to +// use Comparers on K or the K.Equal method if it exists. +// +// The less function must be: +// • Deterministic: less(x, y) == less(x, y) +// • Irreflexive: !less(x, x) +// • Transitive: if !less(x, y) and !less(y, z), then !less(x, z) +// • Total: if x != y, then either less(x, y) or less(y, x) +// +// SortMaps can be used in conjunction with EquateEmpty. +func SortMaps(lessFunc interface{}) cmp.Option { + vf := reflect.ValueOf(lessFunc) + if !function.IsType(vf.Type(), function.Less) || vf.IsNil() { + panic(fmt.Sprintf("invalid less function: %T", lessFunc)) + } + ms := mapSorter{vf.Type().In(0), vf} + return cmp.FilterValues(ms.filter, cmp.Transformer("cmpopts.SortMaps", ms.sort)) +} + +type mapSorter struct { + in reflect.Type // T + fnc reflect.Value // func(T, T) bool +} + +func (ms mapSorter) filter(x, y interface{}) bool { + vx, vy := reflect.ValueOf(x), reflect.ValueOf(y) + return (x != nil && y != nil && vx.Type() == vy.Type()) && + (vx.Kind() == reflect.Map && vx.Type().Key().AssignableTo(ms.in)) && + (vx.Len() != 0 || vy.Len() != 0) +} +func (ms mapSorter) sort(x interface{}) interface{} { + src := reflect.ValueOf(x) + outType := reflect.StructOf([]reflect.StructField{ + {Name: "K", Type: src.Type().Key()}, + {Name: "V", Type: src.Type().Elem()}, + }) + dst := reflect.MakeSlice(reflect.SliceOf(outType), src.Len(), src.Len()) + for i, k := range src.MapKeys() { + v := reflect.New(outType).Elem() + v.Field(0).Set(k) + v.Field(1).Set(src.MapIndex(k)) + dst.Index(i).Set(v) + } + sort.Slice(dst.Interface(), func(i, j int) bool { return ms.less(dst, i, j) }) + ms.checkSort(dst) + return dst.Interface() +} +func (ms mapSorter) checkSort(v reflect.Value) { + for i := 1; i < v.Len(); i++ { + if !ms.less(v, i-1, i) { + panic(fmt.Sprintf("partial order detected: want %v < %v", v.Index(i-1), v.Index(i))) + } + } +} +func (ms mapSorter) less(v reflect.Value, i, j int) bool { + vx, vy := v.Index(i).Field(0), v.Index(j).Field(0) + return ms.fnc.Call([]reflect.Value{vx, vy})[0].Bool() +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/struct_filter.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/struct_filter.go new file mode 100644 index 000000000..a09829c3a --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/struct_filter.go @@ -0,0 +1,187 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmpopts + +import ( + "fmt" + "reflect" + "strings" + + "github.com/google/go-cmp/cmp" +) + +// filterField returns a new Option where opt is only evaluated on paths that +// include a specific exported field on a single struct type. +// The struct type is specified by passing in a value of that type. +// +// The name may be a dot-delimited string (e.g., "Foo.Bar") to select a +// specific sub-field that is embedded or nested within the parent struct. +func filterField(typ interface{}, name string, opt cmp.Option) cmp.Option { + // TODO: This is currently unexported over concerns of how helper filters + // can be composed together easily. + // TODO: Add tests for FilterField. + + sf := newStructFilter(typ, name) + return cmp.FilterPath(sf.filter, opt) +} + +type structFilter struct { + t reflect.Type // The root struct type to match on + ft fieldTree // Tree of fields to match on +} + +func newStructFilter(typ interface{}, names ...string) structFilter { + // TODO: Perhaps allow * as a special identifier to allow ignoring any + // number of path steps until the next field match? + // This could be useful when a concrete struct gets transformed into + // an anonymous struct where it is not possible to specify that by type, + // but the transformer happens to provide guarantees about the names of + // the transformed fields. + + t := reflect.TypeOf(typ) + if t == nil || t.Kind() != reflect.Struct { + panic(fmt.Sprintf("%T must be a non-pointer struct", typ)) + } + var ft fieldTree + for _, name := range names { + cname, err := canonicalName(t, name) + if err != nil { + panic(fmt.Sprintf("%s: %v", strings.Join(cname, "."), err)) + } + ft.insert(cname) + } + return structFilter{t, ft} +} + +func (sf structFilter) filter(p cmp.Path) bool { + for i, ps := range p { + if ps.Type().AssignableTo(sf.t) && sf.ft.matchPrefix(p[i+1:]) { + return true + } + } + return false +} + +// fieldTree represents a set of dot-separated identifiers. +// +// For example, inserting the following selectors: +// Foo +// Foo.Bar.Baz +// Foo.Buzz +// Nuka.Cola.Quantum +// +// Results in a tree of the form: +// {sub: { +// "Foo": {ok: true, sub: { +// "Bar": {sub: { +// "Baz": {ok: true}, +// }}, +// "Buzz": {ok: true}, +// }}, +// "Nuka": {sub: { +// "Cola": {sub: { +// "Quantum": {ok: true}, +// }}, +// }}, +// }} +type fieldTree struct { + ok bool // Whether this is a specified node + sub map[string]fieldTree // The sub-tree of fields under this node +} + +// insert inserts a sequence of field accesses into the tree. +func (ft *fieldTree) insert(cname []string) { + if ft.sub == nil { + ft.sub = make(map[string]fieldTree) + } + if len(cname) == 0 { + ft.ok = true + return + } + sub := ft.sub[cname[0]] + sub.insert(cname[1:]) + ft.sub[cname[0]] = sub +} + +// matchPrefix reports whether any selector in the fieldTree matches +// the start of path p. +func (ft fieldTree) matchPrefix(p cmp.Path) bool { + for _, ps := range p { + switch ps := ps.(type) { + case cmp.StructField: + ft = ft.sub[ps.Name()] + if ft.ok { + return true + } + if len(ft.sub) == 0 { + return false + } + case cmp.Indirect: + default: + return false + } + } + return false +} + +// canonicalName returns a list of identifiers where any struct field access +// through an embedded field is expanded to include the names of the embedded +// types themselves. +// +// For example, suppose field "Foo" is not directly in the parent struct, +// but actually from an embedded struct of type "Bar". Then, the canonical name +// of "Foo" is actually "Bar.Foo". +// +// Suppose field "Foo" is not directly in the parent struct, but actually +// a field in two different embedded structs of types "Bar" and "Baz". +// Then the selector "Foo" causes a panic since it is ambiguous which one it +// refers to. The user must specify either "Bar.Foo" or "Baz.Foo". +func canonicalName(t reflect.Type, sel string) ([]string, error) { + var name string + sel = strings.TrimPrefix(sel, ".") + if sel == "" { + return nil, fmt.Errorf("name must not be empty") + } + if i := strings.IndexByte(sel, '.'); i < 0 { + name, sel = sel, "" + } else { + name, sel = sel[:i], sel[i:] + } + + // Type must be a struct or pointer to struct. + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return nil, fmt.Errorf("%v must be a struct", t) + } + + // Find the canonical name for this current field name. + // If the field exists in an embedded struct, then it will be expanded. + sf, _ := t.FieldByName(name) + if !isExported(name) { + // Avoid using reflect.Type.FieldByName for unexported fields due to + // buggy behavior with regard to embeddeding and unexported fields. + // See https://golang.org/issue/4876 for details. + sf = reflect.StructField{} + for i := 0; i < t.NumField() && sf.Name == ""; i++ { + if t.Field(i).Name == name { + sf = t.Field(i) + } + } + } + if sf.Name == "" { + return []string{name}, fmt.Errorf("does not exist") + } + var ss []string + for i := range sf.Index { + ss = append(ss, t.FieldByIndex(sf.Index[:i+1]).Name) + } + if sel == "" { + return ss, nil + } + ssPost, err := canonicalName(sf.Type, sel) + return append(ss, ssPost...), err +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go new file mode 100644 index 000000000..4eb49d63d --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go @@ -0,0 +1,35 @@ +// Copyright 2018, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmpopts + +import ( + "github.com/google/go-cmp/cmp" +) + +type xformFilter struct{ xform cmp.Option } + +func (xf xformFilter) filter(p cmp.Path) bool { + for _, ps := range p { + if t, ok := ps.(cmp.Transform); ok && t.Option() == xf.xform { + return false + } + } + return true +} + +// AcyclicTransformer returns a Transformer with a filter applied that ensures +// that the transformer cannot be recursively applied upon its own output. +// +// An example use case is a transformer that splits a string by lines: +// AcyclicTransformer("SplitLines", func(s string) []string{ +// return strings.Split(s, "\n") +// }) +// +// Had this been an unfiltered Transformer instead, this would result in an +// infinite cycle converting a string to []string to [][]string and so on. +func AcyclicTransformer(name string, xformFunc interface{}) cmp.Option { + xf := xformFilter{cmp.Transformer(name, xformFunc)} + return cmp.FilterPath(xf.filter, xf.xform) +} diff --git a/vendor/golang.org/x/xerrors/LICENSE b/vendor/golang.org/x/xerrors/LICENSE new file mode 100644 index 000000000..e4a47e17f --- /dev/null +++ b/vendor/golang.org/x/xerrors/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2019 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/xerrors/PATENTS b/vendor/golang.org/x/xerrors/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/xerrors/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/xerrors/README b/vendor/golang.org/x/xerrors/README new file mode 100644 index 000000000..aac7867a5 --- /dev/null +++ b/vendor/golang.org/x/xerrors/README @@ -0,0 +1,2 @@ +This repository holds the transition packages for the new Go 1.13 error values. +See golang.org/design/29934-error-values. diff --git a/vendor/golang.org/x/xerrors/adaptor.go b/vendor/golang.org/x/xerrors/adaptor.go new file mode 100644 index 000000000..4317f2483 --- /dev/null +++ b/vendor/golang.org/x/xerrors/adaptor.go @@ -0,0 +1,193 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "bytes" + "fmt" + "io" + "reflect" + "strconv" +) + +// FormatError calls the FormatError method of f with an errors.Printer +// configured according to s and verb, and writes the result to s. +func FormatError(f Formatter, s fmt.State, verb rune) { + // Assuming this function is only called from the Format method, and given + // that FormatError takes precedence over Format, it cannot be called from + // any package that supports errors.Formatter. It is therefore safe to + // disregard that State may be a specific printer implementation and use one + // of our choice instead. + + // limitations: does not support printing error as Go struct. + + var ( + sep = " " // separator before next error + p = &state{State: s} + direct = true + ) + + var err error = f + + switch verb { + // Note that this switch must match the preference order + // for ordinary string printing (%#v before %+v, and so on). + + case 'v': + if s.Flag('#') { + if stringer, ok := err.(fmt.GoStringer); ok { + io.WriteString(&p.buf, stringer.GoString()) + goto exit + } + // proceed as if it were %v + } else if s.Flag('+') { + p.printDetail = true + sep = "\n - " + } + case 's': + case 'q', 'x', 'X': + // Use an intermediate buffer in the rare cases that precision, + // truncation, or one of the alternative verbs (q, x, and X) are + // specified. + direct = false + + default: + p.buf.WriteString("%!") + p.buf.WriteRune(verb) + p.buf.WriteByte('(') + switch { + case err != nil: + p.buf.WriteString(reflect.TypeOf(f).String()) + default: + p.buf.WriteString("") + } + p.buf.WriteByte(')') + io.Copy(s, &p.buf) + return + } + +loop: + for { + switch v := err.(type) { + case Formatter: + err = v.FormatError((*printer)(p)) + case fmt.Formatter: + v.Format(p, 'v') + break loop + default: + io.WriteString(&p.buf, v.Error()) + break loop + } + if err == nil { + break + } + if p.needColon || !p.printDetail { + p.buf.WriteByte(':') + p.needColon = false + } + p.buf.WriteString(sep) + p.inDetail = false + p.needNewline = false + } + +exit: + width, okW := s.Width() + prec, okP := s.Precision() + + if !direct || (okW && width > 0) || okP { + // Construct format string from State s. + format := []byte{'%'} + if s.Flag('-') { + format = append(format, '-') + } + if s.Flag('+') { + format = append(format, '+') + } + if s.Flag(' ') { + format = append(format, ' ') + } + if okW { + format = strconv.AppendInt(format, int64(width), 10) + } + if okP { + format = append(format, '.') + format = strconv.AppendInt(format, int64(prec), 10) + } + format = append(format, string(verb)...) + fmt.Fprintf(s, string(format), p.buf.String()) + } else { + io.Copy(s, &p.buf) + } +} + +var detailSep = []byte("\n ") + +// state tracks error printing state. It implements fmt.State. +type state struct { + fmt.State + buf bytes.Buffer + + printDetail bool + inDetail bool + needColon bool + needNewline bool +} + +func (s *state) Write(b []byte) (n int, err error) { + if s.printDetail { + if len(b) == 0 { + return 0, nil + } + if s.inDetail && s.needColon { + s.needNewline = true + if b[0] == '\n' { + b = b[1:] + } + } + k := 0 + for i, c := range b { + if s.needNewline { + if s.inDetail && s.needColon { + s.buf.WriteByte(':') + s.needColon = false + } + s.buf.Write(detailSep) + s.needNewline = false + } + if c == '\n' { + s.buf.Write(b[k:i]) + k = i + 1 + s.needNewline = true + } + } + s.buf.Write(b[k:]) + if !s.inDetail { + s.needColon = true + } + } else if !s.inDetail { + s.buf.Write(b) + } + return len(b), nil +} + +// printer wraps a state to implement an xerrors.Printer. +type printer state + +func (s *printer) Print(args ...interface{}) { + if !s.inDetail || s.printDetail { + fmt.Fprint((*state)(s), args...) + } +} + +func (s *printer) Printf(format string, args ...interface{}) { + if !s.inDetail || s.printDetail { + fmt.Fprintf((*state)(s), format, args...) + } +} + +func (s *printer) Detail() bool { + s.inDetail = true + return s.printDetail +} diff --git a/vendor/golang.org/x/xerrors/codereview.cfg b/vendor/golang.org/x/xerrors/codereview.cfg new file mode 100644 index 000000000..3f8b14b64 --- /dev/null +++ b/vendor/golang.org/x/xerrors/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/vendor/golang.org/x/xerrors/doc.go b/vendor/golang.org/x/xerrors/doc.go new file mode 100644 index 000000000..eef99d9d5 --- /dev/null +++ b/vendor/golang.org/x/xerrors/doc.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package xerrors implements functions to manipulate errors. +// +// This package is based on the Go 2 proposal for error values: +// https://golang.org/design/29934-error-values +// +// These functions were incorporated into the standard library's errors package +// in Go 1.13: +// - Is +// - As +// - Unwrap +// +// Also, Errorf's %w verb was incorporated into fmt.Errorf. +// +// Use this package to get equivalent behavior in all supported Go versions. +// +// No other features of this package were included in Go 1.13, and at present +// there are no plans to include any of them. +package xerrors // import "golang.org/x/xerrors" diff --git a/vendor/golang.org/x/xerrors/errors.go b/vendor/golang.org/x/xerrors/errors.go new file mode 100644 index 000000000..e88d3772d --- /dev/null +++ b/vendor/golang.org/x/xerrors/errors.go @@ -0,0 +1,33 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import "fmt" + +// errorString is a trivial implementation of error. +type errorString struct { + s string + frame Frame +} + +// New returns an error that formats as the given text. +// +// The returned error contains a Frame set to the caller's location and +// implements Formatter to show this information when printed with details. +func New(text string) error { + return &errorString{text, Caller(1)} +} + +func (e *errorString) Error() string { + return e.s +} + +func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *errorString) FormatError(p Printer) (next error) { + p.Print(e.s) + e.frame.Format(p) + return nil +} diff --git a/vendor/golang.org/x/xerrors/fmt.go b/vendor/golang.org/x/xerrors/fmt.go new file mode 100644 index 000000000..829862ddf --- /dev/null +++ b/vendor/golang.org/x/xerrors/fmt.go @@ -0,0 +1,187 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "fmt" + "strings" + "unicode" + "unicode/utf8" + + "golang.org/x/xerrors/internal" +) + +const percentBangString = "%!" + +// Errorf formats according to a format specifier and returns the string as a +// value that satisfies error. +// +// The returned error includes the file and line number of the caller when +// formatted with additional detail enabled. If the last argument is an error +// the returned error's Format method will return it if the format string ends +// with ": %s", ": %v", or ": %w". If the last argument is an error and the +// format string ends with ": %w", the returned error implements an Unwrap +// method returning it. +// +// If the format specifier includes a %w verb with an error operand in a +// position other than at the end, the returned error will still implement an +// Unwrap method returning the operand, but the error's Format method will not +// return the wrapped error. +// +// It is invalid to include more than one %w verb or to supply it with an +// operand that does not implement the error interface. The %w verb is otherwise +// a synonym for %v. +func Errorf(format string, a ...interface{}) error { + format = formatPlusW(format) + // Support a ": %[wsv]" suffix, which works well with xerrors.Formatter. + wrap := strings.HasSuffix(format, ": %w") + idx, format2, ok := parsePercentW(format) + percentWElsewhere := !wrap && idx >= 0 + if !percentWElsewhere && (wrap || strings.HasSuffix(format, ": %s") || strings.HasSuffix(format, ": %v")) { + err := errorAt(a, len(a)-1) + if err == nil { + return &noWrapError{fmt.Sprintf(format, a...), nil, Caller(1)} + } + // TODO: this is not entirely correct. The error value could be + // printed elsewhere in format if it mixes numbered with unnumbered + // substitutions. With relatively small changes to doPrintf we can + // have it optionally ignore extra arguments and pass the argument + // list in its entirety. + msg := fmt.Sprintf(format[:len(format)-len(": %s")], a[:len(a)-1]...) + frame := Frame{} + if internal.EnableTrace { + frame = Caller(1) + } + if wrap { + return &wrapError{msg, err, frame} + } + return &noWrapError{msg, err, frame} + } + // Support %w anywhere. + // TODO: don't repeat the wrapped error's message when %w occurs in the middle. + msg := fmt.Sprintf(format2, a...) + if idx < 0 { + return &noWrapError{msg, nil, Caller(1)} + } + err := errorAt(a, idx) + if !ok || err == nil { + // Too many %ws or argument of %w is not an error. Approximate the Go + // 1.13 fmt.Errorf message. + return &noWrapError{fmt.Sprintf("%sw(%s)", percentBangString, msg), nil, Caller(1)} + } + frame := Frame{} + if internal.EnableTrace { + frame = Caller(1) + } + return &wrapError{msg, err, frame} +} + +func errorAt(args []interface{}, i int) error { + if i < 0 || i >= len(args) { + return nil + } + err, ok := args[i].(error) + if !ok { + return nil + } + return err +} + +// formatPlusW is used to avoid the vet check that will barf at %w. +func formatPlusW(s string) string { + return s +} + +// Return the index of the only %w in format, or -1 if none. +// Also return a rewritten format string with %w replaced by %v, and +// false if there is more than one %w. +// TODO: handle "%[N]w". +func parsePercentW(format string) (idx int, newFormat string, ok bool) { + // Loosely copied from golang.org/x/tools/go/analysis/passes/printf/printf.go. + idx = -1 + ok = true + n := 0 + sz := 0 + var isW bool + for i := 0; i < len(format); i += sz { + if format[i] != '%' { + sz = 1 + continue + } + // "%%" is not a format directive. + if i+1 < len(format) && format[i+1] == '%' { + sz = 2 + continue + } + sz, isW = parsePrintfVerb(format[i:]) + if isW { + if idx >= 0 { + ok = false + } else { + idx = n + } + // "Replace" the last character, the 'w', with a 'v'. + p := i + sz - 1 + format = format[:p] + "v" + format[p+1:] + } + n++ + } + return idx, format, ok +} + +// Parse the printf verb starting with a % at s[0]. +// Return how many bytes it occupies and whether the verb is 'w'. +func parsePrintfVerb(s string) (int, bool) { + // Assume only that the directive is a sequence of non-letters followed by a single letter. + sz := 0 + var r rune + for i := 1; i < len(s); i += sz { + r, sz = utf8.DecodeRuneInString(s[i:]) + if unicode.IsLetter(r) { + return i + sz, r == 'w' + } + } + return len(s), false +} + +type noWrapError struct { + msg string + err error + frame Frame +} + +func (e *noWrapError) Error() string { + return fmt.Sprint(e) +} + +func (e *noWrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *noWrapError) FormatError(p Printer) (next error) { + p.Print(e.msg) + e.frame.Format(p) + return e.err +} + +type wrapError struct { + msg string + err error + frame Frame +} + +func (e *wrapError) Error() string { + return fmt.Sprint(e) +} + +func (e *wrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *wrapError) FormatError(p Printer) (next error) { + p.Print(e.msg) + e.frame.Format(p) + return e.err +} + +func (e *wrapError) Unwrap() error { + return e.err +} diff --git a/vendor/golang.org/x/xerrors/format.go b/vendor/golang.org/x/xerrors/format.go new file mode 100644 index 000000000..1bc9c26b9 --- /dev/null +++ b/vendor/golang.org/x/xerrors/format.go @@ -0,0 +1,34 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +// A Formatter formats error messages. +type Formatter interface { + error + + // FormatError prints the receiver's first error and returns the next error in + // the error chain, if any. + FormatError(p Printer) (next error) +} + +// A Printer formats error messages. +// +// The most common implementation of Printer is the one provided by package fmt +// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message +// typically provide their own implementations. +type Printer interface { + // Print appends args to the message output. + Print(args ...interface{}) + + // Printf writes a formatted string. + Printf(format string, args ...interface{}) + + // Detail reports whether error detail is requested. + // After the first call to Detail, all text written to the Printer + // is formatted as additional detail, or ignored when + // detail has not been requested. + // If Detail returns false, the caller can avoid printing the detail at all. + Detail() bool +} diff --git a/vendor/golang.org/x/xerrors/frame.go b/vendor/golang.org/x/xerrors/frame.go new file mode 100644 index 000000000..0de628ec5 --- /dev/null +++ b/vendor/golang.org/x/xerrors/frame.go @@ -0,0 +1,56 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "runtime" +) + +// A Frame contains part of a call stack. +type Frame struct { + // Make room for three PCs: the one we were asked for, what it called, + // and possibly a PC for skipPleaseUseCallersFrames. See: + // https://go.googlesource.com/go/+/032678e0fb/src/runtime/extern.go#169 + frames [3]uintptr +} + +// Caller returns a Frame that describes a frame on the caller's stack. +// The argument skip is the number of frames to skip over. +// Caller(0) returns the frame for the caller of Caller. +func Caller(skip int) Frame { + var s Frame + runtime.Callers(skip+1, s.frames[:]) + return s +} + +// location reports the file, line, and function of a frame. +// +// The returned function may be "" even if file and line are not. +func (f Frame) location() (function, file string, line int) { + frames := runtime.CallersFrames(f.frames[:]) + if _, ok := frames.Next(); !ok { + return "", "", 0 + } + fr, ok := frames.Next() + if !ok { + return "", "", 0 + } + return fr.Function, fr.File, fr.Line +} + +// Format prints the stack as error detail. +// It should be called from an error's Format implementation +// after printing any other error detail. +func (f Frame) Format(p Printer) { + if p.Detail() { + function, file, line := f.location() + if function != "" { + p.Printf("%s\n ", function) + } + if file != "" { + p.Printf("%s:%d\n", file, line) + } + } +} diff --git a/vendor/golang.org/x/xerrors/go.mod b/vendor/golang.org/x/xerrors/go.mod new file mode 100644 index 000000000..870d4f612 --- /dev/null +++ b/vendor/golang.org/x/xerrors/go.mod @@ -0,0 +1,3 @@ +module golang.org/x/xerrors + +go 1.11 diff --git a/vendor/golang.org/x/xerrors/internal/internal.go b/vendor/golang.org/x/xerrors/internal/internal.go new file mode 100644 index 000000000..89f4eca5d --- /dev/null +++ b/vendor/golang.org/x/xerrors/internal/internal.go @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package internal + +// EnableTrace indicates whether stack information should be recorded in errors. +var EnableTrace = true diff --git a/vendor/golang.org/x/xerrors/wrap.go b/vendor/golang.org/x/xerrors/wrap.go new file mode 100644 index 000000000..9a3b51037 --- /dev/null +++ b/vendor/golang.org/x/xerrors/wrap.go @@ -0,0 +1,106 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "reflect" +) + +// A Wrapper provides context around another error. +type Wrapper interface { + // Unwrap returns the next error in the error chain. + // If there is no next error, Unwrap returns nil. + Unwrap() error +} + +// Opaque returns an error with the same error formatting as err +// but that does not match err and cannot be unwrapped. +func Opaque(err error) error { + return noWrapper{err} +} + +type noWrapper struct { + error +} + +func (e noWrapper) FormatError(p Printer) (next error) { + if f, ok := e.error.(Formatter); ok { + return f.FormatError(p) + } + p.Print(e.error) + return nil +} + +// Unwrap returns the result of calling the Unwrap method on err, if err implements +// Unwrap. Otherwise, Unwrap returns nil. +func Unwrap(err error) error { + u, ok := err.(Wrapper) + if !ok { + return nil + } + return u.Unwrap() +} + +// Is reports whether any error in err's chain matches target. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { + if target == nil { + return err == target + } + + isComparable := reflect.TypeOf(target).Comparable() + for { + if isComparable && err == target { + return true + } + if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { + return true + } + // TODO: consider supporing target.Is(err). This would allow + // user-definable predicates, but also may allow for coping with sloppy + // APIs, thereby making it easier to get away with them. + if err = Unwrap(err); err == nil { + return false + } + } +} + +// As finds the first error in err's chain that matches the type to which target +// points, and if so, sets the target to its value and returns true. An error +// matches a type if it is assignable to the target type, or if it has a method +// As(interface{}) bool such that As(target) returns true. As will panic if target +// is not a non-nil pointer to a type which implements error or is of interface type. +// +// The As method should set the target to its value and return true if err +// matches the type to which target points. +func As(err error, target interface{}) bool { + if target == nil { + panic("errors: target cannot be nil") + } + val := reflect.ValueOf(target) + typ := val.Type() + if typ.Kind() != reflect.Ptr || val.IsNil() { + panic("errors: target must be a non-nil pointer") + } + if e := typ.Elem(); e.Kind() != reflect.Interface && !e.Implements(errorType) { + panic("errors: *target must be interface or implement error") + } + targetType := typ.Elem() + for err != nil { + if reflect.TypeOf(err).AssignableTo(targetType) { + val.Elem().Set(reflect.ValueOf(err)) + return true + } + if x, ok := err.(interface{ As(interface{}) bool }); ok && x.As(target) { + return true + } + err = Unwrap(err) + } + return false +} + +var errorType = reflect.TypeOf((*error)(nil)).Elem() diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/interface.go new file mode 100644 index 000000000..14a6db438 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package admissionregistration + +import ( + v1 "k8s.io/client-go/informers/admissionregistration/v1" + v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go new file mode 100644 index 000000000..1ecae9ecf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. + MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. + ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { + return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { + return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..b768f6f7f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.MutatingWebhookConfigurationLister +} + +type mutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *mutatingWebhookConfigurationInformer) Lister() v1.MutatingWebhookConfigurationLister { + return v1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..8ddcdf2d9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ValidatingWebhookConfigurationLister +} + +type validatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *validatingWebhookConfigurationInformer) Lister() v1.ValidatingWebhookConfigurationLister { + return v1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go new file mode 100644 index 000000000..d1e2b61be --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. + MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. + ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { + return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { + return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..12c8ec1fb --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.MutatingWebhookConfigurationLister +} + +type mutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1beta1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1beta1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *mutatingWebhookConfigurationInformer) Lister() v1beta1.MutatingWebhookConfigurationLister { + return v1beta1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..05eb05097 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ValidatingWebhookConfigurationLister +} + +type validatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *validatingWebhookConfigurationInformer) Lister() v1beta1.ValidatingWebhookConfigurationLister { + return v1beta1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go b/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go new file mode 100644 index 000000000..122c03099 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package apiserverinternal + +import ( + v1alpha1 "k8s.io/client-go/informers/apiserverinternal/v1alpha1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go new file mode 100644 index 000000000..9778325c6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // StorageVersions returns a StorageVersionInformer. + StorageVersions() StorageVersionInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// StorageVersions returns a StorageVersionInformer. +func (v *version) StorageVersions() StorageVersionInformer { + return &storageVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go new file mode 100644 index 000000000..34175b522 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/apiserverinternal/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageVersionInformer provides access to a shared informer and lister for +// StorageVersions. +type StorageVersionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.StorageVersionLister +} + +type storageVersionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageVersionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InternalV1alpha1().StorageVersions().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InternalV1alpha1().StorageVersions().Watch(context.TODO(), options) + }, + }, + &apiserverinternalv1alpha1.StorageVersion{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageVersionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageVersionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageVersionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiserverinternalv1alpha1.StorageVersion{}, f.defaultInformer) +} + +func (f *storageVersionInformer) Lister() v1alpha1.StorageVersionLister { + return v1alpha1.NewStorageVersionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/interface.go b/vendor/k8s.io/client-go/informers/apps/interface.go new file mode 100644 index 000000000..02eefe584 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/interface.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package apps + +import ( + v1 "k8s.io/client-go/informers/apps/v1" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go new file mode 100644 index 000000000..31e2b74d0 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1.ControllerRevisionLister { + return v1.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go new file mode 100644 index 000000000..da7fe9509 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1.DaemonSetLister { + return v1.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go new file mode 100644 index 000000000..bd639bb3d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1.DeploymentLister { + return v1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/interface.go b/vendor/k8s.io/client-go/informers/apps/v1/interface.go new file mode 100644 index 000000000..fab1e76bd --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go new file mode 100644 index 000000000..6d81a471a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1.ReplicaSetLister { + return v1.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go new file mode 100644 index 000000000..c99bbb73e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1.StatefulSetLister { + return v1.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go new file mode 100644 index 000000000..cb36bd7fd --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1beta1.ControllerRevisionLister { + return v1beta1.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go new file mode 100644 index 000000000..e02a13c2f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1beta1.DeploymentLister { + return v1beta1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go new file mode 100644 index 000000000..326939cd1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go new file mode 100644 index 000000000..b845cc99c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1beta1.StatefulSetLister { + return v1beta1.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go new file mode 100644 index 000000000..4d0e91320 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1beta2.ControllerRevisionLister { + return v1beta2.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go new file mode 100644 index 000000000..280e2fe46 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1beta2.DaemonSetLister { + return v1beta2.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go new file mode 100644 index 000000000..67bdb7972 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1beta2.DeploymentLister { + return v1beta2.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go new file mode 100644 index 000000000..ded89bd5b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go @@ -0,0 +1,73 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go new file mode 100644 index 000000000..85d12bb65 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1beta2.ReplicaSetLister { + return v1beta2.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go new file mode 100644 index 000000000..2fab6f7b2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1beta2.StatefulSetLister { + return v1beta2.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/interface.go new file mode 100644 index 000000000..81e839014 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/interface.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package autoscaling + +import ( + v1 "k8s.io/client-go/informers/autoscaling/v1" + v2beta1 "k8s.io/client-go/informers/autoscaling/v2beta1" + v2beta2 "k8s.io/client-go/informers/autoscaling/v2beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V2beta1 provides access to shared informers for resources in V2beta1. + V2beta1() v2beta1.Interface + // V2beta2 provides access to shared informers for resources in V2beta2. + V2beta2() v2beta2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2beta1 returns a new v2beta1.Interface. +func (g *group) V2beta1() v2beta1.Interface { + return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2beta2 returns a new v2beta2.Interface. +func (g *group) V2beta2() v2beta2.Interface { + return v2beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..44f041e90 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/autoscaling/v1" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v1.HorizontalPodAutoscalerLister { + return v1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go new file mode 100644 index 000000000..601d0f77f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go new file mode 100644 index 000000000..6385a2a19 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "context" + time "time" + + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v2beta1 "k8s.io/client-go/listers/autoscaling/v2beta1" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta1.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2beta1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2beta1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v2beta1.HorizontalPodAutoscalerLister { + return v2beta1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go new file mode 100644 index 000000000..ff5d44b09 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v2beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go new file mode 100644 index 000000000..f1ac3f073 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v2beta2 "k8s.io/client-go/listers/autoscaling/v2beta2" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2beta2.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2beta2.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v2beta2.HorizontalPodAutoscalerLister { + return v2beta2.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go new file mode 100644 index 000000000..e482c5792 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/batch/interface.go b/vendor/k8s.io/client-go/informers/batch/interface.go new file mode 100644 index 000000000..53b81c7ec --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package batch + +import ( + v1 "k8s.io/client-go/informers/batch/v1" + v1beta1 "k8s.io/client-go/informers/batch/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go new file mode 100644 index 000000000..fdfb65513 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/batch/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CronJobLister +} + +type cronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.CronJob{}, f.defaultInformer) +} + +func (f *cronJobInformer) Lister() v1.CronJobLister { + return v1.NewCronJobLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/interface.go b/vendor/k8s.io/client-go/informers/batch/v1/interface.go new file mode 100644 index 000000000..84567fb59 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CronJobs returns a CronJobInformer. + CronJobs() CronJobInformer + // Jobs returns a JobInformer. + Jobs() JobInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v *version) CronJobs() CronJobInformer { + return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Jobs returns a JobInformer. +func (v *version) Jobs() JobInformer { + return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/job.go b/vendor/k8s.io/client-go/informers/batch/v1/job.go new file mode 100644 index 000000000..4992f5228 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1/job.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/batch/v1" + cache "k8s.io/client-go/tools/cache" +) + +// JobInformer provides access to a shared informer and lister for +// Jobs. +type JobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.JobLister +} + +type jobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.Job{}, + resyncPeriod, + indexers, + ) +} + +func (f *jobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *jobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.Job{}, f.defaultInformer) +} + +func (f *jobInformer) Lister() v1.JobLister { + return v1.NewJobLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go new file mode 100644 index 000000000..820c93eaa --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + batchv1beta1 "k8s.io/api/batch/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/batch/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CronJobLister +} + +type cronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1beta1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1beta1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1beta1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1beta1.CronJob{}, f.defaultInformer) +} + +func (f *cronJobInformer) Lister() v1beta1.CronJobLister { + return v1beta1.NewCronJobLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go new file mode 100644 index 000000000..76cae22d6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CronJobs returns a CronJobInformer. + CronJobs() CronJobInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v *version) CronJobs() CronJobInformer { + return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/certificates/interface.go b/vendor/k8s.io/client-go/informers/certificates/interface.go new file mode 100644 index 000000000..e38d01177 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package certificates + +import ( + v1 "k8s.io/client-go/informers/certificates/v1" + v1beta1 "k8s.io/client-go/informers/certificates/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..73d33a914 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + certificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CertificateSigningRequestLister +} + +type certificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f *certificateSigningRequestInformer) Lister() v1.CertificateSigningRequestLister { + return v1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1/interface.go new file mode 100644 index 000000000..91ccfb715 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CertificateSigningRequests returns a CertificateSigningRequestInformer. + CertificateSigningRequests() CertificateSigningRequestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { + return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go new file mode 100644 index 000000000..4e167ab8b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/certificates/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CertificateSigningRequestLister +} + +type certificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1beta1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1beta1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1beta1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1beta1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f *certificateSigningRequestInformer) Lister() v1beta1.CertificateSigningRequestLister { + return v1beta1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go new file mode 100644 index 000000000..258dd1d0e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CertificateSigningRequests returns a CertificateSigningRequestInformer. + CertificateSigningRequests() CertificateSigningRequestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { + return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/coordination/interface.go b/vendor/k8s.io/client-go/informers/coordination/interface.go new file mode 100644 index 000000000..54cfd7b9f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package coordination + +import ( + v1 "k8s.io/client-go/informers/coordination/v1" + v1beta1 "k8s.io/client-go/informers/coordination/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1/interface.go new file mode 100644 index 000000000..05c4acbef --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Leases returns a LeaseInformer. + Leases() LeaseInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v *version) Leases() LeaseInformer { + return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go new file mode 100644 index 000000000..e538923a8 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + coordinationv1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/coordination/v1" + cache "k8s.io/client-go/tools/cache" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.LeaseLister +} + +type leaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *leaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1.Lease{}, f.defaultInformer) +} + +func (f *leaseInformer) Lister() v1.LeaseLister { + return v1.NewLeaseLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go new file mode 100644 index 000000000..360266206 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Leases returns a LeaseInformer. + Leases() LeaseInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v *version) Leases() LeaseInformer { + return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go new file mode 100644 index 000000000..5a6959c0b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/coordination/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.LeaseLister +} + +type leaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1beta1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1beta1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1beta1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *leaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1beta1.Lease{}, f.defaultInformer) +} + +func (f *leaseInformer) Lister() v1beta1.LeaseLister { + return v1beta1.NewLeaseLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/interface.go b/vendor/k8s.io/client-go/informers/core/interface.go new file mode 100644 index 000000000..de8396b51 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package core + +import ( + v1 "k8s.io/client-go/informers/core/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go new file mode 100644 index 000000000..ccdee535b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ComponentStatusInformer provides access to a shared informer and lister for +// ComponentStatuses. +type ComponentStatusInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ComponentStatusLister +} + +type componentStatusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().Watch(context.TODO(), options) + }, + }, + &corev1.ComponentStatus{}, + resyncPeriod, + indexers, + ) +} + +func (f *componentStatusInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *componentStatusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ComponentStatus{}, f.defaultInformer) +} + +func (f *componentStatusInformer) Lister() v1.ComponentStatusLister { + return v1.NewComponentStatusLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/configmap.go b/vendor/k8s.io/client-go/informers/core/v1/configmap.go new file mode 100644 index 000000000..625358178 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/configmap.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ConfigMapInformer provides access to a shared informer and lister for +// ConfigMaps. +type ConfigMapInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ConfigMapLister +} + +type configMapInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ConfigMap{}, + resyncPeriod, + indexers, + ) +} + +func (f *configMapInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *configMapInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ConfigMap{}, f.defaultInformer) +} + +func (f *configMapInformer) Lister() v1.ConfigMapLister { + return v1.NewConfigMapLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/endpoints.go b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go new file mode 100644 index 000000000..cd0f25b7f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointsInformer provides access to a shared informer and lister for +// Endpoints. +type EndpointsInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EndpointsLister +} + +type endpointsInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Endpoints{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointsInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointsInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Endpoints{}, f.defaultInformer) +} + +func (f *endpointsInformer) Lister() v1.EndpointsLister { + return v1.NewEndpointsLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/event.go b/vendor/k8s.io/client-go/informers/core/v1/event.go new file mode 100644 index 000000000..8825e9b7a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/event.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1.EventLister { + return v1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/interface.go b/vendor/k8s.io/client-go/informers/core/v1/interface.go new file mode 100644 index 000000000..b2216a05c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/interface.go @@ -0,0 +1,150 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ComponentStatuses returns a ComponentStatusInformer. + ComponentStatuses() ComponentStatusInformer + // ConfigMaps returns a ConfigMapInformer. + ConfigMaps() ConfigMapInformer + // Endpoints returns a EndpointsInformer. + Endpoints() EndpointsInformer + // Events returns a EventInformer. + Events() EventInformer + // LimitRanges returns a LimitRangeInformer. + LimitRanges() LimitRangeInformer + // Namespaces returns a NamespaceInformer. + Namespaces() NamespaceInformer + // Nodes returns a NodeInformer. + Nodes() NodeInformer + // PersistentVolumes returns a PersistentVolumeInformer. + PersistentVolumes() PersistentVolumeInformer + // PersistentVolumeClaims returns a PersistentVolumeClaimInformer. + PersistentVolumeClaims() PersistentVolumeClaimInformer + // Pods returns a PodInformer. + Pods() PodInformer + // PodTemplates returns a PodTemplateInformer. + PodTemplates() PodTemplateInformer + // ReplicationControllers returns a ReplicationControllerInformer. + ReplicationControllers() ReplicationControllerInformer + // ResourceQuotas returns a ResourceQuotaInformer. + ResourceQuotas() ResourceQuotaInformer + // Secrets returns a SecretInformer. + Secrets() SecretInformer + // Services returns a ServiceInformer. + Services() ServiceInformer + // ServiceAccounts returns a ServiceAccountInformer. + ServiceAccounts() ServiceAccountInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ComponentStatuses returns a ComponentStatusInformer. +func (v *version) ComponentStatuses() ComponentStatusInformer { + return &componentStatusInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ConfigMaps returns a ConfigMapInformer. +func (v *version) ConfigMaps() ConfigMapInformer { + return &configMapInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Endpoints returns a EndpointsInformer. +func (v *version) Endpoints() EndpointsInformer { + return &endpointsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// LimitRanges returns a LimitRangeInformer. +func (v *version) LimitRanges() LimitRangeInformer { + return &limitRangeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Namespaces returns a NamespaceInformer. +func (v *version) Namespaces() NamespaceInformer { + return &namespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Nodes returns a NodeInformer. +func (v *version) Nodes() NodeInformer { + return &nodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumes returns a PersistentVolumeInformer. +func (v *version) PersistentVolumes() PersistentVolumeInformer { + return &persistentVolumeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumeClaims returns a PersistentVolumeClaimInformer. +func (v *version) PersistentVolumeClaims() PersistentVolumeClaimInformer { + return &persistentVolumeClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Pods returns a PodInformer. +func (v *version) Pods() PodInformer { + return &podInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodTemplates returns a PodTemplateInformer. +func (v *version) PodTemplates() PodTemplateInformer { + return &podTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicationControllers returns a ReplicationControllerInformer. +func (v *version) ReplicationControllers() ReplicationControllerInformer { + return &replicationControllerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceQuotas returns a ResourceQuotaInformer. +func (v *version) ResourceQuotas() ResourceQuotaInformer { + return &resourceQuotaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Secrets returns a SecretInformer. +func (v *version) Secrets() SecretInformer { + return &secretInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Services returns a ServiceInformer. +func (v *version) Services() ServiceInformer { + return &serviceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ServiceAccounts returns a ServiceAccountInformer. +func (v *version) ServiceAccounts() ServiceAccountInformer { + return &serviceAccountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/limitrange.go b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go new file mode 100644 index 000000000..4cbfda1f7 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// LimitRangeInformer provides access to a shared informer and lister for +// LimitRanges. +type LimitRangeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.LimitRangeLister +} + +type limitRangeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.LimitRange{}, + resyncPeriod, + indexers, + ) +} + +func (f *limitRangeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *limitRangeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.LimitRange{}, f.defaultInformer) +} + +func (f *limitRangeInformer) Lister() v1.LimitRangeLister { + return v1.NewLimitRangeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/namespace.go b/vendor/k8s.io/client-go/informers/core/v1/namespace.go new file mode 100644 index 000000000..506f930a7 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/namespace.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// NamespaceInformer provides access to a shared informer and lister for +// Namespaces. +type NamespaceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NamespaceLister +} + +type namespaceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().Watch(context.TODO(), options) + }, + }, + &corev1.Namespace{}, + resyncPeriod, + indexers, + ) +} + +func (f *namespaceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *namespaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Namespace{}, f.defaultInformer) +} + +func (f *namespaceInformer) Lister() v1.NamespaceLister { + return v1.NewNamespaceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/node.go b/vendor/k8s.io/client-go/informers/core/v1/node.go new file mode 100644 index 000000000..9939fc2cb --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/node.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// NodeInformer provides access to a shared informer and lister for +// Nodes. +type NodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NodeLister +} + +type nodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().Watch(context.TODO(), options) + }, + }, + &corev1.Node{}, + resyncPeriod, + indexers, + ) +} + +func (f *nodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *nodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Node{}, f.defaultInformer) +} + +func (f *nodeInformer) Lister() v1.NodeLister { + return v1.NewNodeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go new file mode 100644 index 000000000..c82445997 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeInformer provides access to a shared informer and lister for +// PersistentVolumes. +type PersistentVolumeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PersistentVolumeLister +} + +type persistentVolumeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolume{}, + resyncPeriod, + indexers, + ) +} + +func (f *persistentVolumeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *persistentVolumeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolume{}, f.defaultInformer) +} + +func (f *persistentVolumeInformer) Lister() v1.PersistentVolumeLister { + return v1.NewPersistentVolumeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..7a7df1cff --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeClaimInformer provides access to a shared informer and lister for +// PersistentVolumeClaims. +type PersistentVolumeClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PersistentVolumeClaimLister +} + +type persistentVolumeClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolumeClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *persistentVolumeClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *persistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolumeClaim{}, f.defaultInformer) +} + +func (f *persistentVolumeClaimInformer) Lister() v1.PersistentVolumeClaimLister { + return v1.NewPersistentVolumeClaimLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/pod.go b/vendor/k8s.io/client-go/informers/core/v1/pod.go new file mode 100644 index 000000000..5c713a9b6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/pod.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodInformer provides access to a shared informer and lister for +// Pods. +type PodInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodLister +} + +type podInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Pod{}, + resyncPeriod, + indexers, + ) +} + +func (f *podInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Pod{}, f.defaultInformer) +} + +func (f *podInformer) Lister() v1.PodLister { + return v1.NewPodLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go new file mode 100644 index 000000000..2a16e910d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodTemplateInformer provides access to a shared informer and lister for +// PodTemplates. +type PodTemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodTemplateLister +} + +type podTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PodTemplate{}, + resyncPeriod, + indexers, + ) +} + +func (f *podTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PodTemplate{}, f.defaultInformer) +} + +func (f *podTemplateInformer) Lister() v1.PodTemplateLister { + return v1.NewPodTemplateLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go new file mode 100644 index 000000000..930beb4cd --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicationControllerInformer provides access to a shared informer and lister for +// ReplicationControllers. +type ReplicationControllerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ReplicationControllerLister +} + +type replicationControllerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ReplicationController{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicationControllerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicationControllerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ReplicationController{}, f.defaultInformer) +} + +func (f *replicationControllerInformer) Lister() v1.ReplicationControllerLister { + return v1.NewReplicationControllerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go new file mode 100644 index 000000000..619262a61 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceQuotaInformer provides access to a shared informer and lister for +// ResourceQuotas. +type ResourceQuotaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceQuotaLister +} + +type resourceQuotaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ResourceQuota{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceQuotaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceQuotaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ResourceQuota{}, f.defaultInformer) +} + +func (f *resourceQuotaInformer) Lister() v1.ResourceQuotaLister { + return v1.NewResourceQuotaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/secret.go b/vendor/k8s.io/client-go/informers/core/v1/secret.go new file mode 100644 index 000000000..a6be07069 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/secret.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// SecretInformer provides access to a shared informer and lister for +// Secrets. +type SecretInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SecretLister +} + +type secretInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Secret{}, + resyncPeriod, + indexers, + ) +} + +func (f *secretInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *secretInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Secret{}, f.defaultInformer) +} + +func (f *secretInformer) Lister() v1.SecretLister { + return v1.NewSecretLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/service.go b/vendor/k8s.io/client-go/informers/core/v1/service.go new file mode 100644 index 000000000..3d9ecc6e9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/service.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceInformer provides access to a shared informer and lister for +// Services. +type ServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceLister +} + +type serviceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Service{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Service{}, f.defaultInformer) +} + +func (f *serviceInformer) Lister() v1.ServiceLister { + return v1.NewServiceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go new file mode 100644 index 000000000..44371c9fa --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceAccountInformer provides access to a shared informer and lister for +// ServiceAccounts. +type ServiceAccountInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceAccountLister +} + +type serviceAccountInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ServiceAccount{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceAccountInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ServiceAccount{}, f.defaultInformer) +} + +func (f *serviceAccountInformer) Lister() v1.ServiceAccountLister { + return v1.NewServiceAccountLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/interface.go b/vendor/k8s.io/client-go/informers/discovery/interface.go new file mode 100644 index 000000000..37da9371f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package discovery + +import ( + v1 "k8s.io/client-go/informers/discovery/v1" + v1beta1 "k8s.io/client-go/informers/discovery/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go new file mode 100644 index 000000000..6c6c3372b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + discoveryv1 "k8s.io/api/discovery/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/discovery/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EndpointSliceLister +} + +type endpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1.EndpointSlice{}, f.defaultInformer) +} + +func (f *endpointSliceInformer) Lister() v1.EndpointSliceLister { + return v1.NewEndpointSliceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/interface.go b/vendor/k8s.io/client-go/informers/discovery/v1/interface.go new file mode 100644 index 000000000..d90c63c0a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EndpointSlices returns a EndpointSliceInformer. + EndpointSlices() EndpointSliceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v *version) EndpointSlices() EndpointSliceInformer { + return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go new file mode 100644 index 000000000..69ae38a91 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/discovery/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.EndpointSliceLister +} + +type endpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1beta1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1beta1.EndpointSlice{}, f.defaultInformer) +} + +func (f *endpointSliceInformer) Lister() v1beta1.EndpointSliceLister { + return v1beta1.NewEndpointSliceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go new file mode 100644 index 000000000..4661646e0 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EndpointSlices returns a EndpointSliceInformer. + EndpointSlices() EndpointSliceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v *version) EndpointSlices() EndpointSliceInformer { + return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/events/interface.go b/vendor/k8s.io/client-go/informers/events/interface.go new file mode 100644 index 000000000..b350dde5b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package events + +import ( + v1 "k8s.io/client-go/informers/events/v1" + v1beta1 "k8s.io/client-go/informers/events/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1/event.go b/vendor/k8s.io/client-go/informers/events/v1/event.go new file mode 100644 index 000000000..f8d35ee15 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1/event.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + eventsv1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/events/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1.EventLister { + return v1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1/interface.go b/vendor/k8s.io/client-go/informers/events/v1/interface.go new file mode 100644 index 000000000..cd06e2335 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Events returns a EventInformer. + Events() EventInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/event.go b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go new file mode 100644 index 000000000..025f6a5cf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + eventsv1beta1 "k8s.io/api/events/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/events/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1beta1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1beta1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1beta1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1beta1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1beta1.EventLister { + return v1beta1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go new file mode 100644 index 000000000..c71888c9a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Events returns a EventInformer. + Events() EventInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/extensions/interface.go b/vendor/k8s.io/client-go/informers/extensions/interface.go new file mode 100644 index 000000000..94a66d385 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package extensions + +import ( + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go new file mode 100644 index 000000000..050080a59 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1beta1.DaemonSetLister { + return v1beta1.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go new file mode 100644 index 000000000..1b16c5cc9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1beta1.DeploymentLister { + return v1beta1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go new file mode 100644 index 000000000..f01a88761 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.IngressLister +} + +type ingressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.Ingress{}, f.defaultInformer) +} + +func (f *ingressInformer) Lister() v1beta1.IngressLister { + return v1beta1.NewIngressLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go new file mode 100644 index 000000000..6f0bea7e8 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go @@ -0,0 +1,80 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // Ingresses returns a IngressInformer. + Ingresses() IngressInformer + // NetworkPolicies returns a NetworkPolicyInformer. + NetworkPolicies() NetworkPolicyInformer + // PodSecurityPolicies returns a PodSecurityPolicyInformer. + PodSecurityPolicies() PodSecurityPolicyInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v *version) Ingresses() IngressInformer { + return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// NetworkPolicies returns a NetworkPolicyInformer. +func (v *version) NetworkPolicies() NetworkPolicyInformer { + return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodSecurityPolicies returns a PodSecurityPolicyInformer. +func (v *version) PodSecurityPolicies() PodSecurityPolicyInformer { + return &podSecurityPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go new file mode 100644 index 000000000..4a924619f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies. +type NetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.NetworkPolicyLister +} + +type networkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.NetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.NetworkPolicy{}, f.defaultInformer) +} + +func (f *networkPolicyInformer) Lister() v1beta1.NetworkPolicyLister { + return v1beta1.NewNetworkPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..11be2751c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyInformer provides access to a shared informer and lister for +// PodSecurityPolicies. +type PodSecurityPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PodSecurityPolicyLister +} + +type podSecurityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().PodSecurityPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().PodSecurityPolicies().Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.PodSecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *podSecurityPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podSecurityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.PodSecurityPolicy{}, f.defaultInformer) +} + +func (f *podSecurityPolicyInformer) Lister() v1beta1.PodSecurityPolicyLister { + return v1beta1.NewPodSecurityPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go new file mode 100644 index 000000000..f7e224bcf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1beta1.ReplicaSetLister { + return v1beta1.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/factory.go b/vendor/k8s.io/client-go/informers/factory.go new file mode 100644 index 000000000..c6e102699 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/factory.go @@ -0,0 +1,282 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package informers + +import ( + reflect "reflect" + sync "sync" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + admissionregistration "k8s.io/client-go/informers/admissionregistration" + apiserverinternal "k8s.io/client-go/informers/apiserverinternal" + apps "k8s.io/client-go/informers/apps" + autoscaling "k8s.io/client-go/informers/autoscaling" + batch "k8s.io/client-go/informers/batch" + certificates "k8s.io/client-go/informers/certificates" + coordination "k8s.io/client-go/informers/coordination" + core "k8s.io/client-go/informers/core" + discovery "k8s.io/client-go/informers/discovery" + events "k8s.io/client-go/informers/events" + extensions "k8s.io/client-go/informers/extensions" + flowcontrol "k8s.io/client-go/informers/flowcontrol" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networking "k8s.io/client-go/informers/networking" + node "k8s.io/client-go/informers/node" + policy "k8s.io/client-go/informers/policy" + rbac "k8s.io/client-go/informers/rbac" + scheduling "k8s.io/client-go/informers/scheduling" + storage "k8s.io/client-go/informers/storage" + kubernetes "k8s.io/client-go/kubernetes" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client kubernetes.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client kubernetes.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Admissionregistration() admissionregistration.Interface + Internal() apiserverinternal.Interface + Apps() apps.Interface + Autoscaling() autoscaling.Interface + Batch() batch.Interface + Certificates() certificates.Interface + Coordination() coordination.Interface + Core() core.Interface + Discovery() discovery.Interface + Events() events.Interface + Extensions() extensions.Interface + Flowcontrol() flowcontrol.Interface + Networking() networking.Interface + Node() node.Interface + Policy() policy.Interface + Rbac() rbac.Interface + Scheduling() scheduling.Interface + Storage() storage.Interface +} + +func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface { + return admissionregistration.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Internal() apiserverinternal.Interface { + return apiserverinternal.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Apps() apps.Interface { + return apps.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { + return autoscaling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Batch() batch.Interface { + return batch.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Certificates() certificates.Interface { + return certificates.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Coordination() coordination.Interface { + return coordination.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Core() core.Interface { + return core.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Discovery() discovery.Interface { + return discovery.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Events() events.Interface { + return events.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Extensions() extensions.Interface { + return extensions.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Flowcontrol() flowcontrol.Interface { + return flowcontrol.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Networking() networking.Interface { + return networking.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Node() node.Interface { + return node.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Policy() policy.Interface { + return policy.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Rbac() rbac.Interface { + return rbac.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Scheduling() scheduling.Interface { + return scheduling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Storage() storage.Interface { + return storage.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/interface.go new file mode 100644 index 000000000..b04ca59d3 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package flowcontrol + +import ( + v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1" + v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go new file mode 100644 index 000000000..9a4a90448 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.FlowSchemaLister +} + +type flowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1alpha1.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1alpha1.FlowSchema{}, f.defaultInformer) +} + +func (f *flowSchemaInformer) Lister() v1alpha1.FlowSchemaLister { + return v1alpha1.NewFlowSchemaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go new file mode 100644 index 000000000..7097c0058 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // FlowSchemas returns a FlowSchemaInformer. + FlowSchemas() FlowSchemaInformer + // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. + PriorityLevelConfigurations() PriorityLevelConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v *version) FlowSchemas() FlowSchemaInformer { + return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { + return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go new file mode 100644 index 000000000..b81f5c9c3 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PriorityLevelConfigurationLister +} + +type priorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1alpha1.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1alpha1.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f *priorityLevelConfigurationInformer) Lister() v1alpha1.PriorityLevelConfigurationLister { + return v1alpha1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go new file mode 100644 index 000000000..13f4ff093 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.FlowSchemaLister +} + +type flowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta1.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta1.FlowSchema{}, f.defaultInformer) +} + +func (f *flowSchemaInformer) Lister() v1beta1.FlowSchemaLister { + return v1beta1.NewFlowSchemaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go new file mode 100644 index 000000000..50329bb0a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // FlowSchemas returns a FlowSchemaInformer. + FlowSchemas() FlowSchemaInformer + // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. + PriorityLevelConfigurations() PriorityLevelConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v *version) FlowSchemas() FlowSchemaInformer { + return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { + return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go new file mode 100644 index 000000000..fa4835906 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PriorityLevelConfigurationLister +} + +type priorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta1.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta1.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f *priorityLevelConfigurationInformer) Lister() v1beta1.PriorityLevelConfigurationLister { + return v1beta1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/generic.go b/vendor/k8s.io/client-go/informers/generic.go new file mode 100644 index 000000000..aede51a5e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/generic.go @@ -0,0 +1,364 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package informers + +import ( + "fmt" + + v1 "k8s.io/api/admissionregistration/v1" + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + appsv1 "k8s.io/api/apps/v1" + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1beta2 "k8s.io/api/apps/v1beta2" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v2beta1 "k8s.io/api/autoscaling/v2beta1" + v2beta2 "k8s.io/api/autoscaling/v2beta2" + batchv1 "k8s.io/api/batch/v1" + batchv1beta1 "k8s.io/api/batch/v1beta1" + certificatesv1 "k8s.io/api/certificates/v1" + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + coordinationv1 "k8s.io/api/coordination/v1" + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + eventsv1 "k8s.io/api/events/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + networkingv1 "k8s.io/api/networking/v1" + networkingv1beta1 "k8s.io/api/networking/v1beta1" + nodev1 "k8s.io/api/node/v1" + nodev1alpha1 "k8s.io/api/node/v1alpha1" + nodev1beta1 "k8s.io/api/node/v1beta1" + policyv1 "k8s.io/api/policy/v1" + policyv1beta1 "k8s.io/api/policy/v1beta1" + rbacv1 "k8s.io/api/rbac/v1" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + schedulingv1 "k8s.io/api/scheduling/v1" + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + storagev1 "k8s.io/api/storage/v1" + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + storagev1beta1 "k8s.io/api/storage/v1beta1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=admissionregistration.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=admissionregistration.k8s.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().MutatingWebhookConfigurations().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=apps, Version=v1 + case appsv1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ControllerRevisions().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().DaemonSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().Deployments().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ReplicaSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().StatefulSets().Informer()}, nil + + // Group=apps, Version=v1beta1 + case appsv1beta1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().ControllerRevisions().Informer()}, nil + case appsv1beta1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().Deployments().Informer()}, nil + case appsv1beta1.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().StatefulSets().Informer()}, nil + + // Group=apps, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ControllerRevisions().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().DaemonSets().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().Deployments().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ReplicaSets().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().StatefulSets().Informer()}, nil + + // Group=autoscaling, Version=v1 + case autoscalingv1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2beta1 + case v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2beta2 + case v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil + + // Group=batch, Version=v1 + case batchv1.SchemeGroupVersion.WithResource("cronjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil + case batchv1.SchemeGroupVersion.WithResource("jobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil + + // Group=batch, Version=v1beta1 + case batchv1beta1.SchemeGroupVersion.WithResource("cronjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1beta1().CronJobs().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1 + case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1beta1 + case certificatesv1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1beta1().CertificateSigningRequests().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1 + case coordinationv1.SchemeGroupVersion.WithResource("leases"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1().Leases().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1beta1 + case coordinationv1beta1.SchemeGroupVersion.WithResource("leases"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1beta1().Leases().Informer()}, nil + + // Group=core, Version=v1 + case corev1.SchemeGroupVersion.WithResource("componentstatuses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ComponentStatuses().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("configmaps"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ConfigMaps().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("endpoints"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Endpoints().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Events().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("limitranges"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().LimitRanges().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("namespaces"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Namespaces().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("nodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Nodes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumeclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumeClaims().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("pods"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Pods().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("podtemplates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PodTemplates().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("replicationcontrollers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ReplicationControllers().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("resourcequotas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ResourceQuotas().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("secrets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Secrets().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("services"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Services().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("serviceaccounts"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ServiceAccounts().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1 + case discoveryv1.SchemeGroupVersion.WithResource("endpointslices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1().EndpointSlices().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1beta1 + case discoveryv1beta1.SchemeGroupVersion.WithResource("endpointslices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1beta1().EndpointSlices().Informer()}, nil + + // Group=events.k8s.io, Version=v1 + case eventsv1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1().Events().Informer()}, nil + + // Group=events.k8s.io, Version=v1beta1 + case eventsv1beta1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1beta1().Events().Informer()}, nil + + // Group=extensions, Version=v1beta1 + case extensionsv1beta1.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().DaemonSets().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Deployments().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("ingresses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Ingresses().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("networkpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().NetworkPolicies().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().PodSecurityPolicies().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().ReplicaSets().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("flowschemas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().FlowSchemas().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().PriorityLevelConfigurations().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1beta1 + case flowcontrolv1beta1.SchemeGroupVersion.WithResource("flowschemas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().FlowSchemas().Informer()}, nil + case flowcontrolv1beta1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().PriorityLevelConfigurations().Informer()}, nil + + // Group=internal.apiserver.k8s.io, Version=v1alpha1 + case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil + + // Group=networking.k8s.io, Version=v1 + case networkingv1.SchemeGroupVersion.WithResource("ingresses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().Ingresses().Informer()}, nil + case networkingv1.SchemeGroupVersion.WithResource("ingressclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IngressClasses().Informer()}, nil + case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil + + // Group=networking.k8s.io, Version=v1beta1 + case networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Ingresses().Informer()}, nil + case networkingv1beta1.SchemeGroupVersion.WithResource("ingressclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IngressClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1 + case nodev1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1().RuntimeClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1alpha1 + case nodev1alpha1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().RuntimeClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1beta1 + case nodev1beta1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1beta1().RuntimeClasses().Informer()}, nil + + // Group=policy, Version=v1 + case policyv1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1().PodDisruptionBudgets().Informer()}, nil + + // Group=policy, Version=v1beta1 + case policyv1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil + case policyv1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodSecurityPolicies().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1 + case rbacv1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoleBindings().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().Roles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().RoleBindings().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1alpha1 + case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoles().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoleBindings().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().Roles().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().RoleBindings().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1beta1 + case rbacv1beta1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoles().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoleBindings().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().Roles().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().RoleBindings().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1 + case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1alpha1 + case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1beta1 + case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil + + // Group=storage.k8s.io, Version=v1 + case storagev1.SchemeGroupVersion.WithResource("csidrivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIDrivers().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("csinodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSINodes().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("storageclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().VolumeAttachments().Informer()}, nil + + // Group=storage.k8s.io, Version=v1alpha1 + case storagev1alpha1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().CSIStorageCapacities().Informer()}, nil + case storagev1alpha1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().VolumeAttachments().Informer()}, nil + + // Group=storage.k8s.io, Version=v1beta1 + case storagev1beta1.SchemeGroupVersion.WithResource("csidrivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIDrivers().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("csinodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSINodes().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIStorageCapacities().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("storageclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().StorageClasses().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttachments().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go b/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..b00ed70cf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + kubernetes "k8s.io/client-go/kubernetes" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes kubernetes.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(kubernetes.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/k8s.io/client-go/informers/networking/interface.go b/vendor/k8s.io/client-go/informers/networking/interface.go new file mode 100644 index 000000000..4a028d5d1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package networking + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/networking/v1" + v1beta1 "k8s.io/client-go/informers/networking/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go new file mode 100644 index 000000000..06c317ad3 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + networkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.IngressLister +} + +type ingressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.Ingress{}, f.defaultInformer) +} + +func (f *ingressInformer) Lister() v1.IngressLister { + return v1.NewIngressLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go new file mode 100644 index 000000000..15514745b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + networkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressClassInformer provides access to a shared informer and lister for +// IngressClasses. +type IngressClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.IngressClassLister +} + +type ingressClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().IngressClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().IngressClasses().Watch(context.TODO(), options) + }, + }, + &networkingv1.IngressClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.IngressClass{}, f.defaultInformer) +} + +func (f *ingressClassInformer) Lister() v1.IngressClassLister { + return v1.NewIngressClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/interface.go b/vendor/k8s.io/client-go/informers/networking/v1/interface.go new file mode 100644 index 000000000..a48d92c4e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Ingresses returns a IngressInformer. + Ingresses() IngressInformer + // IngressClasses returns a IngressClassInformer. + IngressClasses() IngressClassInformer + // NetworkPolicies returns a NetworkPolicyInformer. + NetworkPolicies() NetworkPolicyInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v *version) Ingresses() IngressInformer { + return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IngressClasses returns a IngressClassInformer. +func (v *version) IngressClasses() IngressClassInformer { + return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// NetworkPolicies returns a NetworkPolicyInformer. +func (v *version) NetworkPolicies() NetworkPolicyInformer { + return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go new file mode 100644 index 000000000..a75c9ac21 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + networkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies. +type NetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NetworkPolicyLister +} + +type networkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1.NetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.NetworkPolicy{}, f.defaultInformer) +} + +func (f *networkPolicyInformer) Lister() v1.NetworkPolicyLister { + return v1.NewNetworkPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go new file mode 100644 index 000000000..8800d6c9c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + networkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.IngressLister +} + +type ingressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1beta1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1beta1.Ingress{}, f.defaultInformer) +} + +func (f *ingressInformer) Lister() v1beta1.IngressLister { + return v1beta1.NewIngressLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go new file mode 100644 index 000000000..17864299b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + networkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressClassInformer provides access to a shared informer and lister for +// IngressClasses. +type IngressClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.IngressClassLister +} + +type ingressClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().IngressClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().IngressClasses().Watch(context.TODO(), options) + }, + }, + &networkingv1beta1.IngressClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1beta1.IngressClass{}, f.defaultInformer) +} + +func (f *ingressClassInformer) Lister() v1beta1.IngressClassLister { + return v1beta1.NewIngressClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go new file mode 100644 index 000000000..2dcc3129a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Ingresses returns a IngressInformer. + Ingresses() IngressInformer + // IngressClasses returns a IngressClassInformer. + IngressClasses() IngressClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v *version) Ingresses() IngressInformer { + return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IngressClasses returns a IngressClassInformer. +func (v *version) IngressClasses() IngressClassInformer { + return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/interface.go b/vendor/k8s.io/client-go/informers/node/interface.go new file mode 100644 index 000000000..61ed5af76 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/interface.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package node + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/node/v1" + v1alpha1 "k8s.io/client-go/informers/node/v1alpha1" + v1beta1 "k8s.io/client-go/informers/node/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1/interface.go b/vendor/k8s.io/client-go/informers/node/v1/interface.go new file mode 100644 index 000000000..913fec4ac --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RuntimeClasses returns a RuntimeClassInformer. + RuntimeClasses() RuntimeClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v *version) RuntimeClasses() RuntimeClassInformer { + return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go new file mode 100644 index 000000000..293f4e2e2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + nodev1 "k8s.io/api/node/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/node/v1" + cache "k8s.io/client-go/tools/cache" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RuntimeClassLister +} + +type runtimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1.RuntimeClass{}, f.defaultInformer) +} + +func (f *runtimeClassInformer) Lister() v1.RuntimeClassLister { + return v1.NewRuntimeClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go new file mode 100644 index 000000000..c56442957 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RuntimeClasses returns a RuntimeClassInformer. + RuntimeClasses() RuntimeClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v *version) RuntimeClasses() RuntimeClassInformer { + return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go new file mode 100644 index 000000000..d314a9573 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + nodev1alpha1 "k8s.io/api/node/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/node/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RuntimeClassLister +} + +type runtimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1alpha1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1alpha1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1alpha1.RuntimeClass{}, f.defaultInformer) +} + +func (f *runtimeClassInformer) Lister() v1alpha1.RuntimeClassLister { + return v1alpha1.NewRuntimeClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go new file mode 100644 index 000000000..44a1defb6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RuntimeClasses returns a RuntimeClassInformer. + RuntimeClasses() RuntimeClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v *version) RuntimeClasses() RuntimeClassInformer { + return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go new file mode 100644 index 000000000..07619b230 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + nodev1beta1 "k8s.io/api/node/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/node/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.RuntimeClassLister +} + +type runtimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1beta1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1beta1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1beta1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1beta1.RuntimeClass{}, f.defaultInformer) +} + +func (f *runtimeClassInformer) Lister() v1beta1.RuntimeClassLister { + return v1beta1.NewRuntimeClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/policy/interface.go b/vendor/k8s.io/client-go/informers/policy/interface.go new file mode 100644 index 000000000..889cb8152 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/interface.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package policy + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/policy/v1" + v1beta1 "k8s.io/client-go/informers/policy/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1/interface.go b/vendor/k8s.io/client-go/informers/policy/v1/interface.go new file mode 100644 index 000000000..2c42e1993 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PodDisruptionBudgets returns a PodDisruptionBudgetInformer. + PodDisruptionBudgets() PodDisruptionBudgetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. +func (v *version) PodDisruptionBudgets() PodDisruptionBudgetInformer { + return &podDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go new file mode 100644 index 000000000..436598512 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + policyv1 "k8s.io/api/policy/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/policy/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets. +type PodDisruptionBudgetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodDisruptionBudgetLister +} + +type podDisruptionBudgetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1().PodDisruptionBudgets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(context.TODO(), options) + }, + }, + &policyv1.PodDisruptionBudget{}, + resyncPeriod, + indexers, + ) +} + +func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1.PodDisruptionBudget{}, f.defaultInformer) +} + +func (f *podDisruptionBudgetInformer) Lister() v1.PodDisruptionBudgetLister { + return v1.NewPodDisruptionBudgetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go new file mode 100644 index 000000000..a6c1825d2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PodDisruptionBudgets returns a PodDisruptionBudgetInformer. + PodDisruptionBudgets() PodDisruptionBudgetInformer + // PodSecurityPolicies returns a PodSecurityPolicyInformer. + PodSecurityPolicies() PodSecurityPolicyInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. +func (v *version) PodDisruptionBudgets() PodDisruptionBudgetInformer { + return &podDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodSecurityPolicies returns a PodSecurityPolicyInformer. +func (v *version) PodSecurityPolicies() PodSecurityPolicyInformer { + return &podSecurityPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go new file mode 100644 index 000000000..4530343ec --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + policyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets. +type PodDisruptionBudgetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PodDisruptionBudgetLister +} + +type podDisruptionBudgetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(context.TODO(), options) + }, + }, + &policyv1beta1.PodDisruptionBudget{}, + resyncPeriod, + indexers, + ) +} + +func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1beta1.PodDisruptionBudget{}, f.defaultInformer) +} + +func (f *podDisruptionBudgetInformer) Lister() v1beta1.PodDisruptionBudgetLister { + return v1beta1.NewPodDisruptionBudgetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..b87d23434 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + policyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyInformer provides access to a shared informer and lister for +// PodSecurityPolicies. +type PodSecurityPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PodSecurityPolicyLister +} + +type podSecurityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodSecurityPolicies().Watch(context.TODO(), options) + }, + }, + &policyv1beta1.PodSecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *podSecurityPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podSecurityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1beta1.PodSecurityPolicy{}, f.defaultInformer) +} + +func (f *podSecurityPolicyInformer) Lister() v1beta1.PodSecurityPolicyLister { + return v1beta1.NewPodSecurityPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/interface.go b/vendor/k8s.io/client-go/informers/rbac/interface.go new file mode 100644 index 000000000..228811f8a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/interface.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package rbac + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/rbac/v1" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go new file mode 100644 index 000000000..0572be264 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1.ClusterRoleLister { + return v1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..51026c055 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1.ClusterRoleBindingLister { + return v1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1/interface.go new file mode 100644 index 000000000..7f99c9454 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1/role.go new file mode 100644 index 000000000..986a5f29f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/role.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1.RoleLister { + return v1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go new file mode 100644 index 000000000..0264049fb --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1.RoleBindingLister { + return v1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go new file mode 100644 index 000000000..70d9885f0 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1alpha1.ClusterRoleLister { + return v1alpha1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go new file mode 100644 index 000000000..8c18f6792 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1alpha1.ClusterRoleBindingLister { + return v1alpha1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go new file mode 100644 index 000000000..d27c79987 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go new file mode 100644 index 000000000..7dc4551d9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1alpha1.RoleLister { + return v1alpha1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go new file mode 100644 index 000000000..d49ec8b36 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1alpha1.RoleBindingLister { + return v1alpha1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go new file mode 100644 index 000000000..e50e1d393 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1beta1.ClusterRoleLister { + return v1beta1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go new file mode 100644 index 000000000..a7ea4cd38 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1beta1.ClusterRoleBindingLister { + return v1beta1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go new file mode 100644 index 000000000..04add43af --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go new file mode 100644 index 000000000..e56961e81 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1beta1.RoleLister { + return v1beta1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go new file mode 100644 index 000000000..d893882db --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1beta1.RoleBindingLister { + return v1beta1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/interface.go b/vendor/k8s.io/client-go/informers/scheduling/interface.go new file mode 100644 index 000000000..659089b53 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/interface.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package scheduling + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/scheduling/v1" + v1alpha1 "k8s.io/client-go/informers/scheduling/v1alpha1" + v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go new file mode 100644 index 000000000..fd7931f34 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..730616b4a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + schedulingv1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/scheduling/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1.PriorityClassLister { + return v1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go new file mode 100644 index 000000000..cd908d14e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go new file mode 100644 index 000000000..f82b66436 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1alpha1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1alpha1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1alpha1.PriorityClassLister { + return v1alpha1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go new file mode 100644 index 000000000..52840a9ce --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go new file mode 100644 index 000000000..fc7848891 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1beta1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1beta1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1beta1.PriorityClassLister { + return v1beta1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/interface.go b/vendor/k8s.io/client-go/informers/storage/interface.go new file mode 100644 index 000000000..8245aa60c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/interface.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package storage + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/storage/v1" + v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go new file mode 100644 index 000000000..6fd1e678d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSIDriverLister +} + +type cSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSIDriver{}, f.defaultInformer) +} + +func (f *cSIDriverInformer) Lister() v1.CSIDriverLister { + return v1.NewCSIDriverLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go new file mode 100644 index 000000000..96416967f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSINodeLister +} + +type cSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSINode{}, f.defaultInformer) +} + +func (f *cSINodeInformer) Lister() v1.CSINodeLister { + return v1.NewCSINodeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1/interface.go new file mode 100644 index 000000000..157759140 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIDrivers returns a CSIDriverInformer. + CSIDrivers() CSIDriverInformer + // CSINodes returns a CSINodeInformer. + CSINodes() CSINodeInformer + // StorageClasses returns a StorageClassInformer. + StorageClasses() StorageClassInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v *version) CSIDrivers() CSIDriverInformer { + return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v *version) CSINodes() CSINodeInformer { + return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v *version) StorageClasses() StorageClassInformer { + return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go new file mode 100644 index 000000000..8cde79d9a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.StorageClassLister +} + +type storageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.StorageClass{}, f.defaultInformer) +} + +func (f *storageClassInformer) Lister() v1.StorageClassLister { + return v1.NewStorageClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go new file mode 100644 index 000000000..be605ff48 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1.VolumeAttachmentLister { + return v1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go new file mode 100644 index 000000000..e59dfab2d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CSIStorageCapacityLister +} + +type cSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1alpha1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1alpha1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f *cSIStorageCapacityInformer) Lister() v1alpha1.CSIStorageCapacityLister { + return v1alpha1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go new file mode 100644 index 000000000..033d3b10a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIStorageCapacities returns a CSIStorageCapacityInformer. + CSIStorageCapacities() CSIStorageCapacityInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { + return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go new file mode 100644 index 000000000..445496dad --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1alpha1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1alpha1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1alpha1.VolumeAttachmentLister { + return v1alpha1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go new file mode 100644 index 000000000..f138a915b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CSIDriverLister +} + +type cSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSIDriver{}, f.defaultInformer) +} + +func (f *cSIDriverInformer) Lister() v1beta1.CSIDriverLister { + return v1beta1.NewCSIDriverLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go new file mode 100644 index 000000000..6ba63172a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CSINodeLister +} + +type cSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSINode{}, f.defaultInformer) +} + +func (f *cSINodeInformer) Lister() v1beta1.CSINodeLister { + return v1beta1.NewCSINodeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go new file mode 100644 index 000000000..8f0cc4668 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CSIStorageCapacityLister +} + +type cSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f *cSIStorageCapacityInformer) Lister() v1beta1.CSIStorageCapacityLister { + return v1beta1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go new file mode 100644 index 000000000..77b77c08e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIDrivers returns a CSIDriverInformer. + CSIDrivers() CSIDriverInformer + // CSINodes returns a CSINodeInformer. + CSINodes() CSINodeInformer + // CSIStorageCapacities returns a CSIStorageCapacityInformer. + CSIStorageCapacities() CSIStorageCapacityInformer + // StorageClasses returns a StorageClassInformer. + StorageClasses() StorageClassInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v *version) CSIDrivers() CSIDriverInformer { + return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v *version) CSINodes() CSINodeInformer { + return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { + return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v *version) StorageClasses() StorageClassInformer { + return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go new file mode 100644 index 000000000..a6582bf3d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.StorageClassLister +} + +type storageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.StorageClass{}, f.defaultInformer) +} + +func (f *storageClassInformer) Lister() v1beta1.StorageClassLister { + return v1beta1.NewStorageClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go new file mode 100644 index 000000000..e89424634 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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 informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1beta1.VolumeAttachmentLister { + return v1beta1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go new file mode 100644 index 000000000..e121ae41a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// MutatingWebhookConfigurationListerExpansion allows custom methods to be added to +// MutatingWebhookConfigurationLister. +type MutatingWebhookConfigurationListerExpansion interface{} + +// ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to +// ValidatingWebhookConfigurationLister. +type ValidatingWebhookConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..fe9e27985 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type MutatingWebhookConfigurationLister interface { + // List lists all MutatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.MutatingWebhookConfiguration, err error) + // Get retrieves the MutatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.MutatingWebhookConfiguration, error) + MutatingWebhookConfigurationListerExpansion +} + +// mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. +type mutatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. +func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { + return &mutatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all MutatingWebhookConfigurations in the indexer. +func (s *mutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the MutatingWebhookConfiguration from the index for a given name. +func (s *mutatingWebhookConfigurationLister) Get(name string) (*v1.MutatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("mutatingwebhookconfiguration"), name) + } + return obj.(*v1.MutatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..1579a0ebb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type ValidatingWebhookConfigurationLister interface { + // List lists all ValidatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ValidatingWebhookConfiguration, err error) + // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ValidatingWebhookConfiguration, error) + ValidatingWebhookConfigurationListerExpansion +} + +// validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. +type validatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. +func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { + return &validatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all ValidatingWebhookConfigurations in the indexer. +func (s *validatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the ValidatingWebhookConfiguration from the index for a given name. +func (s *validatingWebhookConfigurationLister) Get(name string) (*v1.ValidatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("validatingwebhookconfiguration"), name) + } + return obj.(*v1.ValidatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go new file mode 100644 index 000000000..8960abc4f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// MutatingWebhookConfigurationListerExpansion allows custom methods to be added to +// MutatingWebhookConfigurationLister. +type MutatingWebhookConfigurationListerExpansion interface{} + +// ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to +// ValidatingWebhookConfigurationLister. +type ValidatingWebhookConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..93c6096ee --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type MutatingWebhookConfigurationLister interface { + // List lists all MutatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.MutatingWebhookConfiguration, err error) + // Get retrieves the MutatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.MutatingWebhookConfiguration, error) + MutatingWebhookConfigurationListerExpansion +} + +// mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. +type mutatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. +func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { + return &mutatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all MutatingWebhookConfigurations in the indexer. +func (s *mutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the MutatingWebhookConfiguration from the index for a given name. +func (s *mutatingWebhookConfigurationLister) Get(name string) (*v1beta1.MutatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("mutatingwebhookconfiguration"), name) + } + return obj.(*v1beta1.MutatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..7c17fccb2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type ValidatingWebhookConfigurationLister interface { + // List lists all ValidatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ValidatingWebhookConfiguration, err error) + // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ValidatingWebhookConfiguration, error) + ValidatingWebhookConfigurationListerExpansion +} + +// validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. +type validatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. +func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { + return &validatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all ValidatingWebhookConfigurations in the indexer. +func (s *validatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the ValidatingWebhookConfiguration from the index for a given name. +func (s *validatingWebhookConfigurationLister) Get(name string) (*v1beta1.ValidatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("validatingwebhookconfiguration"), name) + } + return obj.(*v1beta1.ValidatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..ad860c7c9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// StorageVersionListerExpansion allows custom methods to be added to +// StorageVersionLister. +type StorageVersionListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go new file mode 100644 index 000000000..9a6d74b2b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageVersionLister helps list StorageVersions. +// All objects returned here must be treated as read-only. +type StorageVersionLister interface { + // List lists all StorageVersions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.StorageVersion, err error) + // Get retrieves the StorageVersion from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.StorageVersion, error) + StorageVersionListerExpansion +} + +// storageVersionLister implements the StorageVersionLister interface. +type storageVersionLister struct { + indexer cache.Indexer +} + +// NewStorageVersionLister returns a new StorageVersionLister. +func NewStorageVersionLister(indexer cache.Indexer) StorageVersionLister { + return &storageVersionLister{indexer: indexer} +} + +// List lists all StorageVersions in the indexer. +func (s *storageVersionLister) List(selector labels.Selector) (ret []*v1alpha1.StorageVersion, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.StorageVersion)) + }) + return ret, err +} + +// Get retrieves the StorageVersion from the index for a given name. +func (s *storageVersionLister) Get(name string) (*v1alpha1.StorageVersion, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("storageversion"), name) + } + return obj.(*v1alpha1.StorageVersion), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go new file mode 100644 index 000000000..9e2f97374 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("controllerrevision"), name) + } + return obj.(*v1.ControllerRevision), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/daemonset.go b/vendor/k8s.io/client-go/listers/apps/v1/daemonset.go new file mode 100644 index 000000000..061959e3d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/daemonset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("daemonset"), name) + } + return obj.(*v1.DaemonSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go new file mode 100644 index 000000000..83435561a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go @@ -0,0 +1,113 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface { + GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) + GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) +} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + var selector labels.Selector + var daemonSet *apps.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/deployment.go b/vendor/k8s.io/client-go/listers/apps/v1/deployment.go new file mode 100644 index 000000000..770403417 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("deployment"), name) + } + return obj.(*v1.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go new file mode 100644 index 000000000..0c357589d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/replicaset.go b/vendor/k8s.io/client-go/listers/apps/v1/replicaset.go new file mode 100644 index 000000000..3ca7757eb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/replicaset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("replicaset"), name) + } + return obj.(*v1.ReplicaSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go new file mode 100644 index 000000000..675e615ae --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface { + GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) +} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*apps.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/statefulset.go b/vendor/k8s.io/client-go/listers/apps/v1/statefulset.go new file mode 100644 index 000000000..f6899d5ff --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/statefulset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("statefulset"), name) + } + return obj.(*v1.StatefulSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go new file mode 100644 index 000000000..b4912976b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go @@ -0,0 +1,77 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface { + GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) +} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *statefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go new file mode 100644 index 000000000..fc73de723 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1beta1.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("controllerrevision"), name) + } + return obj.(*v1beta1.ControllerRevision), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go new file mode 100644 index 000000000..3fb70794c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1beta1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("deployment"), name) + } + return obj.(*v1beta1.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go new file mode 100644 index 000000000..c73cf98c7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go new file mode 100644 index 000000000..e3556bc39 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1beta1.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("statefulset"), name) + } + return obj.(*v1beta1.StatefulSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go new file mode 100644 index 000000000..0741792ac --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go @@ -0,0 +1,77 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface { + GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) +} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *statefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go new file mode 100644 index 000000000..da2ce8600 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1beta2.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("controllerrevision"), name) + } + return obj.(*v1beta2.ControllerRevision), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go new file mode 100644 index 000000000..4b7aedd75 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1beta2.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("daemonset"), name) + } + return obj.(*v1beta2.DaemonSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go new file mode 100644 index 000000000..3b01aaa48 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go @@ -0,0 +1,113 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface { + GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) + GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) +} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + var selector labels.Selector + var daemonSet *apps.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go new file mode 100644 index 000000000..c2857bbc3 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1beta2.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("deployment"), name) + } + return obj.(*v1beta2.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go new file mode 100644 index 000000000..b6d202118 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta2 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go new file mode 100644 index 000000000..26b350ce8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1beta2.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("replicaset"), name) + } + return obj.(*v1beta2.ReplicaSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go new file mode 100644 index 000000000..7562fe996 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface { + GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) +} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*apps.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go new file mode 100644 index 000000000..fbbaf0133 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1beta2.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("statefulset"), name) + } + return obj.(*v1beta2.StatefulSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go new file mode 100644 index 000000000..6fa6b9144 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go @@ -0,0 +1,77 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface { + GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) +} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *statefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go new file mode 100644 index 000000000..05253c770 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..8447f059d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/autoscaling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v1.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("horizontalpodautoscaler"), name) + } + return obj.(*v1.HorizontalPodAutoscaler), nil +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go new file mode 100644 index 000000000..8d46a4b6e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v2beta1 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go new file mode 100644 index 000000000..f1804e995 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v2beta1 + +import ( + v2beta1 "k8s.io/api/autoscaling/v2beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta1.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v2beta1.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta1.Resource("horizontalpodautoscaler"), name) + } + return obj.(*v2beta1.HorizontalPodAutoscaler), nil +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go new file mode 100644 index 000000000..5127945a9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v2beta2 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go new file mode 100644 index 000000000..b0dbaf9eb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "k8s.io/api/autoscaling/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v2beta2.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("horizontalpodautoscaler"), name) + } + return obj.(*v2beta2.HorizontalPodAutoscaler), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/cronjob.go b/vendor/k8s.io/client-go/listers/batch/v1/cronjob.go new file mode 100644 index 000000000..8e49ed959 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/cronjob.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CronJobLister helps list CronJobs. +// All objects returned here must be treated as read-only. +type CronJobLister interface { + // List lists all CronJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CronJob, err error) + // CronJobs returns an object that can list and get CronJobs. + CronJobs(namespace string) CronJobNamespaceLister + CronJobListerExpansion +} + +// cronJobLister implements the CronJobLister interface. +type cronJobLister struct { + indexer cache.Indexer +} + +// NewCronJobLister returns a new CronJobLister. +func NewCronJobLister(indexer cache.Indexer) CronJobLister { + return &cronJobLister{indexer: indexer} +} + +// List lists all CronJobs in the indexer. +func (s *cronJobLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get CronJobs. +func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister { + return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CronJobNamespaceLister helps list and get CronJobs. +// All objects returned here must be treated as read-only. +type CronJobNamespaceLister interface { + // List lists all CronJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CronJob, err error) + // Get retrieves the CronJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CronJob, error) + CronJobNamespaceListerExpansion +} + +// cronJobNamespaceLister implements the CronJobNamespaceLister +// interface. +type cronJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CronJobs in the indexer for a given namespace. +func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CronJob)) + }) + return ret, err +} + +// Get retrieves the CronJob from the indexer for a given namespace and name. +func (s cronJobNamespaceLister) Get(name string) (*v1.CronJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("cronjob"), name) + } + return obj.(*v1.CronJob), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go new file mode 100644 index 000000000..220976279 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// CronJobListerExpansion allows custom methods to be added to +// CronJobLister. +type CronJobListerExpansion interface{} + +// CronJobNamespaceListerExpansion allows custom methods to be added to +// CronJobNamespaceLister. +type CronJobNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/job.go b/vendor/k8s.io/client-go/listers/batch/v1/job.go new file mode 100644 index 000000000..3aba6b95f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/job.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// JobLister helps list Jobs. +// All objects returned here must be treated as read-only. +type JobLister interface { + // List lists all Jobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Jobs returns an object that can list and get Jobs. + Jobs(namespace string) JobNamespaceLister + JobListerExpansion +} + +// jobLister implements the JobLister interface. +type jobLister struct { + indexer cache.Indexer +} + +// NewJobLister returns a new JobLister. +func NewJobLister(indexer cache.Indexer) JobLister { + return &jobLister{indexer: indexer} +} + +// List lists all Jobs in the indexer. +func (s *jobLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Jobs returns an object that can list and get Jobs. +func (s *jobLister) Jobs(namespace string) JobNamespaceLister { + return jobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// JobNamespaceLister helps list and get Jobs. +// All objects returned here must be treated as read-only. +type JobNamespaceLister interface { + // List lists all Jobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Get retrieves the Job from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Job, error) + JobNamespaceListerExpansion +} + +// jobNamespaceLister implements the JobNamespaceLister +// interface. +type jobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Jobs in the indexer for a given namespace. +func (s jobNamespaceLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Get retrieves the Job from the indexer for a given namespace and name. +func (s jobNamespaceLister) Get(name string) (*v1.Job, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("job"), name) + } + return obj.(*v1.Job), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go b/vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go new file mode 100644 index 000000000..fdcd5f32e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go @@ -0,0 +1,68 @@ +/* +Copyright 2016 The Kubernetes 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. +*/ + +package v1 + +import ( + "fmt" + + batch "k8s.io/api/batch/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// JobListerExpansion allows custom methods to be added to +// JobLister. +type JobListerExpansion interface { + // GetPodJobs returns a list of Jobs that potentially + // match a Pod. Only the one specified in the Pod's ControllerRef + // will actually manage it. + // Returns an error only if no matching Jobs are found. + GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) +} + +// GetPodJobs returns a list of Jobs that potentially +// match a Pod. Only the one specified in the Pod's ControllerRef +// will actually manage it. +// Returns an error only if no matching Jobs are found. +func (l *jobLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) { + if len(pod.Labels) == 0 { + err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name) + return + } + + var list []*batch.Job + list, err = l.Jobs(pod.Namespace).List(labels.Everything()) + if err != nil { + return + } + for _, job := range list { + selector, _ := metav1.LabelSelectorAsSelector(job.Spec.Selector) + if !selector.Matches(labels.Set(pod.Labels)) { + continue + } + jobs = append(jobs, *job) + } + if len(jobs) == 0 { + err = fmt.Errorf("could not find jobs for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + return +} + +// JobNamespaceListerExpansion allows custom methods to be added to +// JobNamespaceLister. +type JobNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go new file mode 100644 index 000000000..4842d5e5a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/batch/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CronJobLister helps list CronJobs. +// All objects returned here must be treated as read-only. +type CronJobLister interface { + // List lists all CronJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) + // CronJobs returns an object that can list and get CronJobs. + CronJobs(namespace string) CronJobNamespaceLister + CronJobListerExpansion +} + +// cronJobLister implements the CronJobLister interface. +type cronJobLister struct { + indexer cache.Indexer +} + +// NewCronJobLister returns a new CronJobLister. +func NewCronJobLister(indexer cache.Indexer) CronJobLister { + return &cronJobLister{indexer: indexer} +} + +// List lists all CronJobs in the indexer. +func (s *cronJobLister) List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get CronJobs. +func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister { + return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CronJobNamespaceLister helps list and get CronJobs. +// All objects returned here must be treated as read-only. +type CronJobNamespaceLister interface { + // List lists all CronJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) + // Get retrieves the CronJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CronJob, error) + CronJobNamespaceListerExpansion +} + +// cronJobNamespaceLister implements the CronJobNamespaceLister +// interface. +type cronJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CronJobs in the indexer for a given namespace. +func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CronJob)) + }) + return ret, err +} + +// Get retrieves the CronJob from the indexer for a given namespace and name. +func (s cronJobNamespaceLister) Get(name string) (*v1beta1.CronJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("cronjob"), name) + } + return obj.(*v1beta1.CronJob), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go new file mode 100644 index 000000000..be2742ef6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// CronJobListerExpansion allows custom methods to be added to +// CronJobLister. +type CronJobListerExpansion interface{} + +// CronJobNamespaceListerExpansion allows custom methods to be added to +// CronJobNamespaceLister. +type CronJobNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..0d04e118d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/certificates/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestLister helps list CertificateSigningRequests. +// All objects returned here must be treated as read-only. +type CertificateSigningRequestLister interface { + // List lists all CertificateSigningRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CertificateSigningRequest, err error) + // Get retrieves the CertificateSigningRequest from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CertificateSigningRequest, error) + CertificateSigningRequestListerExpansion +} + +// certificateSigningRequestLister implements the CertificateSigningRequestLister interface. +type certificateSigningRequestLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestLister returns a new CertificateSigningRequestLister. +func NewCertificateSigningRequestLister(indexer cache.Indexer) CertificateSigningRequestLister { + return &certificateSigningRequestLister{indexer: indexer} +} + +// List lists all CertificateSigningRequests in the indexer. +func (s *certificateSigningRequestLister) List(selector labels.Selector) (ret []*v1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the CertificateSigningRequest from the index for a given name. +func (s *certificateSigningRequestLister) Get(name string) (*v1.CertificateSigningRequest, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("certificatesigningrequest"), name) + } + return obj.(*v1.CertificateSigningRequest), nil +} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go new file mode 100644 index 000000000..616a1f1a0 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// CertificateSigningRequestListerExpansion allows custom methods to be added to +// CertificateSigningRequestLister. +type CertificateSigningRequestListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go new file mode 100644 index 000000000..471b5629b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/certificates/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestLister helps list CertificateSigningRequests. +// All objects returned here must be treated as read-only. +type CertificateSigningRequestLister interface { + // List lists all CertificateSigningRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CertificateSigningRequest, err error) + // Get retrieves the CertificateSigningRequest from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CertificateSigningRequest, error) + CertificateSigningRequestListerExpansion +} + +// certificateSigningRequestLister implements the CertificateSigningRequestLister interface. +type certificateSigningRequestLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestLister returns a new CertificateSigningRequestLister. +func NewCertificateSigningRequestLister(indexer cache.Indexer) CertificateSigningRequestLister { + return &certificateSigningRequestLister{indexer: indexer} +} + +// List lists all CertificateSigningRequests in the indexer. +func (s *certificateSigningRequestLister) List(selector labels.Selector) (ret []*v1beta1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the CertificateSigningRequest from the index for a given name. +func (s *certificateSigningRequestLister) Get(name string) (*v1beta1.CertificateSigningRequest, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("certificatesigningrequest"), name) + } + return obj.(*v1beta1.CertificateSigningRequest), nil +} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go new file mode 100644 index 000000000..68f993cd6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// CertificateSigningRequestListerExpansion allows custom methods to be added to +// CertificateSigningRequestLister. +type CertificateSigningRequestListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go new file mode 100644 index 000000000..ddc494f1c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// LeaseListerExpansion allows custom methods to be added to +// LeaseLister. +type LeaseListerExpansion interface{} + +// LeaseNamespaceListerExpansion allows custom methods to be added to +// LeaseNamespaceLister. +type LeaseNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1/lease.go b/vendor/k8s.io/client-go/listers/coordination/v1/lease.go new file mode 100644 index 000000000..de366d0e1 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1/lease.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/coordination/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LeaseLister helps list Leases. +// All objects returned here must be treated as read-only. +type LeaseLister interface { + // List lists all Leases in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Lease, err error) + // Leases returns an object that can list and get Leases. + Leases(namespace string) LeaseNamespaceLister + LeaseListerExpansion +} + +// leaseLister implements the LeaseLister interface. +type leaseLister struct { + indexer cache.Indexer +} + +// NewLeaseLister returns a new LeaseLister. +func NewLeaseLister(indexer cache.Indexer) LeaseLister { + return &leaseLister{indexer: indexer} +} + +// List lists all Leases in the indexer. +func (s *leaseLister) List(selector labels.Selector) (ret []*v1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get Leases. +func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { + return leaseNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LeaseNamespaceLister helps list and get Leases. +// All objects returned here must be treated as read-only. +type LeaseNamespaceLister interface { + // List lists all Leases in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Lease, err error) + // Get retrieves the Lease from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Lease, error) + LeaseNamespaceListerExpansion +} + +// leaseNamespaceLister implements the LeaseNamespaceLister +// interface. +type leaseNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Leases in the indexer for a given namespace. +func (s leaseNamespaceLister) List(selector labels.Selector) (ret []*v1.Lease, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Lease)) + }) + return ret, err +} + +// Get retrieves the Lease from the indexer for a given namespace and name. +func (s leaseNamespaceLister) Get(name string) (*v1.Lease, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("lease"), name) + } + return obj.(*v1.Lease), nil +} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go new file mode 100644 index 000000000..dddc53107 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// LeaseListerExpansion allows custom methods to be added to +// LeaseLister. +type LeaseListerExpansion interface{} + +// LeaseNamespaceListerExpansion allows custom methods to be added to +// LeaseNamespaceLister. +type LeaseNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go new file mode 100644 index 000000000..8dfdc1e9b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/coordination/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LeaseLister helps list Leases. +// All objects returned here must be treated as read-only. +type LeaseLister interface { + // List lists all Leases in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Lease, err error) + // Leases returns an object that can list and get Leases. + Leases(namespace string) LeaseNamespaceLister + LeaseListerExpansion +} + +// leaseLister implements the LeaseLister interface. +type leaseLister struct { + indexer cache.Indexer +} + +// NewLeaseLister returns a new LeaseLister. +func NewLeaseLister(indexer cache.Indexer) LeaseLister { + return &leaseLister{indexer: indexer} +} + +// List lists all Leases in the indexer. +func (s *leaseLister) List(selector labels.Selector) (ret []*v1beta1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get Leases. +func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { + return leaseNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LeaseNamespaceLister helps list and get Leases. +// All objects returned here must be treated as read-only. +type LeaseNamespaceLister interface { + // List lists all Leases in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Lease, err error) + // Get retrieves the Lease from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Lease, error) + LeaseNamespaceListerExpansion +} + +// leaseNamespaceLister implements the LeaseNamespaceLister +// interface. +type leaseNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Leases in the indexer for a given namespace. +func (s leaseNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Lease, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Lease)) + }) + return ret, err +} + +// Get retrieves the Lease from the indexer for a given namespace and name. +func (s leaseNamespaceLister) Get(name string) (*v1beta1.Lease, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("lease"), name) + } + return obj.(*v1beta1.Lease), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/componentstatus.go b/vendor/k8s.io/client-go/listers/core/v1/componentstatus.go new file mode 100644 index 000000000..5fcdac3c7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/componentstatus.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ComponentStatusLister helps list ComponentStatuses. +// All objects returned here must be treated as read-only. +type ComponentStatusLister interface { + // List lists all ComponentStatuses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ComponentStatus, err error) + // Get retrieves the ComponentStatus from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ComponentStatus, error) + ComponentStatusListerExpansion +} + +// componentStatusLister implements the ComponentStatusLister interface. +type componentStatusLister struct { + indexer cache.Indexer +} + +// NewComponentStatusLister returns a new ComponentStatusLister. +func NewComponentStatusLister(indexer cache.Indexer) ComponentStatusLister { + return &componentStatusLister{indexer: indexer} +} + +// List lists all ComponentStatuses in the indexer. +func (s *componentStatusLister) List(selector labels.Selector) (ret []*v1.ComponentStatus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ComponentStatus)) + }) + return ret, err +} + +// Get retrieves the ComponentStatus from the index for a given name. +func (s *componentStatusLister) Get(name string) (*v1.ComponentStatus, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("componentstatus"), name) + } + return obj.(*v1.ComponentStatus), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/configmap.go b/vendor/k8s.io/client-go/listers/core/v1/configmap.go new file mode 100644 index 000000000..6a410e47c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/configmap.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ConfigMapLister helps list ConfigMaps. +// All objects returned here must be treated as read-only. +type ConfigMapLister interface { + // List lists all ConfigMaps in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ConfigMap, err error) + // ConfigMaps returns an object that can list and get ConfigMaps. + ConfigMaps(namespace string) ConfigMapNamespaceLister + ConfigMapListerExpansion +} + +// configMapLister implements the ConfigMapLister interface. +type configMapLister struct { + indexer cache.Indexer +} + +// NewConfigMapLister returns a new ConfigMapLister. +func NewConfigMapLister(indexer cache.Indexer) ConfigMapLister { + return &configMapLister{indexer: indexer} +} + +// List lists all ConfigMaps in the indexer. +func (s *configMapLister) List(selector labels.Selector) (ret []*v1.ConfigMap, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ConfigMap)) + }) + return ret, err +} + +// ConfigMaps returns an object that can list and get ConfigMaps. +func (s *configMapLister) ConfigMaps(namespace string) ConfigMapNamespaceLister { + return configMapNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ConfigMapNamespaceLister helps list and get ConfigMaps. +// All objects returned here must be treated as read-only. +type ConfigMapNamespaceLister interface { + // List lists all ConfigMaps in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ConfigMap, err error) + // Get retrieves the ConfigMap from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ConfigMap, error) + ConfigMapNamespaceListerExpansion +} + +// configMapNamespaceLister implements the ConfigMapNamespaceLister +// interface. +type configMapNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ConfigMaps in the indexer for a given namespace. +func (s configMapNamespaceLister) List(selector labels.Selector) (ret []*v1.ConfigMap, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ConfigMap)) + }) + return ret, err +} + +// Get retrieves the ConfigMap from the indexer for a given namespace and name. +func (s configMapNamespaceLister) Get(name string) (*v1.ConfigMap, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("configmap"), name) + } + return obj.(*v1.ConfigMap), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/endpoints.go b/vendor/k8s.io/client-go/listers/core/v1/endpoints.go new file mode 100644 index 000000000..4759ce808 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/endpoints.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointsLister helps list Endpoints. +// All objects returned here must be treated as read-only. +type EndpointsLister interface { + // List lists all Endpoints in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Endpoints, err error) + // Endpoints returns an object that can list and get Endpoints. + Endpoints(namespace string) EndpointsNamespaceLister + EndpointsListerExpansion +} + +// endpointsLister implements the EndpointsLister interface. +type endpointsLister struct { + indexer cache.Indexer +} + +// NewEndpointsLister returns a new EndpointsLister. +func NewEndpointsLister(indexer cache.Indexer) EndpointsLister { + return &endpointsLister{indexer: indexer} +} + +// List lists all Endpoints in the indexer. +func (s *endpointsLister) List(selector labels.Selector) (ret []*v1.Endpoints, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Endpoints)) + }) + return ret, err +} + +// Endpoints returns an object that can list and get Endpoints. +func (s *endpointsLister) Endpoints(namespace string) EndpointsNamespaceLister { + return endpointsNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointsNamespaceLister helps list and get Endpoints. +// All objects returned here must be treated as read-only. +type EndpointsNamespaceLister interface { + // List lists all Endpoints in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Endpoints, err error) + // Get retrieves the Endpoints from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Endpoints, error) + EndpointsNamespaceListerExpansion +} + +// endpointsNamespaceLister implements the EndpointsNamespaceLister +// interface. +type endpointsNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Endpoints in the indexer for a given namespace. +func (s endpointsNamespaceLister) List(selector labels.Selector) (ret []*v1.Endpoints, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Endpoints)) + }) + return ret, err +} + +// Get retrieves the Endpoints from the indexer for a given namespace and name. +func (s endpointsNamespaceLister) Get(name string) (*v1.Endpoints, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("endpoints"), name) + } + return obj.(*v1.Endpoints), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/event.go b/vendor/k8s.io/client-go/listers/core/v1/event.go new file mode 100644 index 000000000..4416e2012 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/event.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("event"), name) + } + return obj.(*v1.Event), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go new file mode 100644 index 000000000..2168a7f48 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go @@ -0,0 +1,123 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// ComponentStatusListerExpansion allows custom methods to be added to +// ComponentStatusLister. +type ComponentStatusListerExpansion interface{} + +// ConfigMapListerExpansion allows custom methods to be added to +// ConfigMapLister. +type ConfigMapListerExpansion interface{} + +// ConfigMapNamespaceListerExpansion allows custom methods to be added to +// ConfigMapNamespaceLister. +type ConfigMapNamespaceListerExpansion interface{} + +// EndpointsListerExpansion allows custom methods to be added to +// EndpointsLister. +type EndpointsListerExpansion interface{} + +// EndpointsNamespaceListerExpansion allows custom methods to be added to +// EndpointsNamespaceLister. +type EndpointsNamespaceListerExpansion interface{} + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} + +// LimitRangeListerExpansion allows custom methods to be added to +// LimitRangeLister. +type LimitRangeListerExpansion interface{} + +// LimitRangeNamespaceListerExpansion allows custom methods to be added to +// LimitRangeNamespaceLister. +type LimitRangeNamespaceListerExpansion interface{} + +// NamespaceListerExpansion allows custom methods to be added to +// NamespaceLister. +type NamespaceListerExpansion interface{} + +// NodeListerExpansion allows custom methods to be added to +// NodeLister. +type NodeListerExpansion interface{} + +// PersistentVolumeListerExpansion allows custom methods to be added to +// PersistentVolumeLister. +type PersistentVolumeListerExpansion interface{} + +// PersistentVolumeClaimListerExpansion allows custom methods to be added to +// PersistentVolumeClaimLister. +type PersistentVolumeClaimListerExpansion interface{} + +// PersistentVolumeClaimNamespaceListerExpansion allows custom methods to be added to +// PersistentVolumeClaimNamespaceLister. +type PersistentVolumeClaimNamespaceListerExpansion interface{} + +// PodListerExpansion allows custom methods to be added to +// PodLister. +type PodListerExpansion interface{} + +// PodNamespaceListerExpansion allows custom methods to be added to +// PodNamespaceLister. +type PodNamespaceListerExpansion interface{} + +// PodTemplateListerExpansion allows custom methods to be added to +// PodTemplateLister. +type PodTemplateListerExpansion interface{} + +// PodTemplateNamespaceListerExpansion allows custom methods to be added to +// PodTemplateNamespaceLister. +type PodTemplateNamespaceListerExpansion interface{} + +// ResourceQuotaListerExpansion allows custom methods to be added to +// ResourceQuotaLister. +type ResourceQuotaListerExpansion interface{} + +// ResourceQuotaNamespaceListerExpansion allows custom methods to be added to +// ResourceQuotaNamespaceLister. +type ResourceQuotaNamespaceListerExpansion interface{} + +// SecretListerExpansion allows custom methods to be added to +// SecretLister. +type SecretListerExpansion interface{} + +// SecretNamespaceListerExpansion allows custom methods to be added to +// SecretNamespaceLister. +type SecretNamespaceListerExpansion interface{} + +// ServiceListerExpansion allows custom methods to be added to +// ServiceLister. +type ServiceListerExpansion interface{} + +// ServiceNamespaceListerExpansion allows custom methods to be added to +// ServiceNamespaceLister. +type ServiceNamespaceListerExpansion interface{} + +// ServiceAccountListerExpansion allows custom methods to be added to +// ServiceAccountLister. +type ServiceAccountListerExpansion interface{} + +// ServiceAccountNamespaceListerExpansion allows custom methods to be added to +// ServiceAccountNamespaceLister. +type ServiceAccountNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/core/v1/limitrange.go b/vendor/k8s.io/client-go/listers/core/v1/limitrange.go new file mode 100644 index 000000000..d8fa569cd --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/limitrange.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LimitRangeLister helps list LimitRanges. +// All objects returned here must be treated as read-only. +type LimitRangeLister interface { + // List lists all LimitRanges in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.LimitRange, err error) + // LimitRanges returns an object that can list and get LimitRanges. + LimitRanges(namespace string) LimitRangeNamespaceLister + LimitRangeListerExpansion +} + +// limitRangeLister implements the LimitRangeLister interface. +type limitRangeLister struct { + indexer cache.Indexer +} + +// NewLimitRangeLister returns a new LimitRangeLister. +func NewLimitRangeLister(indexer cache.Indexer) LimitRangeLister { + return &limitRangeLister{indexer: indexer} +} + +// List lists all LimitRanges in the indexer. +func (s *limitRangeLister) List(selector labels.Selector) (ret []*v1.LimitRange, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.LimitRange)) + }) + return ret, err +} + +// LimitRanges returns an object that can list and get LimitRanges. +func (s *limitRangeLister) LimitRanges(namespace string) LimitRangeNamespaceLister { + return limitRangeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LimitRangeNamespaceLister helps list and get LimitRanges. +// All objects returned here must be treated as read-only. +type LimitRangeNamespaceLister interface { + // List lists all LimitRanges in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.LimitRange, err error) + // Get retrieves the LimitRange from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.LimitRange, error) + LimitRangeNamespaceListerExpansion +} + +// limitRangeNamespaceLister implements the LimitRangeNamespaceLister +// interface. +type limitRangeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all LimitRanges in the indexer for a given namespace. +func (s limitRangeNamespaceLister) List(selector labels.Selector) (ret []*v1.LimitRange, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.LimitRange)) + }) + return ret, err +} + +// Get retrieves the LimitRange from the indexer for a given namespace and name. +func (s limitRangeNamespaceLister) Get(name string) (*v1.LimitRange, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("limitrange"), name) + } + return obj.(*v1.LimitRange), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/namespace.go b/vendor/k8s.io/client-go/listers/core/v1/namespace.go new file mode 100644 index 000000000..454aa1a0a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/namespace.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NamespaceLister helps list Namespaces. +// All objects returned here must be treated as read-only. +type NamespaceLister interface { + // List lists all Namespaces in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Namespace, err error) + // Get retrieves the Namespace from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Namespace, error) + NamespaceListerExpansion +} + +// namespaceLister implements the NamespaceLister interface. +type namespaceLister struct { + indexer cache.Indexer +} + +// NewNamespaceLister returns a new NamespaceLister. +func NewNamespaceLister(indexer cache.Indexer) NamespaceLister { + return &namespaceLister{indexer: indexer} +} + +// List lists all Namespaces in the indexer. +func (s *namespaceLister) List(selector labels.Selector) (ret []*v1.Namespace, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Namespace)) + }) + return ret, err +} + +// Get retrieves the Namespace from the index for a given name. +func (s *namespaceLister) Get(name string) (*v1.Namespace, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("namespace"), name) + } + return obj.(*v1.Namespace), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/node.go b/vendor/k8s.io/client-go/listers/core/v1/node.go new file mode 100644 index 000000000..596049857 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/node.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NodeLister helps list Nodes. +// All objects returned here must be treated as read-only. +type NodeLister interface { + // List lists all Nodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Node, err error) + // Get retrieves the Node from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Node, error) + NodeListerExpansion +} + +// nodeLister implements the NodeLister interface. +type nodeLister struct { + indexer cache.Indexer +} + +// NewNodeLister returns a new NodeLister. +func NewNodeLister(indexer cache.Indexer) NodeLister { + return &nodeLister{indexer: indexer} +} + +// List lists all Nodes in the indexer. +func (s *nodeLister) List(selector labels.Selector) (ret []*v1.Node, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Node)) + }) + return ret, err +} + +// Get retrieves the Node from the index for a given name. +func (s *nodeLister) Get(name string) (*v1.Node, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("node"), name) + } + return obj.(*v1.Node), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go new file mode 100644 index 000000000..e7dfd4ac9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeLister helps list PersistentVolumes. +// All objects returned here must be treated as read-only. +type PersistentVolumeLister interface { + // List lists all PersistentVolumes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolume, err error) + // Get retrieves the PersistentVolume from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PersistentVolume, error) + PersistentVolumeListerExpansion +} + +// persistentVolumeLister implements the PersistentVolumeLister interface. +type persistentVolumeLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeLister returns a new PersistentVolumeLister. +func NewPersistentVolumeLister(indexer cache.Indexer) PersistentVolumeLister { + return &persistentVolumeLister{indexer: indexer} +} + +// List lists all PersistentVolumes in the indexer. +func (s *persistentVolumeLister) List(selector labels.Selector) (ret []*v1.PersistentVolume, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolume)) + }) + return ret, err +} + +// Get retrieves the PersistentVolume from the index for a given name. +func (s *persistentVolumeLister) Get(name string) (*v1.PersistentVolume, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("persistentvolume"), name) + } + return obj.(*v1.PersistentVolume), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..fc71bb5a1 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeClaimLister helps list PersistentVolumeClaims. +// All objects returned here must be treated as read-only. +type PersistentVolumeClaimLister interface { + // List lists all PersistentVolumeClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) + // PersistentVolumeClaims returns an object that can list and get PersistentVolumeClaims. + PersistentVolumeClaims(namespace string) PersistentVolumeClaimNamespaceLister + PersistentVolumeClaimListerExpansion +} + +// persistentVolumeClaimLister implements the PersistentVolumeClaimLister interface. +type persistentVolumeClaimLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeClaimLister returns a new PersistentVolumeClaimLister. +func NewPersistentVolumeClaimLister(indexer cache.Indexer) PersistentVolumeClaimLister { + return &persistentVolumeClaimLister{indexer: indexer} +} + +// List lists all PersistentVolumeClaims in the indexer. +func (s *persistentVolumeClaimLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolumeClaim)) + }) + return ret, err +} + +// PersistentVolumeClaims returns an object that can list and get PersistentVolumeClaims. +func (s *persistentVolumeClaimLister) PersistentVolumeClaims(namespace string) PersistentVolumeClaimNamespaceLister { + return persistentVolumeClaimNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PersistentVolumeClaimNamespaceLister helps list and get PersistentVolumeClaims. +// All objects returned here must be treated as read-only. +type PersistentVolumeClaimNamespaceLister interface { + // List lists all PersistentVolumeClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) + // Get retrieves the PersistentVolumeClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PersistentVolumeClaim, error) + PersistentVolumeClaimNamespaceListerExpansion +} + +// persistentVolumeClaimNamespaceLister implements the PersistentVolumeClaimNamespaceLister +// interface. +type persistentVolumeClaimNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PersistentVolumeClaims in the indexer for a given namespace. +func (s persistentVolumeClaimNamespaceLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolumeClaim)) + }) + return ret, err +} + +// Get retrieves the PersistentVolumeClaim from the indexer for a given namespace and name. +func (s persistentVolumeClaimNamespaceLister) Get(name string) (*v1.PersistentVolumeClaim, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("persistentvolumeclaim"), name) + } + return obj.(*v1.PersistentVolumeClaim), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/pod.go b/vendor/k8s.io/client-go/listers/core/v1/pod.go new file mode 100644 index 000000000..ab8f0946c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/pod.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodLister helps list Pods. +// All objects returned here must be treated as read-only. +type PodLister interface { + // List lists all Pods in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Pod, err error) + // Pods returns an object that can list and get Pods. + Pods(namespace string) PodNamespaceLister + PodListerExpansion +} + +// podLister implements the PodLister interface. +type podLister struct { + indexer cache.Indexer +} + +// NewPodLister returns a new PodLister. +func NewPodLister(indexer cache.Indexer) PodLister { + return &podLister{indexer: indexer} +} + +// List lists all Pods in the indexer. +func (s *podLister) List(selector labels.Selector) (ret []*v1.Pod, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Pod)) + }) + return ret, err +} + +// Pods returns an object that can list and get Pods. +func (s *podLister) Pods(namespace string) PodNamespaceLister { + return podNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodNamespaceLister helps list and get Pods. +// All objects returned here must be treated as read-only. +type PodNamespaceLister interface { + // List lists all Pods in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Pod, err error) + // Get retrieves the Pod from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Pod, error) + PodNamespaceListerExpansion +} + +// podNamespaceLister implements the PodNamespaceLister +// interface. +type podNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Pods in the indexer for a given namespace. +func (s podNamespaceLister) List(selector labels.Selector) (ret []*v1.Pod, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Pod)) + }) + return ret, err +} + +// Get retrieves the Pod from the indexer for a given namespace and name. +func (s podNamespaceLister) Get(name string) (*v1.Pod, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("pod"), name) + } + return obj.(*v1.Pod), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/podtemplate.go b/vendor/k8s.io/client-go/listers/core/v1/podtemplate.go new file mode 100644 index 000000000..6c310045b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/podtemplate.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodTemplateLister helps list PodTemplates. +// All objects returned here must be treated as read-only. +type PodTemplateLister interface { + // List lists all PodTemplates in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodTemplate, err error) + // PodTemplates returns an object that can list and get PodTemplates. + PodTemplates(namespace string) PodTemplateNamespaceLister + PodTemplateListerExpansion +} + +// podTemplateLister implements the PodTemplateLister interface. +type podTemplateLister struct { + indexer cache.Indexer +} + +// NewPodTemplateLister returns a new PodTemplateLister. +func NewPodTemplateLister(indexer cache.Indexer) PodTemplateLister { + return &podTemplateLister{indexer: indexer} +} + +// List lists all PodTemplates in the indexer. +func (s *podTemplateLister) List(selector labels.Selector) (ret []*v1.PodTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodTemplate)) + }) + return ret, err +} + +// PodTemplates returns an object that can list and get PodTemplates. +func (s *podTemplateLister) PodTemplates(namespace string) PodTemplateNamespaceLister { + return podTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodTemplateNamespaceLister helps list and get PodTemplates. +// All objects returned here must be treated as read-only. +type PodTemplateNamespaceLister interface { + // List lists all PodTemplates in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodTemplate, err error) + // Get retrieves the PodTemplate from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PodTemplate, error) + PodTemplateNamespaceListerExpansion +} + +// podTemplateNamespaceLister implements the PodTemplateNamespaceLister +// interface. +type podTemplateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodTemplates in the indexer for a given namespace. +func (s podTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1.PodTemplate, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodTemplate)) + }) + return ret, err +} + +// Get retrieves the PodTemplate from the indexer for a given namespace and name. +func (s podTemplateNamespaceLister) Get(name string) (*v1.PodTemplate, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("podtemplate"), name) + } + return obj.(*v1.PodTemplate), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go new file mode 100644 index 000000000..e28e2ef76 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicationControllerLister helps list ReplicationControllers. +// All objects returned here must be treated as read-only. +type ReplicationControllerLister interface { + // List lists all ReplicationControllers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicationController, err error) + // ReplicationControllers returns an object that can list and get ReplicationControllers. + ReplicationControllers(namespace string) ReplicationControllerNamespaceLister + ReplicationControllerListerExpansion +} + +// replicationControllerLister implements the ReplicationControllerLister interface. +type replicationControllerLister struct { + indexer cache.Indexer +} + +// NewReplicationControllerLister returns a new ReplicationControllerLister. +func NewReplicationControllerLister(indexer cache.Indexer) ReplicationControllerLister { + return &replicationControllerLister{indexer: indexer} +} + +// List lists all ReplicationControllers in the indexer. +func (s *replicationControllerLister) List(selector labels.Selector) (ret []*v1.ReplicationController, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicationController)) + }) + return ret, err +} + +// ReplicationControllers returns an object that can list and get ReplicationControllers. +func (s *replicationControllerLister) ReplicationControllers(namespace string) ReplicationControllerNamespaceLister { + return replicationControllerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicationControllerNamespaceLister helps list and get ReplicationControllers. +// All objects returned here must be treated as read-only. +type ReplicationControllerNamespaceLister interface { + // List lists all ReplicationControllers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicationController, err error) + // Get retrieves the ReplicationController from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ReplicationController, error) + ReplicationControllerNamespaceListerExpansion +} + +// replicationControllerNamespaceLister implements the ReplicationControllerNamespaceLister +// interface. +type replicationControllerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicationControllers in the indexer for a given namespace. +func (s replicationControllerNamespaceLister) List(selector labels.Selector) (ret []*v1.ReplicationController, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicationController)) + }) + return ret, err +} + +// Get retrieves the ReplicationController from the indexer for a given namespace and name. +func (s replicationControllerNamespaceLister) Get(name string) (*v1.ReplicationController, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("replicationcontroller"), name) + } + return obj.(*v1.ReplicationController), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go new file mode 100644 index 000000000..b031d5217 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go @@ -0,0 +1,66 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicationControllerListerExpansion allows custom methods to be added to +// ReplicationControllerLister. +type ReplicationControllerListerExpansion interface { + GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) +} + +// ReplicationControllerNamespaceListerExpansion allows custom methods to be added to +// ReplicationControllerNamespaceLister. +type ReplicationControllerNamespaceListerExpansion interface{} + +// GetPodControllers returns a list of ReplicationControllers that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicationControllers are found. +func (s *replicationControllerLister) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no controllers found for pod %v because it has no labels", pod.Name) + } + + items, err := s.ReplicationControllers(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var controllers []*v1.ReplicationController + for i := range items { + rc := items[i] + selector := labels.Set(rc.Spec.Selector).AsSelectorPreValidated() + + // If an rc with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + controllers = append(controllers, rc) + } + + if len(controllers) == 0 { + return nil, fmt.Errorf("could not find controller for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return controllers, nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/resourcequota.go b/vendor/k8s.io/client-go/listers/core/v1/resourcequota.go new file mode 100644 index 000000000..9c00b49d4 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/resourcequota.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceQuotaLister helps list ResourceQuotas. +// All objects returned here must be treated as read-only. +type ResourceQuotaLister interface { + // List lists all ResourceQuotas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) + // ResourceQuotas returns an object that can list and get ResourceQuotas. + ResourceQuotas(namespace string) ResourceQuotaNamespaceLister + ResourceQuotaListerExpansion +} + +// resourceQuotaLister implements the ResourceQuotaLister interface. +type resourceQuotaLister struct { + indexer cache.Indexer +} + +// NewResourceQuotaLister returns a new ResourceQuotaLister. +func NewResourceQuotaLister(indexer cache.Indexer) ResourceQuotaLister { + return &resourceQuotaLister{indexer: indexer} +} + +// List lists all ResourceQuotas in the indexer. +func (s *resourceQuotaLister) List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceQuota)) + }) + return ret, err +} + +// ResourceQuotas returns an object that can list and get ResourceQuotas. +func (s *resourceQuotaLister) ResourceQuotas(namespace string) ResourceQuotaNamespaceLister { + return resourceQuotaNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceQuotaNamespaceLister helps list and get ResourceQuotas. +// All objects returned here must be treated as read-only. +type ResourceQuotaNamespaceLister interface { + // List lists all ResourceQuotas in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) + // Get retrieves the ResourceQuota from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceQuota, error) + ResourceQuotaNamespaceListerExpansion +} + +// resourceQuotaNamespaceLister implements the ResourceQuotaNamespaceLister +// interface. +type resourceQuotaNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceQuotas in the indexer for a given namespace. +func (s resourceQuotaNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceQuota)) + }) + return ret, err +} + +// Get retrieves the ResourceQuota from the indexer for a given namespace and name. +func (s resourceQuotaNamespaceLister) Get(name string) (*v1.ResourceQuota, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("resourcequota"), name) + } + return obj.(*v1.ResourceQuota), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/secret.go b/vendor/k8s.io/client-go/listers/core/v1/secret.go new file mode 100644 index 000000000..d386d4d5c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/secret.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SecretLister helps list Secrets. +// All objects returned here must be treated as read-only. +type SecretLister interface { + // List lists all Secrets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Secret, err error) + // Secrets returns an object that can list and get Secrets. + Secrets(namespace string) SecretNamespaceLister + SecretListerExpansion +} + +// secretLister implements the SecretLister interface. +type secretLister struct { + indexer cache.Indexer +} + +// NewSecretLister returns a new SecretLister. +func NewSecretLister(indexer cache.Indexer) SecretLister { + return &secretLister{indexer: indexer} +} + +// List lists all Secrets in the indexer. +func (s *secretLister) List(selector labels.Selector) (ret []*v1.Secret, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Secret)) + }) + return ret, err +} + +// Secrets returns an object that can list and get Secrets. +func (s *secretLister) Secrets(namespace string) SecretNamespaceLister { + return secretNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SecretNamespaceLister helps list and get Secrets. +// All objects returned here must be treated as read-only. +type SecretNamespaceLister interface { + // List lists all Secrets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Secret, err error) + // Get retrieves the Secret from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Secret, error) + SecretNamespaceListerExpansion +} + +// secretNamespaceLister implements the SecretNamespaceLister +// interface. +type secretNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Secrets in the indexer for a given namespace. +func (s secretNamespaceLister) List(selector labels.Selector) (ret []*v1.Secret, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Secret)) + }) + return ret, err +} + +// Get retrieves the Secret from the indexer for a given namespace and name. +func (s secretNamespaceLister) Get(name string) (*v1.Secret, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("secret"), name) + } + return obj.(*v1.Secret), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/service.go b/vendor/k8s.io/client-go/listers/core/v1/service.go new file mode 100644 index 000000000..51026d7b4 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/service.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceLister helps list Services. +// All objects returned here must be treated as read-only. +type ServiceLister interface { + // List lists all Services in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Service, err error) + // Services returns an object that can list and get Services. + Services(namespace string) ServiceNamespaceLister + ServiceListerExpansion +} + +// serviceLister implements the ServiceLister interface. +type serviceLister struct { + indexer cache.Indexer +} + +// NewServiceLister returns a new ServiceLister. +func NewServiceLister(indexer cache.Indexer) ServiceLister { + return &serviceLister{indexer: indexer} +} + +// List lists all Services in the indexer. +func (s *serviceLister) List(selector labels.Selector) (ret []*v1.Service, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Service)) + }) + return ret, err +} + +// Services returns an object that can list and get Services. +func (s *serviceLister) Services(namespace string) ServiceNamespaceLister { + return serviceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceNamespaceLister helps list and get Services. +// All objects returned here must be treated as read-only. +type ServiceNamespaceLister interface { + // List lists all Services in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Service, err error) + // Get retrieves the Service from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Service, error) + ServiceNamespaceListerExpansion +} + +// serviceNamespaceLister implements the ServiceNamespaceLister +// interface. +type serviceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Services in the indexer for a given namespace. +func (s serviceNamespaceLister) List(selector labels.Selector) (ret []*v1.Service, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Service)) + }) + return ret, err +} + +// Get retrieves the Service from the indexer for a given namespace and name. +func (s serviceNamespaceLister) Get(name string) (*v1.Service, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("service"), name) + } + return obj.(*v1.Service), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go new file mode 100644 index 000000000..aa9554d8b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceAccountLister helps list ServiceAccounts. +// All objects returned here must be treated as read-only. +type ServiceAccountLister interface { + // List lists all ServiceAccounts in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) + // ServiceAccounts returns an object that can list and get ServiceAccounts. + ServiceAccounts(namespace string) ServiceAccountNamespaceLister + ServiceAccountListerExpansion +} + +// serviceAccountLister implements the ServiceAccountLister interface. +type serviceAccountLister struct { + indexer cache.Indexer +} + +// NewServiceAccountLister returns a new ServiceAccountLister. +func NewServiceAccountLister(indexer cache.Indexer) ServiceAccountLister { + return &serviceAccountLister{indexer: indexer} +} + +// List lists all ServiceAccounts in the indexer. +func (s *serviceAccountLister) List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceAccount)) + }) + return ret, err +} + +// ServiceAccounts returns an object that can list and get ServiceAccounts. +func (s *serviceAccountLister) ServiceAccounts(namespace string) ServiceAccountNamespaceLister { + return serviceAccountNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceAccountNamespaceLister helps list and get ServiceAccounts. +// All objects returned here must be treated as read-only. +type ServiceAccountNamespaceLister interface { + // List lists all ServiceAccounts in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) + // Get retrieves the ServiceAccount from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ServiceAccount, error) + ServiceAccountNamespaceListerExpansion +} + +// serviceAccountNamespaceLister implements the ServiceAccountNamespaceLister +// interface. +type serviceAccountNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ServiceAccounts in the indexer for a given namespace. +func (s serviceAccountNamespaceLister) List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceAccount)) + }) + return ret, err +} + +// Get retrieves the ServiceAccount from the indexer for a given namespace and name. +func (s serviceAccountNamespaceLister) Get(name string) (*v1.ServiceAccount, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("serviceaccount"), name) + } + return obj.(*v1.ServiceAccount), nil +} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go new file mode 100644 index 000000000..4dd46ff1b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/discovery/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointSliceLister helps list EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceLister interface { + // List lists all EndpointSlices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) + // EndpointSlices returns an object that can list and get EndpointSlices. + EndpointSlices(namespace string) EndpointSliceNamespaceLister + EndpointSliceListerExpansion +} + +// endpointSliceLister implements the EndpointSliceLister interface. +type endpointSliceLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceLister returns a new EndpointSliceLister. +func NewEndpointSliceLister(indexer cache.Indexer) EndpointSliceLister { + return &endpointSliceLister{indexer: indexer} +} + +// List lists all EndpointSlices in the indexer. +func (s *endpointSliceLister) List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get EndpointSlices. +func (s *endpointSliceLister) EndpointSlices(namespace string) EndpointSliceNamespaceLister { + return endpointSliceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointSliceNamespaceLister helps list and get EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceNamespaceLister interface { + // List lists all EndpointSlices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) + // Get retrieves the EndpointSlice from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.EndpointSlice, error) + EndpointSliceNamespaceListerExpansion +} + +// endpointSliceNamespaceLister implements the EndpointSliceNamespaceLister +// interface. +type endpointSliceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EndpointSlices in the indexer for a given namespace. +func (s endpointSliceNamespaceLister) List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EndpointSlice)) + }) + return ret, err +} + +// Get retrieves the EndpointSlice from the indexer for a given namespace and name. +func (s endpointSliceNamespaceLister) Get(name string) (*v1.EndpointSlice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("endpointslice"), name) + } + return obj.(*v1.EndpointSlice), nil +} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go new file mode 100644 index 000000000..660163eee --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// EndpointSliceListerExpansion allows custom methods to be added to +// EndpointSliceLister. +type EndpointSliceListerExpansion interface{} + +// EndpointSliceNamespaceListerExpansion allows custom methods to be added to +// EndpointSliceNamespaceLister. +type EndpointSliceNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go new file mode 100644 index 000000000..e92872d5f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/discovery/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointSliceLister helps list EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceLister interface { + // List lists all EndpointSlices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) + // EndpointSlices returns an object that can list and get EndpointSlices. + EndpointSlices(namespace string) EndpointSliceNamespaceLister + EndpointSliceListerExpansion +} + +// endpointSliceLister implements the EndpointSliceLister interface. +type endpointSliceLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceLister returns a new EndpointSliceLister. +func NewEndpointSliceLister(indexer cache.Indexer) EndpointSliceLister { + return &endpointSliceLister{indexer: indexer} +} + +// List lists all EndpointSlices in the indexer. +func (s *endpointSliceLister) List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get EndpointSlices. +func (s *endpointSliceLister) EndpointSlices(namespace string) EndpointSliceNamespaceLister { + return endpointSliceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointSliceNamespaceLister helps list and get EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceNamespaceLister interface { + // List lists all EndpointSlices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) + // Get retrieves the EndpointSlice from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.EndpointSlice, error) + EndpointSliceNamespaceListerExpansion +} + +// endpointSliceNamespaceLister implements the EndpointSliceNamespaceLister +// interface. +type endpointSliceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EndpointSlices in the indexer for a given namespace. +func (s endpointSliceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.EndpointSlice)) + }) + return ret, err +} + +// Get retrieves the EndpointSlice from the indexer for a given namespace and name. +func (s endpointSliceNamespaceLister) Get(name string) (*v1beta1.EndpointSlice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("endpointslice"), name) + } + return obj.(*v1beta1.EndpointSlice), nil +} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go new file mode 100644 index 000000000..9619bbd8d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// EndpointSliceListerExpansion allows custom methods to be added to +// EndpointSliceLister. +type EndpointSliceListerExpansion interface{} + +// EndpointSliceNamespaceListerExpansion allows custom methods to be added to +// EndpointSliceNamespaceLister. +type EndpointSliceNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/events/v1/event.go b/vendor/k8s.io/client-go/listers/events/v1/event.go new file mode 100644 index 000000000..4abe841e2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1/event.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/events/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("event"), name) + } + return obj.(*v1.Event), nil +} diff --git a/vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go new file mode 100644 index 000000000..348e784d7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/events/v1beta1/event.go b/vendor/k8s.io/client-go/listers/events/v1beta1/event.go new file mode 100644 index 000000000..41a521be6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1beta1/event.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/events/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1beta1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1beta1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("event"), name) + } + return obj.(*v1beta1.Event), nil +} diff --git a/vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go new file mode 100644 index 000000000..d311691d9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go new file mode 100644 index 000000000..900475410 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1beta1.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("daemonset"), name) + } + return obj.(*v1beta1.DaemonSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go new file mode 100644 index 000000000..336a4ed83 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go @@ -0,0 +1,114 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta1" + "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface { + GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) + GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) +} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) { + var selector labels.Selector + var daemonSet *v1beta1.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*v1beta1.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*v1beta1.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go new file mode 100644 index 000000000..42b5a0723 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1beta1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("deployment"), name) + } + return obj.(*v1beta1.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go new file mode 100644 index 000000000..5599219d9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go @@ -0,0 +1,47 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} + +// IngressListerExpansion allows custom methods to be added to +// IngressLister. +type IngressListerExpansion interface{} + +// IngressNamespaceListerExpansion allows custom methods to be added to +// IngressNamespaceLister. +type IngressNamespaceListerExpansion interface{} + +// NetworkPolicyListerExpansion allows custom methods to be added to +// NetworkPolicyLister. +type NetworkPolicyListerExpansion interface{} + +// NetworkPolicyNamespaceListerExpansion allows custom methods to be added to +// NetworkPolicyNamespaceLister. +type NetworkPolicyNamespaceListerExpansion interface{} + +// PodSecurityPolicyListerExpansion allows custom methods to be added to +// PodSecurityPolicyLister. +type PodSecurityPolicyListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go new file mode 100644 index 000000000..1cb7677bd --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressLister helps list Ingresses. +// All objects returned here must be treated as read-only. +type IngressLister interface { + // List lists all Ingresses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Ingresses returns an object that can list and get Ingresses. + Ingresses(namespace string) IngressNamespaceLister + IngressListerExpansion +} + +// ingressLister implements the IngressLister interface. +type ingressLister struct { + indexer cache.Indexer +} + +// NewIngressLister returns a new IngressLister. +func NewIngressLister(indexer cache.Indexer) IngressLister { + return &ingressLister{indexer: indexer} +} + +// List lists all Ingresses in the indexer. +func (s *ingressLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get Ingresses. +func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { + return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IngressNamespaceLister helps list and get Ingresses. +// All objects returned here must be treated as read-only. +type IngressNamespaceLister interface { + // List lists all Ingresses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Get retrieves the Ingress from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Ingress, error) + IngressNamespaceListerExpansion +} + +// ingressNamespaceLister implements the IngressNamespaceLister +// interface. +type ingressNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Ingresses in the indexer for a given namespace. +func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Get retrieves the Ingress from the indexer for a given namespace and name. +func (s ingressNamespaceLister) Get(name string) (*v1beta1.Ingress, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("ingress"), name) + } + return obj.(*v1beta1.Ingress), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go new file mode 100644 index 000000000..84419a8e9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyLister helps list NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyLister interface { + // List lists all NetworkPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) + // NetworkPolicies returns an object that can list and get NetworkPolicies. + NetworkPolicies(namespace string) NetworkPolicyNamespaceLister + NetworkPolicyListerExpansion +} + +// networkPolicyLister implements the NetworkPolicyLister interface. +type networkPolicyLister struct { + indexer cache.Indexer +} + +// NewNetworkPolicyLister returns a new NetworkPolicyLister. +func NewNetworkPolicyLister(indexer cache.Indexer) NetworkPolicyLister { + return &networkPolicyLister{indexer: indexer} +} + +// List lists all NetworkPolicies in the indexer. +func (s *networkPolicyLister) List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.NetworkPolicy)) + }) + return ret, err +} + +// NetworkPolicies returns an object that can list and get NetworkPolicies. +func (s *networkPolicyLister) NetworkPolicies(namespace string) NetworkPolicyNamespaceLister { + return networkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkPolicyNamespaceLister helps list and get NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyNamespaceLister interface { + // List lists all NetworkPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) + // Get retrieves the NetworkPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.NetworkPolicy, error) + NetworkPolicyNamespaceListerExpansion +} + +// networkPolicyNamespaceLister implements the NetworkPolicyNamespaceLister +// interface. +type networkPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkPolicies in the indexer for a given namespace. +func (s networkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.NetworkPolicy)) + }) + return ret, err +} + +// Get retrieves the NetworkPolicy from the indexer for a given namespace and name. +func (s networkPolicyNamespaceLister) Get(name string) (*v1beta1.NetworkPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("networkpolicy"), name) + } + return obj.(*v1beta1.NetworkPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..5f6a8c036 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyLister helps list PodSecurityPolicies. +// All objects returned here must be treated as read-only. +type PodSecurityPolicyLister interface { + // List lists all PodSecurityPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) + // Get retrieves the PodSecurityPolicy from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PodSecurityPolicy, error) + PodSecurityPolicyListerExpansion +} + +// podSecurityPolicyLister implements the PodSecurityPolicyLister interface. +type podSecurityPolicyLister struct { + indexer cache.Indexer +} + +// NewPodSecurityPolicyLister returns a new PodSecurityPolicyLister. +func NewPodSecurityPolicyLister(indexer cache.Indexer) PodSecurityPolicyLister { + return &podSecurityPolicyLister{indexer: indexer} +} + +// List lists all PodSecurityPolicies in the indexer. +func (s *podSecurityPolicyLister) List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodSecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the PodSecurityPolicy from the index for a given name. +func (s *podSecurityPolicyLister) Get(name string) (*v1beta1.PodSecurityPolicy, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("podsecuritypolicy"), name) + } + return obj.(*v1beta1.PodSecurityPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go new file mode 100644 index 000000000..a5ec3229b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1beta1.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("replicaset"), name) + } + return obj.(*v1beta1.ReplicaSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go new file mode 100644 index 000000000..1f72644cc --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + extensions "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface { + GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) +} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*extensions.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..3e7405168 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// FlowSchemaListerExpansion allows custom methods to be added to +// FlowSchemaLister. +type FlowSchemaListerExpansion interface{} + +// PriorityLevelConfigurationListerExpansion allows custom methods to be added to +// PriorityLevelConfigurationLister. +type PriorityLevelConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go new file mode 100644 index 000000000..c8a595cd2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FlowSchemaLister helps list FlowSchemas. +// All objects returned here must be treated as read-only. +type FlowSchemaLister interface { + // List lists all FlowSchemas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.FlowSchema, err error) + // Get retrieves the FlowSchema from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.FlowSchema, error) + FlowSchemaListerExpansion +} + +// flowSchemaLister implements the FlowSchemaLister interface. +type flowSchemaLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaLister returns a new FlowSchemaLister. +func NewFlowSchemaLister(indexer cache.Indexer) FlowSchemaLister { + return &flowSchemaLister{indexer: indexer} +} + +// List lists all FlowSchemas in the indexer. +func (s *flowSchemaLister) List(selector labels.Selector) (ret []*v1alpha1.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the FlowSchema from the index for a given name. +func (s *flowSchemaLister) Get(name string) (*v1alpha1.FlowSchema, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("flowschema"), name) + } + return obj.(*v1alpha1.FlowSchema), nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go new file mode 100644 index 000000000..daa4ff31d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationLister helps list PriorityLevelConfigurations. +// All objects returned here must be treated as read-only. +type PriorityLevelConfigurationLister interface { + // List lists all PriorityLevelConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.PriorityLevelConfiguration, err error) + // Get retrieves the PriorityLevelConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.PriorityLevelConfiguration, error) + PriorityLevelConfigurationListerExpansion +} + +// priorityLevelConfigurationLister implements the PriorityLevelConfigurationLister interface. +type priorityLevelConfigurationLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationLister returns a new PriorityLevelConfigurationLister. +func NewPriorityLevelConfigurationLister(indexer cache.Indexer) PriorityLevelConfigurationLister { + return &priorityLevelConfigurationLister{indexer: indexer} +} + +// List lists all PriorityLevelConfigurations in the indexer. +func (s *priorityLevelConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the PriorityLevelConfiguration from the index for a given name. +func (s *priorityLevelConfigurationLister) Get(name string) (*v1alpha1.PriorityLevelConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("prioritylevelconfiguration"), name) + } + return obj.(*v1alpha1.PriorityLevelConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go new file mode 100644 index 000000000..c674e951e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// FlowSchemaListerExpansion allows custom methods to be added to +// FlowSchemaLister. +type FlowSchemaListerExpansion interface{} + +// PriorityLevelConfigurationListerExpansion allows custom methods to be added to +// PriorityLevelConfigurationLister. +type PriorityLevelConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go new file mode 100644 index 000000000..7927a8411 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FlowSchemaLister helps list FlowSchemas. +// All objects returned here must be treated as read-only. +type FlowSchemaLister interface { + // List lists all FlowSchemas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.FlowSchema, err error) + // Get retrieves the FlowSchema from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.FlowSchema, error) + FlowSchemaListerExpansion +} + +// flowSchemaLister implements the FlowSchemaLister interface. +type flowSchemaLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaLister returns a new FlowSchemaLister. +func NewFlowSchemaLister(indexer cache.Indexer) FlowSchemaLister { + return &flowSchemaLister{indexer: indexer} +} + +// List lists all FlowSchemas in the indexer. +func (s *flowSchemaLister) List(selector labels.Selector) (ret []*v1beta1.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the FlowSchema from the index for a given name. +func (s *flowSchemaLister) Get(name string) (*v1beta1.FlowSchema, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("flowschema"), name) + } + return obj.(*v1beta1.FlowSchema), nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go new file mode 100644 index 000000000..c94aaa4c1 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationLister helps list PriorityLevelConfigurations. +// All objects returned here must be treated as read-only. +type PriorityLevelConfigurationLister interface { + // List lists all PriorityLevelConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PriorityLevelConfiguration, err error) + // Get retrieves the PriorityLevelConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PriorityLevelConfiguration, error) + PriorityLevelConfigurationListerExpansion +} + +// priorityLevelConfigurationLister implements the PriorityLevelConfigurationLister interface. +type priorityLevelConfigurationLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationLister returns a new PriorityLevelConfigurationLister. +func NewPriorityLevelConfigurationLister(indexer cache.Indexer) PriorityLevelConfigurationLister { + return &priorityLevelConfigurationLister{indexer: indexer} +} + +// List lists all PriorityLevelConfigurations in the indexer. +func (s *priorityLevelConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the PriorityLevelConfiguration from the index for a given name. +func (s *priorityLevelConfigurationLister) Get(name string) (*v1beta1.PriorityLevelConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("prioritylevelconfiguration"), name) + } + return obj.(*v1beta1.PriorityLevelConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go new file mode 100644 index 000000000..a380c2418 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go @@ -0,0 +1,39 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// IngressListerExpansion allows custom methods to be added to +// IngressLister. +type IngressListerExpansion interface{} + +// IngressNamespaceListerExpansion allows custom methods to be added to +// IngressNamespaceLister. +type IngressNamespaceListerExpansion interface{} + +// IngressClassListerExpansion allows custom methods to be added to +// IngressClassLister. +type IngressClassListerExpansion interface{} + +// NetworkPolicyListerExpansion allows custom methods to be added to +// NetworkPolicyLister. +type NetworkPolicyListerExpansion interface{} + +// NetworkPolicyNamespaceListerExpansion allows custom methods to be added to +// NetworkPolicyNamespaceLister. +type NetworkPolicyNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/ingress.go b/vendor/k8s.io/client-go/listers/networking/v1/ingress.go new file mode 100644 index 000000000..0f49d4f57 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/ingress.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressLister helps list Ingresses. +// All objects returned here must be treated as read-only. +type IngressLister interface { + // List lists all Ingresses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Ingress, err error) + // Ingresses returns an object that can list and get Ingresses. + Ingresses(namespace string) IngressNamespaceLister + IngressListerExpansion +} + +// ingressLister implements the IngressLister interface. +type ingressLister struct { + indexer cache.Indexer +} + +// NewIngressLister returns a new IngressLister. +func NewIngressLister(indexer cache.Indexer) IngressLister { + return &ingressLister{indexer: indexer} +} + +// List lists all Ingresses in the indexer. +func (s *ingressLister) List(selector labels.Selector) (ret []*v1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get Ingresses. +func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { + return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IngressNamespaceLister helps list and get Ingresses. +// All objects returned here must be treated as read-only. +type IngressNamespaceLister interface { + // List lists all Ingresses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Ingress, err error) + // Get retrieves the Ingress from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Ingress, error) + IngressNamespaceListerExpansion +} + +// ingressNamespaceLister implements the IngressNamespaceLister +// interface. +type ingressNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Ingresses in the indexer for a given namespace. +func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1.Ingress, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Ingress)) + }) + return ret, err +} + +// Get retrieves the Ingress from the indexer for a given namespace and name. +func (s ingressNamespaceLister) Get(name string) (*v1.Ingress, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("ingress"), name) + } + return obj.(*v1.Ingress), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go new file mode 100644 index 000000000..1480cb13f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressClassLister helps list IngressClasses. +// All objects returned here must be treated as read-only. +type IngressClassLister interface { + // List lists all IngressClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.IngressClass, err error) + // Get retrieves the IngressClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.IngressClass, error) + IngressClassListerExpansion +} + +// ingressClassLister implements the IngressClassLister interface. +type ingressClassLister struct { + indexer cache.Indexer +} + +// NewIngressClassLister returns a new IngressClassLister. +func NewIngressClassLister(indexer cache.Indexer) IngressClassLister { + return &ingressClassLister{indexer: indexer} +} + +// List lists all IngressClasses in the indexer. +func (s *ingressClassLister) List(selector labels.Selector) (ret []*v1.IngressClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.IngressClass)) + }) + return ret, err +} + +// Get retrieves the IngressClass from the index for a given name. +func (s *ingressClassLister) Get(name string) (*v1.IngressClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("ingressclass"), name) + } + return obj.(*v1.IngressClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go new file mode 100644 index 000000000..34cabf057 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyLister helps list NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyLister interface { + // List lists all NetworkPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) + // NetworkPolicies returns an object that can list and get NetworkPolicies. + NetworkPolicies(namespace string) NetworkPolicyNamespaceLister + NetworkPolicyListerExpansion +} + +// networkPolicyLister implements the NetworkPolicyLister interface. +type networkPolicyLister struct { + indexer cache.Indexer +} + +// NewNetworkPolicyLister returns a new NetworkPolicyLister. +func NewNetworkPolicyLister(indexer cache.Indexer) NetworkPolicyLister { + return &networkPolicyLister{indexer: indexer} +} + +// List lists all NetworkPolicies in the indexer. +func (s *networkPolicyLister) List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetworkPolicy)) + }) + return ret, err +} + +// NetworkPolicies returns an object that can list and get NetworkPolicies. +func (s *networkPolicyLister) NetworkPolicies(namespace string) NetworkPolicyNamespaceLister { + return networkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkPolicyNamespaceLister helps list and get NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyNamespaceLister interface { + // List lists all NetworkPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) + // Get retrieves the NetworkPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.NetworkPolicy, error) + NetworkPolicyNamespaceListerExpansion +} + +// networkPolicyNamespaceLister implements the NetworkPolicyNamespaceLister +// interface. +type networkPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkPolicies in the indexer for a given namespace. +func (s networkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetworkPolicy)) + }) + return ret, err +} + +// Get retrieves the NetworkPolicy from the indexer for a given namespace and name. +func (s networkPolicyNamespaceLister) Get(name string) (*v1.NetworkPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("networkpolicy"), name) + } + return obj.(*v1.NetworkPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go new file mode 100644 index 000000000..d8c99c186 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// IngressListerExpansion allows custom methods to be added to +// IngressLister. +type IngressListerExpansion interface{} + +// IngressNamespaceListerExpansion allows custom methods to be added to +// IngressNamespaceLister. +type IngressNamespaceListerExpansion interface{} + +// IngressClassListerExpansion allows custom methods to be added to +// IngressClassLister. +type IngressClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go new file mode 100644 index 000000000..b8f4d3558 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/networking/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressLister helps list Ingresses. +// All objects returned here must be treated as read-only. +type IngressLister interface { + // List lists all Ingresses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Ingresses returns an object that can list and get Ingresses. + Ingresses(namespace string) IngressNamespaceLister + IngressListerExpansion +} + +// ingressLister implements the IngressLister interface. +type ingressLister struct { + indexer cache.Indexer +} + +// NewIngressLister returns a new IngressLister. +func NewIngressLister(indexer cache.Indexer) IngressLister { + return &ingressLister{indexer: indexer} +} + +// List lists all Ingresses in the indexer. +func (s *ingressLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get Ingresses. +func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { + return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IngressNamespaceLister helps list and get Ingresses. +// All objects returned here must be treated as read-only. +type IngressNamespaceLister interface { + // List lists all Ingresses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Get retrieves the Ingress from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Ingress, error) + IngressNamespaceListerExpansion +} + +// ingressNamespaceLister implements the IngressNamespaceLister +// interface. +type ingressNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Ingresses in the indexer for a given namespace. +func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Get retrieves the Ingress from the indexer for a given namespace and name. +func (s ingressNamespaceLister) Get(name string) (*v1beta1.Ingress, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("ingress"), name) + } + return obj.(*v1beta1.Ingress), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go new file mode 100644 index 000000000..ebcd6ba85 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/networking/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressClassLister helps list IngressClasses. +// All objects returned here must be treated as read-only. +type IngressClassLister interface { + // List lists all IngressClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.IngressClass, err error) + // Get retrieves the IngressClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.IngressClass, error) + IngressClassListerExpansion +} + +// ingressClassLister implements the IngressClassLister interface. +type ingressClassLister struct { + indexer cache.Indexer +} + +// NewIngressClassLister returns a new IngressClassLister. +func NewIngressClassLister(indexer cache.Indexer) IngressClassLister { + return &ingressClassLister{indexer: indexer} +} + +// List lists all IngressClasses in the indexer. +func (s *ingressClassLister) List(selector labels.Selector) (ret []*v1beta1.IngressClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.IngressClass)) + }) + return ret, err +} + +// Get retrieves the IngressClass from the index for a given name. +func (s *ingressClassLister) Get(name string) (*v1beta1.IngressClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("ingressclass"), name) + } + return obj.(*v1beta1.IngressClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go new file mode 100644 index 000000000..4f010b87c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// RuntimeClassListerExpansion allows custom methods to be added to +// RuntimeClassLister. +type RuntimeClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go new file mode 100644 index 000000000..6e00cf1a5 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/node/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RuntimeClassLister helps list RuntimeClasses. +// All objects returned here must be treated as read-only. +type RuntimeClassLister interface { + // List lists all RuntimeClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RuntimeClass, err error) + // Get retrieves the RuntimeClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.RuntimeClass, error) + RuntimeClassListerExpansion +} + +// runtimeClassLister implements the RuntimeClassLister interface. +type runtimeClassLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassLister returns a new RuntimeClassLister. +func NewRuntimeClassLister(indexer cache.Indexer) RuntimeClassLister { + return &runtimeClassLister{indexer: indexer} +} + +// List lists all RuntimeClasses in the indexer. +func (s *runtimeClassLister) List(selector labels.Selector) (ret []*v1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the RuntimeClass from the index for a given name. +func (s *runtimeClassLister) Get(name string) (*v1.RuntimeClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("runtimeclass"), name) + } + return obj.(*v1.RuntimeClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..a65c208fa --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// RuntimeClassListerExpansion allows custom methods to be added to +// RuntimeClassLister. +type RuntimeClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go new file mode 100644 index 000000000..31f335799 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/node/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RuntimeClassLister helps list RuntimeClasses. +// All objects returned here must be treated as read-only. +type RuntimeClassLister interface { + // List lists all RuntimeClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RuntimeClass, err error) + // Get retrieves the RuntimeClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.RuntimeClass, error) + RuntimeClassListerExpansion +} + +// runtimeClassLister implements the RuntimeClassLister interface. +type runtimeClassLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassLister returns a new RuntimeClassLister. +func NewRuntimeClassLister(indexer cache.Indexer) RuntimeClassLister { + return &runtimeClassLister{indexer: indexer} +} + +// List lists all RuntimeClasses in the indexer. +func (s *runtimeClassLister) List(selector labels.Selector) (ret []*v1alpha1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the RuntimeClass from the index for a given name. +func (s *runtimeClassLister) Get(name string) (*v1alpha1.RuntimeClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("runtimeclass"), name) + } + return obj.(*v1alpha1.RuntimeClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go new file mode 100644 index 000000000..a6744055c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// RuntimeClassListerExpansion allows custom methods to be added to +// RuntimeClassLister. +type RuntimeClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go new file mode 100644 index 000000000..7dbd6ab26 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/node/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RuntimeClassLister helps list RuntimeClasses. +// All objects returned here must be treated as read-only. +type RuntimeClassLister interface { + // List lists all RuntimeClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.RuntimeClass, err error) + // Get retrieves the RuntimeClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.RuntimeClass, error) + RuntimeClassListerExpansion +} + +// runtimeClassLister implements the RuntimeClassLister interface. +type runtimeClassLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassLister returns a new RuntimeClassLister. +func NewRuntimeClassLister(indexer cache.Indexer) RuntimeClassLister { + return &runtimeClassLister{indexer: indexer} +} + +// List lists all RuntimeClasses in the indexer. +func (s *runtimeClassLister) List(selector labels.Selector) (ret []*v1beta1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the RuntimeClass from the index for a given name. +func (s *runtimeClassLister) Get(name string) (*v1beta1.RuntimeClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("runtimeclass"), name) + } + return obj.(*v1beta1.RuntimeClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1/eviction.go b/vendor/k8s.io/client-go/listers/policy/v1/eviction.go new file mode 100644 index 000000000..dc5ffa074 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/eviction.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/policy/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EvictionLister helps list Evictions. +// All objects returned here must be treated as read-only. +type EvictionLister interface { + // List lists all Evictions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Eviction, err error) + // Evictions returns an object that can list and get Evictions. + Evictions(namespace string) EvictionNamespaceLister + EvictionListerExpansion +} + +// evictionLister implements the EvictionLister interface. +type evictionLister struct { + indexer cache.Indexer +} + +// NewEvictionLister returns a new EvictionLister. +func NewEvictionLister(indexer cache.Indexer) EvictionLister { + return &evictionLister{indexer: indexer} +} + +// List lists all Evictions in the indexer. +func (s *evictionLister) List(selector labels.Selector) (ret []*v1.Eviction, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Eviction)) + }) + return ret, err +} + +// Evictions returns an object that can list and get Evictions. +func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { + return evictionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EvictionNamespaceLister helps list and get Evictions. +// All objects returned here must be treated as read-only. +type EvictionNamespaceLister interface { + // List lists all Evictions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Eviction, err error) + // Get retrieves the Eviction from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Eviction, error) + EvictionNamespaceListerExpansion +} + +// evictionNamespaceLister implements the EvictionNamespaceLister +// interface. +type evictionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Evictions in the indexer for a given namespace. +func (s evictionNamespaceLister) List(selector labels.Selector) (ret []*v1.Eviction, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Eviction)) + }) + return ret, err +} + +// Get retrieves the Eviction from the indexer for a given namespace and name. +func (s evictionNamespaceLister) Get(name string) (*v1.Eviction, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("eviction"), name) + } + return obj.(*v1.Eviction), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go new file mode 100644 index 000000000..8e2d55a91 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// EvictionListerExpansion allows custom methods to be added to +// EvictionLister. +type EvictionListerExpansion interface{} + +// EvictionNamespaceListerExpansion allows custom methods to be added to +// EvictionNamespaceLister. +type EvictionNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go new file mode 100644 index 000000000..8470d38bb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/policy/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetLister helps list PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetLister interface { + // List lists all PodDisruptionBudgets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) + // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. + PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister + PodDisruptionBudgetListerExpansion +} + +// podDisruptionBudgetLister implements the PodDisruptionBudgetLister interface. +type podDisruptionBudgetLister struct { + indexer cache.Indexer +} + +// NewPodDisruptionBudgetLister returns a new PodDisruptionBudgetLister. +func NewPodDisruptionBudgetLister(indexer cache.Indexer) PodDisruptionBudgetLister { + return &podDisruptionBudgetLister{indexer: indexer} +} + +// List lists all PodDisruptionBudgets in the indexer. +func (s *podDisruptionBudgetLister) List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodDisruptionBudget)) + }) + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. +func (s *podDisruptionBudgetLister) PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister { + return podDisruptionBudgetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodDisruptionBudgetNamespaceLister helps list and get PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetNamespaceLister interface { + // List lists all PodDisruptionBudgets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) + // Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PodDisruptionBudget, error) + PodDisruptionBudgetNamespaceListerExpansion +} + +// podDisruptionBudgetNamespaceLister implements the PodDisruptionBudgetNamespaceLister +// interface. +type podDisruptionBudgetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodDisruptionBudgets in the indexer for a given namespace. +func (s podDisruptionBudgetNamespaceLister) List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodDisruptionBudget)) + }) + return ret, err +} + +// Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. +func (s podDisruptionBudgetNamespaceLister) Get(name string) (*v1.PodDisruptionBudget, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("poddisruptionbudget"), name) + } + return obj.(*v1.PodDisruptionBudget), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go new file mode 100644 index 000000000..f63851ad4 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go @@ -0,0 +1,69 @@ +/* +Copyright 2021 The Kubernetes 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. +*/ + +package v1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/klog/v2" +) + +// PodDisruptionBudgetListerExpansion allows custom methods to be added to +// PodDisruptionBudgetLister. +type PodDisruptionBudgetListerExpansion interface { + GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) +} + +// PodDisruptionBudgetNamespaceListerExpansion allows custom methods to be added to +// PodDisruptionBudgetNamespaceLister. +type PodDisruptionBudgetNamespaceListerExpansion interface{} + +// GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. +func (s *podDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + var selector labels.Selector + + list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var pdbList []*policy.PodDisruptionBudget + for i := range list { + pdb := list[i] + selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) + if err != nil { + klog.Warningf("invalid selector: %v", err) + continue + } + + // Unlike the v1beta version, here we let an empty selector match everything. + if !selector.Matches(labels.Set(pod.Labels)) { + continue + } + pdbList = append(pdbList, pdb) + } + + if len(pdbList) == 0 { + return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return pdbList, nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go new file mode 100644 index 000000000..e1d40d0b3 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EvictionLister helps list Evictions. +// All objects returned here must be treated as read-only. +type EvictionLister interface { + // List lists all Evictions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) + // Evictions returns an object that can list and get Evictions. + Evictions(namespace string) EvictionNamespaceLister + EvictionListerExpansion +} + +// evictionLister implements the EvictionLister interface. +type evictionLister struct { + indexer cache.Indexer +} + +// NewEvictionLister returns a new EvictionLister. +func NewEvictionLister(indexer cache.Indexer) EvictionLister { + return &evictionLister{indexer: indexer} +} + +// List lists all Evictions in the indexer. +func (s *evictionLister) List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Eviction)) + }) + return ret, err +} + +// Evictions returns an object that can list and get Evictions. +func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { + return evictionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EvictionNamespaceLister helps list and get Evictions. +// All objects returned here must be treated as read-only. +type EvictionNamespaceLister interface { + // List lists all Evictions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) + // Get retrieves the Eviction from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Eviction, error) + EvictionNamespaceListerExpansion +} + +// evictionNamespaceLister implements the EvictionNamespaceLister +// interface. +type evictionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Evictions in the indexer for a given namespace. +func (s evictionNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Eviction)) + }) + return ret, err +} + +// Get retrieves the Eviction from the indexer for a given namespace and name. +func (s evictionNamespaceLister) Get(name string) (*v1beta1.Eviction, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("eviction"), name) + } + return obj.(*v1beta1.Eviction), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go new file mode 100644 index 000000000..9a005f20b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// EvictionListerExpansion allows custom methods to be added to +// EvictionLister. +type EvictionListerExpansion interface{} + +// EvictionNamespaceListerExpansion allows custom methods to be added to +// EvictionNamespaceLister. +type EvictionNamespaceListerExpansion interface{} + +// PodSecurityPolicyListerExpansion allows custom methods to be added to +// PodSecurityPolicyLister. +type PodSecurityPolicyListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go new file mode 100644 index 000000000..aa08f813e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetLister helps list PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetLister interface { + // List lists all PodDisruptionBudgets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) + // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. + PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister + PodDisruptionBudgetListerExpansion +} + +// podDisruptionBudgetLister implements the PodDisruptionBudgetLister interface. +type podDisruptionBudgetLister struct { + indexer cache.Indexer +} + +// NewPodDisruptionBudgetLister returns a new PodDisruptionBudgetLister. +func NewPodDisruptionBudgetLister(indexer cache.Indexer) PodDisruptionBudgetLister { + return &podDisruptionBudgetLister{indexer: indexer} +} + +// List lists all PodDisruptionBudgets in the indexer. +func (s *podDisruptionBudgetLister) List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodDisruptionBudget)) + }) + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. +func (s *podDisruptionBudgetLister) PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister { + return podDisruptionBudgetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodDisruptionBudgetNamespaceLister helps list and get PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetNamespaceLister interface { + // List lists all PodDisruptionBudgets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) + // Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PodDisruptionBudget, error) + PodDisruptionBudgetNamespaceListerExpansion +} + +// podDisruptionBudgetNamespaceLister implements the PodDisruptionBudgetNamespaceLister +// interface. +type podDisruptionBudgetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodDisruptionBudgets in the indexer for a given namespace. +func (s podDisruptionBudgetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodDisruptionBudget)) + }) + return ret, err +} + +// Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. +func (s podDisruptionBudgetNamespaceLister) Get(name string) (*v1beta1.PodDisruptionBudget, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("poddisruptionbudget"), name) + } + return obj.(*v1beta1.PodDisruptionBudget), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go new file mode 100644 index 000000000..dce5dca82 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go @@ -0,0 +1,70 @@ +/* +Copyright 2017 The Kubernetes 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. +*/ + +package v1beta1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/klog/v2" +) + +// PodDisruptionBudgetListerExpansion allows custom methods to be added to +// PodDisruptionBudgetLister. +type PodDisruptionBudgetListerExpansion interface { + GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) +} + +// PodDisruptionBudgetNamespaceListerExpansion allows custom methods to be added to +// PodDisruptionBudgetNamespaceLister. +type PodDisruptionBudgetNamespaceListerExpansion interface{} + +// GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. Returns an error only if no matching PodDisruptionBudgets are found. +func (s *podDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + var selector labels.Selector + + list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var pdbList []*policy.PodDisruptionBudget + for i := range list { + pdb := list[i] + selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) + if err != nil { + klog.Warningf("invalid selector: %v", err) + // TODO(mml): add an event to the PDB + continue + } + + // If a PDB with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + pdbList = append(pdbList, pdb) + } + + if len(pdbList) == 0 { + return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return pdbList, nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..7e73161b2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyLister helps list PodSecurityPolicies. +// All objects returned here must be treated as read-only. +type PodSecurityPolicyLister interface { + // List lists all PodSecurityPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) + // Get retrieves the PodSecurityPolicy from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PodSecurityPolicy, error) + PodSecurityPolicyListerExpansion +} + +// podSecurityPolicyLister implements the PodSecurityPolicyLister interface. +type podSecurityPolicyLister struct { + indexer cache.Indexer +} + +// NewPodSecurityPolicyLister returns a new PodSecurityPolicyLister. +func NewPodSecurityPolicyLister(indexer cache.Indexer) PodSecurityPolicyLister { + return &podSecurityPolicyLister{indexer: indexer} +} + +// List lists all PodSecurityPolicies in the indexer. +func (s *podSecurityPolicyLister) List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodSecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the PodSecurityPolicy from the index for a given name. +func (s *podSecurityPolicyLister) Get(name string) (*v1beta1.PodSecurityPolicy, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("podsecuritypolicy"), name) + } + return obj.(*v1beta1.PodSecurityPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go new file mode 100644 index 000000000..84dc003ca --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterrole"), name) + } + return obj.(*v1.ClusterRole), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..ff061d4b2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterrolebinding"), name) + } + return obj.(*v1.ClusterRoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go new file mode 100644 index 000000000..0eb2a6d11 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/role.go b/vendor/k8s.io/client-go/listers/rbac/v1/role.go new file mode 100644 index 000000000..503f013b5 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/role.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("role"), name) + } + return obj.(*v1.Role), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go new file mode 100644 index 000000000..ea50c6413 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("rolebinding"), name) + } + return obj.(*v1.RoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go new file mode 100644 index 000000000..181ea95a7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1alpha1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterrole"), name) + } + return obj.(*v1alpha1.ClusterRole), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go new file mode 100644 index 000000000..29d283b6c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1alpha1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterrolebinding"), name) + } + return obj.(*v1alpha1.ClusterRoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..2d4ad1756 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go new file mode 100644 index 000000000..13a64137a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1alpha1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1alpha1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("role"), name) + } + return obj.(*v1alpha1.Role), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go new file mode 100644 index 000000000..0ad3d0eba --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1alpha1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("rolebinding"), name) + } + return obj.(*v1alpha1.RoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go new file mode 100644 index 000000000..bf6cd99cb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1beta1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1beta1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("clusterrole"), name) + } + return obj.(*v1beta1.ClusterRole), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go new file mode 100644 index 000000000..00bab2330 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1beta1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1beta1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("clusterrolebinding"), name) + } + return obj.(*v1beta1.ClusterRoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go new file mode 100644 index 000000000..51f674bd0 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go new file mode 100644 index 000000000..9cd9b9042 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1beta1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1beta1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("role"), name) + } + return obj.(*v1beta1.Role), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go new file mode 100644 index 000000000..7c7c91bf3 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1beta1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("rolebinding"), name) + } + return obj.(*v1beta1.RoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go new file mode 100644 index 000000000..d0c45d012 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..4da84ccf8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/scheduling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("priorityclass"), name) + } + return obj.(*v1.PriorityClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..bde8b6206 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go new file mode 100644 index 000000000..3d25dc80a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/scheduling/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1alpha1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1alpha1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("priorityclass"), name) + } + return obj.(*v1alpha1.PriorityClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go new file mode 100644 index 000000000..b806e8cf8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go new file mode 100644 index 000000000..c848d035a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/scheduling/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1beta1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1beta1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("priorityclass"), name) + } + return obj.(*v1beta1.PriorityClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/csidriver.go b/vendor/k8s.io/client-go/listers/storage/v1/csidriver.go new file mode 100644 index 000000000..4e8ab9090 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/csidriver.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIDriverLister helps list CSIDrivers. +// All objects returned here must be treated as read-only. +type CSIDriverLister interface { + // List lists all CSIDrivers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSIDriver, err error) + // Get retrieves the CSIDriver from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSIDriver, error) + CSIDriverListerExpansion +} + +// cSIDriverLister implements the CSIDriverLister interface. +type cSIDriverLister struct { + indexer cache.Indexer +} + +// NewCSIDriverLister returns a new CSIDriverLister. +func NewCSIDriverLister(indexer cache.Indexer) CSIDriverLister { + return &cSIDriverLister{indexer: indexer} +} + +// List lists all CSIDrivers in the indexer. +func (s *cSIDriverLister) List(selector labels.Selector) (ret []*v1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the CSIDriver from the index for a given name. +func (s *cSIDriverLister) Get(name string) (*v1.CSIDriver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("csidriver"), name) + } + return obj.(*v1.CSIDriver), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/csinode.go b/vendor/k8s.io/client-go/listers/storage/v1/csinode.go new file mode 100644 index 000000000..93f869572 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/csinode.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSINodeLister helps list CSINodes. +// All objects returned here must be treated as read-only. +type CSINodeLister interface { + // List lists all CSINodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSINode, err error) + // Get retrieves the CSINode from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSINode, error) + CSINodeListerExpansion +} + +// cSINodeLister implements the CSINodeLister interface. +type cSINodeLister struct { + indexer cache.Indexer +} + +// NewCSINodeLister returns a new CSINodeLister. +func NewCSINodeLister(indexer cache.Indexer) CSINodeLister { + return &cSINodeLister{indexer: indexer} +} + +// List lists all CSINodes in the indexer. +func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSINode)) + }) + return ret, err +} + +// Get retrieves the CSINode from the index for a given name. +func (s *cSINodeLister) Get(name string) (*v1.CSINode, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("csinode"), name) + } + return obj.(*v1.CSINode), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go new file mode 100644 index 000000000..172f835f7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +// CSIDriverListerExpansion allows custom methods to be added to +// CSIDriverLister. +type CSIDriverListerExpansion interface{} + +// CSINodeListerExpansion allows custom methods to be added to +// CSINodeLister. +type CSINodeListerExpansion interface{} + +// StorageClassListerExpansion allows custom methods to be added to +// StorageClassLister. +type StorageClassListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/storageclass.go b/vendor/k8s.io/client-go/listers/storage/v1/storageclass.go new file mode 100644 index 000000000..ffa3d19f5 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/storageclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageClassLister helps list StorageClasses. +// All objects returned here must be treated as read-only. +type StorageClassLister interface { + // List lists all StorageClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StorageClass, err error) + // Get retrieves the StorageClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.StorageClass, error) + StorageClassListerExpansion +} + +// storageClassLister implements the StorageClassLister interface. +type storageClassLister struct { + indexer cache.Indexer +} + +// NewStorageClassLister returns a new StorageClassLister. +func NewStorageClassLister(indexer cache.Indexer) StorageClassLister { + return &storageClassLister{indexer: indexer} +} + +// List lists all StorageClasses in the indexer. +func (s *storageClassLister) List(selector labels.Selector) (ret []*v1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the StorageClass from the index for a given name. +func (s *storageClassLister) Get(name string) (*v1.StorageClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("storageclass"), name) + } + return obj.(*v1.StorageClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go new file mode 100644 index 000000000..fbc735c93 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("volumeattachment"), name) + } + return obj.(*v1.VolumeAttachment), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go new file mode 100644 index 000000000..0c1b5f264 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/storage/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityLister helps list CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityLister interface { + // List lists all CSIStorageCapacities in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) + // CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. + CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister + CSIStorageCapacityListerExpansion +} + +// cSIStorageCapacityLister implements the CSIStorageCapacityLister interface. +type cSIStorageCapacityLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityLister returns a new CSIStorageCapacityLister. +func NewCSIStorageCapacityLister(indexer cache.Indexer) CSIStorageCapacityLister { + return &cSIStorageCapacityLister{indexer: indexer} +} + +// List lists all CSIStorageCapacities in the indexer. +func (s *cSIStorageCapacityLister) List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. +func (s *cSIStorageCapacityLister) CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister { + return cSIStorageCapacityNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister helps list and get CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityNamespaceLister interface { + // List lists all CSIStorageCapacities in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) + // Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.CSIStorageCapacity, error) + CSIStorageCapacityNamespaceListerExpansion +} + +// cSIStorageCapacityNamespaceLister implements the CSIStorageCapacityNamespaceLister +// interface. +type cSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CSIStorageCapacities in the indexer for a given namespace. +func (s cSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CSIStorageCapacity)) + }) + return ret, err +} + +// Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. +func (s cSIStorageCapacityNamespaceLister) Get(name string) (*v1alpha1.CSIStorageCapacity, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("csistoragecapacity"), name) + } + return obj.(*v1alpha1.CSIStorageCapacity), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..edefe6d05 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// CSIStorageCapacityListerExpansion allows custom methods to be added to +// CSIStorageCapacityLister. +type CSIStorageCapacityListerExpansion interface{} + +// CSIStorageCapacityNamespaceListerExpansion allows custom methods to be added to +// CSIStorageCapacityNamespaceLister. +type CSIStorageCapacityNamespaceListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go new file mode 100644 index 000000000..3d5e2b7b7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/storage/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1alpha1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1alpha1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("volumeattachment"), name) + } + return obj.(*v1alpha1.VolumeAttachment), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go new file mode 100644 index 000000000..c6787aa01 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIDriverLister helps list CSIDrivers. +// All objects returned here must be treated as read-only. +type CSIDriverLister interface { + // List lists all CSIDrivers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSIDriver, err error) + // Get retrieves the CSIDriver from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CSIDriver, error) + CSIDriverListerExpansion +} + +// cSIDriverLister implements the CSIDriverLister interface. +type cSIDriverLister struct { + indexer cache.Indexer +} + +// NewCSIDriverLister returns a new CSIDriverLister. +func NewCSIDriverLister(indexer cache.Indexer) CSIDriverLister { + return &cSIDriverLister{indexer: indexer} +} + +// List lists all CSIDrivers in the indexer. +func (s *cSIDriverLister) List(selector labels.Selector) (ret []*v1beta1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the CSIDriver from the index for a given name. +func (s *cSIDriverLister) Get(name string) (*v1beta1.CSIDriver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("csidriver"), name) + } + return obj.(*v1beta1.CSIDriver), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go new file mode 100644 index 000000000..809efaa36 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSINodeLister helps list CSINodes. +// All objects returned here must be treated as read-only. +type CSINodeLister interface { + // List lists all CSINodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) + // Get retrieves the CSINode from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CSINode, error) + CSINodeListerExpansion +} + +// cSINodeLister implements the CSINodeLister interface. +type cSINodeLister struct { + indexer cache.Indexer +} + +// NewCSINodeLister returns a new CSINodeLister. +func NewCSINodeLister(indexer cache.Indexer) CSINodeLister { + return &cSINodeLister{indexer: indexer} +} + +// List lists all CSINodes in the indexer. +func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSINode)) + }) + return ret, err +} + +// Get retrieves the CSINode from the index for a given name. +func (s *cSINodeLister) Get(name string) (*v1beta1.CSINode, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("csinode"), name) + } + return obj.(*v1beta1.CSINode), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go new file mode 100644 index 000000000..4680ffb7c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityLister helps list CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityLister interface { + // List lists all CSIStorageCapacities in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) + // CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. + CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister + CSIStorageCapacityListerExpansion +} + +// cSIStorageCapacityLister implements the CSIStorageCapacityLister interface. +type cSIStorageCapacityLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityLister returns a new CSIStorageCapacityLister. +func NewCSIStorageCapacityLister(indexer cache.Indexer) CSIStorageCapacityLister { + return &cSIStorageCapacityLister{indexer: indexer} +} + +// List lists all CSIStorageCapacities in the indexer. +func (s *cSIStorageCapacityLister) List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. +func (s *cSIStorageCapacityLister) CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister { + return cSIStorageCapacityNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister helps list and get CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityNamespaceLister interface { + // List lists all CSIStorageCapacities in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) + // Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CSIStorageCapacity, error) + CSIStorageCapacityNamespaceListerExpansion +} + +// cSIStorageCapacityNamespaceLister implements the CSIStorageCapacityNamespaceLister +// interface. +type cSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CSIStorageCapacities in the indexer for a given namespace. +func (s cSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSIStorageCapacity)) + }) + return ret, err +} + +// Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. +func (s cSIStorageCapacityNamespaceLister) Get(name string) (*v1beta1.CSIStorageCapacity, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("csistoragecapacity"), name) + } + return obj.(*v1beta1.CSIStorageCapacity), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go new file mode 100644 index 000000000..c2b0d5b17 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +// CSIDriverListerExpansion allows custom methods to be added to +// CSIDriverLister. +type CSIDriverListerExpansion interface{} + +// CSINodeListerExpansion allows custom methods to be added to +// CSINodeLister. +type CSINodeListerExpansion interface{} + +// CSIStorageCapacityListerExpansion allows custom methods to be added to +// CSIStorageCapacityLister. +type CSIStorageCapacityListerExpansion interface{} + +// CSIStorageCapacityNamespaceListerExpansion allows custom methods to be added to +// CSIStorageCapacityNamespaceLister. +type CSIStorageCapacityNamespaceListerExpansion interface{} + +// StorageClassListerExpansion allows custom methods to be added to +// StorageClassLister. +type StorageClassListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go new file mode 100644 index 000000000..eb7b8315c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageClassLister helps list StorageClasses. +// All objects returned here must be treated as read-only. +type StorageClassLister interface { + // List lists all StorageClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.StorageClass, err error) + // Get retrieves the StorageClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.StorageClass, error) + StorageClassListerExpansion +} + +// storageClassLister implements the StorageClassLister interface. +type storageClassLister struct { + indexer cache.Indexer +} + +// NewStorageClassLister returns a new StorageClassLister. +func NewStorageClassLister(indexer cache.Indexer) StorageClassLister { + return &storageClassLister{indexer: indexer} +} + +// List lists all StorageClasses in the indexer. +func (s *storageClassLister) List(selector labels.Selector) (ret []*v1beta1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the StorageClass from the index for a given name. +func (s *storageClassLister) Get(name string) (*v1beta1.StorageClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("storageclass"), name) + } + return obj.(*v1beta1.StorageClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go new file mode 100644 index 000000000..bab2d317c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes 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 lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1beta1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1beta1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("volumeattachment"), name) + } + return obj.(*v1beta1.VolumeAttachment), nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a431e747c..4c6f7c715 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -25,9 +25,12 @@ github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils +github.com/aliyun/alibaba-cloud-sdk-go/services/alb +github.com/aliyun/alibaba-cloud-sdk-go/services/cas github.com/aliyun/alibaba-cloud-sdk-go/services/ecs github.com/aliyun/alibaba-cloud-sdk-go/services/pvtz github.com/aliyun/alibaba-cloud-sdk-go/services/slb +github.com/aliyun/alibaba-cloud-sdk-go/services/sls github.com/aliyun/alibaba-cloud-sdk-go/services/vpc # github.com/beorn7/perks v1.0.1 github.com/beorn7/perks/quantile @@ -35,6 +38,11 @@ github.com/beorn7/perks/quantile github.com/cespare/xxhash/v2 # github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew/spew +# github.com/eapache/channels v1.1.0 +## explicit +github.com/eapache/channels +# github.com/eapache/queue v1.1.0 +github.com/eapache/queue # github.com/evanphx/json-patch v4.11.0+incompatible github.com/evanphx/json-patch # github.com/form3tech-oss/jwt-go v3.2.3+incompatible @@ -62,7 +70,9 @@ github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/timestamp # github.com/google/go-cmp v0.5.5 +## explicit github.com/google/go-cmp/cmp +github.com/google/go-cmp/cmp/cmpopts github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function @@ -216,6 +226,9 @@ golang.org/x/text/unicode/norm # golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac ## explicit golang.org/x/time/rate +# golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 +golang.org/x/xerrors +golang.org/x/xerrors/internal # gomodules.xyz/jsonpatch/v2 v2.2.0 gomodules.xyz/jsonpatch/v2 # google.golang.org/appengine v1.6.7 @@ -423,6 +436,65 @@ k8s.io/client-go/applyconfigurations/storage/v1alpha1 k8s.io/client-go/applyconfigurations/storage/v1beta1 k8s.io/client-go/discovery k8s.io/client-go/dynamic +k8s.io/client-go/informers +k8s.io/client-go/informers/admissionregistration +k8s.io/client-go/informers/admissionregistration/v1 +k8s.io/client-go/informers/admissionregistration/v1beta1 +k8s.io/client-go/informers/apiserverinternal +k8s.io/client-go/informers/apiserverinternal/v1alpha1 +k8s.io/client-go/informers/apps +k8s.io/client-go/informers/apps/v1 +k8s.io/client-go/informers/apps/v1beta1 +k8s.io/client-go/informers/apps/v1beta2 +k8s.io/client-go/informers/autoscaling +k8s.io/client-go/informers/autoscaling/v1 +k8s.io/client-go/informers/autoscaling/v2beta1 +k8s.io/client-go/informers/autoscaling/v2beta2 +k8s.io/client-go/informers/batch +k8s.io/client-go/informers/batch/v1 +k8s.io/client-go/informers/batch/v1beta1 +k8s.io/client-go/informers/certificates +k8s.io/client-go/informers/certificates/v1 +k8s.io/client-go/informers/certificates/v1beta1 +k8s.io/client-go/informers/coordination +k8s.io/client-go/informers/coordination/v1 +k8s.io/client-go/informers/coordination/v1beta1 +k8s.io/client-go/informers/core +k8s.io/client-go/informers/core/v1 +k8s.io/client-go/informers/discovery +k8s.io/client-go/informers/discovery/v1 +k8s.io/client-go/informers/discovery/v1beta1 +k8s.io/client-go/informers/events +k8s.io/client-go/informers/events/v1 +k8s.io/client-go/informers/events/v1beta1 +k8s.io/client-go/informers/extensions +k8s.io/client-go/informers/extensions/v1beta1 +k8s.io/client-go/informers/flowcontrol +k8s.io/client-go/informers/flowcontrol/v1alpha1 +k8s.io/client-go/informers/flowcontrol/v1beta1 +k8s.io/client-go/informers/internalinterfaces +k8s.io/client-go/informers/networking +k8s.io/client-go/informers/networking/v1 +k8s.io/client-go/informers/networking/v1beta1 +k8s.io/client-go/informers/node +k8s.io/client-go/informers/node/v1 +k8s.io/client-go/informers/node/v1alpha1 +k8s.io/client-go/informers/node/v1beta1 +k8s.io/client-go/informers/policy +k8s.io/client-go/informers/policy/v1 +k8s.io/client-go/informers/policy/v1beta1 +k8s.io/client-go/informers/rbac +k8s.io/client-go/informers/rbac/v1 +k8s.io/client-go/informers/rbac/v1alpha1 +k8s.io/client-go/informers/rbac/v1beta1 +k8s.io/client-go/informers/scheduling +k8s.io/client-go/informers/scheduling/v1 +k8s.io/client-go/informers/scheduling/v1alpha1 +k8s.io/client-go/informers/scheduling/v1beta1 +k8s.io/client-go/informers/storage +k8s.io/client-go/informers/storage/v1 +k8s.io/client-go/informers/storage/v1alpha1 +k8s.io/client-go/informers/storage/v1beta1 k8s.io/client-go/kubernetes k8s.io/client-go/kubernetes/scheme k8s.io/client-go/kubernetes/typed/admissionregistration/v1 @@ -468,6 +540,45 @@ k8s.io/client-go/kubernetes/typed/scheduling/v1beta1 k8s.io/client-go/kubernetes/typed/storage/v1 k8s.io/client-go/kubernetes/typed/storage/v1alpha1 k8s.io/client-go/kubernetes/typed/storage/v1beta1 +k8s.io/client-go/listers/admissionregistration/v1 +k8s.io/client-go/listers/admissionregistration/v1beta1 +k8s.io/client-go/listers/apiserverinternal/v1alpha1 +k8s.io/client-go/listers/apps/v1 +k8s.io/client-go/listers/apps/v1beta1 +k8s.io/client-go/listers/apps/v1beta2 +k8s.io/client-go/listers/autoscaling/v1 +k8s.io/client-go/listers/autoscaling/v2beta1 +k8s.io/client-go/listers/autoscaling/v2beta2 +k8s.io/client-go/listers/batch/v1 +k8s.io/client-go/listers/batch/v1beta1 +k8s.io/client-go/listers/certificates/v1 +k8s.io/client-go/listers/certificates/v1beta1 +k8s.io/client-go/listers/coordination/v1 +k8s.io/client-go/listers/coordination/v1beta1 +k8s.io/client-go/listers/core/v1 +k8s.io/client-go/listers/discovery/v1 +k8s.io/client-go/listers/discovery/v1beta1 +k8s.io/client-go/listers/events/v1 +k8s.io/client-go/listers/events/v1beta1 +k8s.io/client-go/listers/extensions/v1beta1 +k8s.io/client-go/listers/flowcontrol/v1alpha1 +k8s.io/client-go/listers/flowcontrol/v1beta1 +k8s.io/client-go/listers/networking/v1 +k8s.io/client-go/listers/networking/v1beta1 +k8s.io/client-go/listers/node/v1 +k8s.io/client-go/listers/node/v1alpha1 +k8s.io/client-go/listers/node/v1beta1 +k8s.io/client-go/listers/policy/v1 +k8s.io/client-go/listers/policy/v1beta1 +k8s.io/client-go/listers/rbac/v1 +k8s.io/client-go/listers/rbac/v1alpha1 +k8s.io/client-go/listers/rbac/v1beta1 +k8s.io/client-go/listers/scheduling/v1 +k8s.io/client-go/listers/scheduling/v1alpha1 +k8s.io/client-go/listers/scheduling/v1beta1 +k8s.io/client-go/listers/storage/v1 +k8s.io/client-go/listers/storage/v1alpha1 +k8s.io/client-go/listers/storage/v1beta1 k8s.io/client-go/metadata k8s.io/client-go/pkg/apis/clientauthentication k8s.io/client-go/pkg/apis/clientauthentication/install @@ -536,6 +647,7 @@ k8s.io/kubernetes/pkg/apis/core/helper k8s.io/kubernetes/pkg/apis/core/v1/helper k8s.io/kubernetes/test/e2e/framework/ginkgowrapper # k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a +## explicit k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/pointer From 171d1a758826311715807582c61456ace6ea9194 Mon Sep 17 00:00:00 2001 From: "yuanyi.lp" Date: Fri, 31 Dec 2021 16:37:56 +0800 Subject: [PATCH 3/4] feature(ingress): update the crd process --- cmd/manager/main.go | 7 ------- pkg/controller/ingress/alb_controller.go | 24 ++++++------------------ pkg/controller/{ => ingress}/register.go | 2 +- pkg/util/crd/crd.go | 7 ++++--- 4 files changed, 11 insertions(+), 29 deletions(-) rename pkg/controller/{ => ingress}/register.go (99%) diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 386040b33..a272f2ec4 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -81,13 +81,6 @@ func main() { } ctx := shared.NewSharedContext(cloud) - log.Info("start to register crds") - err = controller.RegisterCRD(cfg) - if err != nil { - log.Error(err, "register crd: %s", err.Error()) - os.Exit(1) - } - log.Info("Registering Components.") if err := controller.AddToManager(mgr, ctx, ctrlCfg.ControllerCFG.Controllers); err != nil { log.Error(err, "add controller: %s", err.Error()) diff --git a/pkg/controller/ingress/alb_controller.go b/pkg/controller/ingress/alb_controller.go index 88f3a135a..7e42da0ea 100644 --- a/pkg/controller/ingress/alb_controller.go +++ b/pkg/controller/ingress/alb_controller.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "k8s.io/apimachinery/pkg/util/version" + "k8s.io/client-go/kubernetes" "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/annotations" "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/ingress/reconcile/store" @@ -22,7 +22,6 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" v1 "k8s.io/cloud-provider-alibaba-cloud/pkg/apis/alibabacloud/v1" "k8s.io/cloud-provider-alibaba-cloud/pkg/context/shared" @@ -53,27 +52,16 @@ const ( func NewAlbConfigReconciler(mgr manager.Manager, ctx *shared.SharedContext) (*albconfigReconciler, error) { config := Configuration{} logger := ctrl.Log.WithName("controllers").WithName(albIngressControllerName) - - client, err := kubernetes.NewForConfig(mgr.GetConfig()) + logger.Info("start to register crds") + err := RegisterCRD(mgr.GetConfig()) if err != nil { + logger.Error(err, "register crd: %s", err.Error()) return nil, err } - // Check cluster version - serverVersion, err := client.Discovery().ServerVersion() - if err != nil { - return nil, fmt.Errorf("get server version: %s", err.Error()) - } - - runningVersion, err := version.ParseGeneric(serverVersion.String()) + client, err := kubernetes.NewForConfig(mgr.GetConfig()) if err != nil { - return nil, fmt.Errorf("unexpected error parsing running Kubernetes version, %s", err.Error()) - } - - leastVersion, _ := version.ParseGeneric("v1.19.0") - if !runningVersion.AtLeast(leastVersion) { - logger.Info("kubernetes version should great then v1.19.0 to use ingress v1", "server version", serverVersion.GitVersion) + return nil, err } - n := &albconfigReconciler{ cloud: ctx.Provider(), k8sClient: mgr.GetClient(), diff --git a/pkg/controller/register.go b/pkg/controller/ingress/register.go similarity index 99% rename from pkg/controller/register.go rename to pkg/controller/ingress/register.go index d680df264..382fcdfcf 100644 --- a/pkg/controller/register.go +++ b/pkg/controller/ingress/register.go @@ -1,4 +1,4 @@ -package controller +package ingress import ( "fmt" diff --git a/pkg/util/crd/crd.go b/pkg/util/crd/crd.go index 9c5af8263..c4bdd8ccc 100644 --- a/pkg/util/crd/crd.go +++ b/pkg/util/crd/crd.go @@ -3,9 +3,10 @@ package crd import ( "context" "fmt" + "time" + "k8s.io/apimachinery/pkg/util/version" "k8s.io/klog/klogr" - "time" apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" apiextcli "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" @@ -215,9 +216,9 @@ func (c *Client) validateCRD() error { return fmt.Errorf("unexpected error parsing running Kubernetes version, %s", err.Error()) } - leastVersion, _ := version.ParseGeneric("v1.7.0") + leastVersion, _ := version.ParseGeneric("v1.19.0") if !runningVersion.AtLeast(leastVersion) { - log.Info("kubernetes version should great then v1.7.0 to use crd", "server version", serverVersion.GitVersion) + log.Info("kubernetes version should great then v1.19.0 to use crd", "server version", serverVersion.GitVersion) } return nil From a84a22896739ff0966150623c4cbf59c6f2578de Mon Sep 17 00:00:00 2001 From: "yuanyi.lp" Date: Fri, 31 Dec 2021 17:03:04 +0800 Subject: [PATCH 4/4] feature(ingress): update the annotation process --- docs/usage-alb.md | 314 ++++++------- .../reconcile/annotations/annotations.go | 398 +++++++++++----- .../annotations/class_annotation_matcher.go | 40 -- .../ingress/reconcile/annotations/parser.go | 426 ------------------ 4 files changed, 443 insertions(+), 735 deletions(-) delete mode 100644 pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go delete mode 100644 pkg/controller/ingress/reconcile/annotations/parser.go diff --git a/docs/usage-alb.md b/docs/usage-alb.md index ec4718ef0..ab686be00 100644 --- a/docs/usage-alb.md +++ b/docs/usage-alb.md @@ -52,7 +52,7 @@ When you create an Ingress, an Albconfig object named default is automatically c ```bash kubectl -n kube-system get albconfig ``` - output: + 预期输出: ```bash NAME AGE default 87m @@ -274,6 +274,7 @@ Step 2: Configure an Ingress serviceName: coffee-svc servicePort: 80 ``` + The following table describes the parameters in the YAML template. @@ -340,111 +341,111 @@ An Ingress is an API object that you can use to provide Layer 7 load balancing t Perform the following steps to create a simple Ingress with or without a domain name to forward requests. - Create a simple Ingress with a domain name. 1. Use the following template to create a Deployment, a Service, and an Ingress. Requests to the domain name of the Ingress are forwarded to the Service. - ``` - apiVersion: v1 - kind: Service - metadata: - name: demo-service - namespace: default - spec: - ports: - - name: port1 - port: 80 - protocol: TCP - targetPort: 8080 - selector: - app: demo - sessionAffinity: None - type: ClusterIP - - --- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: demo - namespace: default - spec: - replicas: 1 - selector: - matchLabels: - app: demo - template: - metadata: - labels: - app: demo - spec: - containers: - - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 - imagePullPolicy: IfNotPresent - name: demo - ports: - - containerPort: 8080 - protocol: TCP - --- - apiVersion: networking.k8s.io/v1beta1 - kind: Ingress - metadata: - annotations: - alb.ingress.kubernetes.io/address-type: internet - alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" - kubernetes.io/ingress.class: alb - name: demo - namespace: default - spec: - rules: - - host: demo.domain.ingress.top # The domain name of the Ingress. - http: - paths: - - backend: - serviceName: demo-service - servicePort: 80 - path: /hello - pathType: ImplementationSpecific - ``` + ``` + apiVersion: v1 + kind: Service + metadata: + name: demo-service + namespace: default + spec: + ports: + - name: port1 + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: demo + sessionAffinity: None + type: ClusterIP + + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: demo + namespace: default + spec: + replicas: 1 + selector: + matchLabels: + app: demo + template: + metadata: + labels: + app: demo + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/alb-sample/cafe:v1 + imagePullPolicy: IfNotPresent + name: demo + ports: + - containerPort: 8080 + protocol: TCP + --- + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo + namespace: default + spec: + rules: + - host: demo.domain.ingress.top # The domain name of the Ingress. + http: + paths: + - backend: + serviceName: demo-service + servicePort: 80 + path: /hello + pathType: ImplementationSpecific + ``` 2. Run the following command to access the application by using the specified domain name. Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. - ```bash - curl -H "host: demo.domain.ingress.top"
/hello - ``` + ```bash + curl -H "host: demo.domain.ingress.top"
/hello + ``` Expected output: - ```bash - {"hello":"coffee"} - ``` + ```bash + {"hello":"coffee"} + ``` - Create a simple Ingress without a domain name. 1. Use the following template to create an Ingress: - ```yaml - apiVersion: networking.k8s.io/v1beta1 - kind: Ingress - metadata: - annotations: - alb.ingress.kubernetes.io/address-type: internet - alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" - kubernetes.io/ingress.class: alb - name: demo - namespace: default - spec: - rules: - - host: "" - http: - paths: - - backend: - serviceName: demo-service - servicePort: 80 - path: /hello - pathType: ImplementationSpecific - ``` + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo + namespace: default + spec: + rules: + - host: "" + http: + paths: + - backend: + serviceName: demo-service + servicePort: 80 + path: /hello + pathType: ImplementationSpecific + ``` 2. Run the following command to access the application without using a domain name. Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. - ```bash - curl
/hello - ``` + ```bash + curl
/hello + ``` Expected output: - ```bash - {"hello":"coffee"} - ``` + ```bash + {"hello":"coffee"} + ``` ### Forward requests based on URL paths @@ -454,25 +455,25 @@ The following steps show how to configure different URL match policies. - Exact:exactly matches the URL path with case sensitivity. 1. Use the following template to create an Ingress: - ```yaml - apiVersion: networking.k8s.io/v1beta1 - kind: Ingress - metadata: - annotations: - alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" - kubernetes.io/ingress.class: alb - name: demo-path - namespace: default - spec: - rules: - - http: - paths: - - path: /hello - backend: - serviceName: demo-service - servicePort: 80 - pathType: Exact - ``` + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path + namespace: default + spec: + rules: + - http: + paths: + - path: /hello + backend: + serviceName: demo-service + servicePort: 80 + pathType: Exact + ``` 2. Run the following command to access the application. Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. @@ -486,26 +487,26 @@ The following steps show how to configure different URL match policies. - ImplementationSpecific: the default match policy. For ALB Ingresses, the ImplementationSpecific policy has the same effect as the Exact policy. However, the controllers of Ingresses with the ImplementationSpecific policy and the controllers Ingresses with the Exact policy are implemented in different ways. 1. Use the following template to create an Ingress: - ```yaml - apiVersion: networking.k8s.io/v1beta1 - kind: Ingress - metadata: - annotations: - alb.ingress.kubernetes.io/address-type: internet - alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" - kubernetes.io/ingress.class: alb - name: demo-path - namespace: default - spec: - rules: - - http: - paths: - - path: /hello - backend: - serviceName: demo-service - servicePort: 80 - pathType: ImplementationSpecific - ``` + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path + namespace: default + spec: + rules: + - http: + paths: + - path: /hello + backend: + serviceName: demo-service + servicePort: 80 + pathType: ImplementationSpecific + ``` 2. Run the following command to access the application. Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. @@ -519,26 +520,26 @@ The following steps show how to configure different URL match policies. - Prefix: matches based on a URL path prefix separated by forward slashes (/). The match is case-sensitive and performed on each element of the path. 1. Use the following template to create an Ingress: - ```yaml - apiVersion: networking.k8s.io/v1beta1 - kind: Ingress - metadata: - annotations: - alb.ingress.kubernetes.io/address-type: internet - alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" - kubernetes.io/ingress.class: alb - name: demo-path-prefix - namespace: default - spec: - rules: - - http: - paths: - - path: / - backend: - serviceName: demo-service - servicePort: 80 - pathType: Prefix - ``` + ```yaml + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + metadata: + annotations: + alb.ingress.kubernetes.io/address-type: internet + alb.ingress.kubernetes.io/vswitch-ids: "vsw-2zeqgkyib34gw1fxs****,vsw-2zefv5qwao4przzlo****" + kubernetes.io/ingress.class: alb + name: demo-path-prefix + namespace: default + spec: + rules: + - http: + paths: + - path: / + backend: + serviceName: demo-service + servicePort: 80 + pathType: Prefix + ``` 2. Run the following command to access the application. Replace ADDRESS with the address of the related ALB instance. You can obtain the address by running the kubectl get ing command. @@ -678,7 +679,7 @@ The following table describes the parameters in the YAML template. The ALB Ingress controller supports automatic certificate discovery. You must first create a certificate in the SSL Certificates console. Then, specify the domain name of the certificate in the Transport Layer Security (TLS) configurations of the Ingress. This way, the ALB Ingress controller can automatically match and discover the certificate based on the TLS configurations of the Ingress. -1. Configure automatic certificate discovery +1. Run the following openssl commands to create a certificate: ```bash openssl genrsa -out albtop-key.pem 4096 openssl req -subj "/CN=demo.alb.ingress.top" -sha256 -new -key albtop-key.pem -out albtop.csr @@ -951,4 +952,5 @@ metadata:
-
\ No newline at end of file + + diff --git a/pkg/controller/ingress/reconcile/annotations/annotations.go b/pkg/controller/ingress/reconcile/annotations/annotations.go index e408eac46..217c76bbe 100644 --- a/pkg/controller/ingress/reconcile/annotations/annotations.go +++ b/pkg/controller/ingress/reconcile/annotations/annotations.go @@ -1,37 +1,19 @@ package annotations import ( + "encoding/json" "fmt" + "strconv" "strings" - corev1 "k8s.io/api/core/v1" - "k8s.io/klog" + "github.com/pkg/errors" + networking "k8s.io/api/networking/v1" ) // prefix const ( // DefaultAnnotationsPrefix defines the common prefix used in the nginx ingress controller DefaultAnnotationsPrefix = "alb.ingress.kubernetes.io" - - // AnnotationLegacyPrefix legacy prefix of service annotation - AnnotationLegacyPrefix = "service.beta.kubernetes.io/alicloud" - // AnnotationPrefix prefix of service annotation - AnnotationPrefix = "service.beta.kubernetes.io/alibaba-cloud" -) - -const ( - TAGKEY = "kubernetes.do.not.delete" - ACKKEY = "ack.aliyun.com" - PostPay = "PostPay" -) -const ( - INGRESS_ALB_ANNOTATIONS = "alb.ingress.kubernetes.io/lb" - // config the rule conditions - INGRESS_ALB_CONDITIONS_ANNOTATIONS = "alb.ingress.kubernetes.io/conditions.%s" - // config the rule actions - INGRESS_ALB_ACTIONS_ANNOTATIONS = "alb.ingress.kubernetes.io/actions.%s" - // config the certificate id - INGRESS_ALB_CERTIFICATE_ANNOTATIONS = "alb.ingress.kubernetes.io/certificate-id" ) // load balancer annotations @@ -40,60 +22,29 @@ const ( AnnotationLoadBalancerPrefix = "alb.ingress.kubernetes.io/" // Load Balancer Attribute - AddressType = AnnotationLoadBalancerPrefix + "address-type" // AddressType loadbalancer address type - VswitchIds = AnnotationLoadBalancerPrefix + "vswitch-ids" // VswitchId loadbalancer vswitch id - SLBNetworkType = AnnotationLoadBalancerPrefix + "slb-network-type" // SLBNetworkType loadbalancer network type - ChargeType = AnnotationLoadBalancerPrefix + "charge-type" // ChargeType lb charge type - LoadBalancerId = AnnotationLoadBalancerPrefix + "id" // LoadBalancerId lb id - OverrideListener = AnnotationLoadBalancerPrefix + "force-override-listeners" // OverrideListener force override listeners - LoadBalancerName = AnnotationLoadBalancerPrefix + "name" // LoadBalancerName slb name - MasterZoneID = AnnotationLoadBalancerPrefix + "master-zoneid" // MasterZoneID master zone id - SlaveZoneID = AnnotationLoadBalancerPrefix + "slave-zoneid" // SlaveZoneID slave zone id - Bandwidth = AnnotationLoadBalancerPrefix + "bandwidth" // Bandwidth bandwidth - AdditionalTags = AnnotationLoadBalancerPrefix + "additional-resource-tags" // AdditionalTags For example: "Key1=Val1,Key2=Val2,KeyNoVal1=,KeyNoVal2",same with aws - Spec = AnnotationLoadBalancerPrefix + "spec" // Spec slb spec - Scheduler = AnnotationLoadBalancerPrefix + "scheduler" // Scheduler slb scheduler - IPVersion = AnnotationLoadBalancerPrefix + "ip-version" // IPVersion ip version - ResourceGroupId = AnnotationLoadBalancerPrefix + "resource-group-id" // ResourceGroupId resource group id - DeleteProtection = AnnotationLoadBalancerPrefix + "delete-protection" // DeleteProtection delete protection - ModificationProtection = AnnotationLoadBalancerPrefix + "modification-protection" // ModificationProtection modification type - ExternalIPType = AnnotationLoadBalancerPrefix + "external-ip-type" // ExternalIPType external ip type - AddressAllocatedMode = AnnotationLoadBalancerPrefix + "address-allocated-mode" - LoadBalancerEdition = AnnotationLoadBalancerPrefix + "edition" - HTTPS = AnnotationLoadBalancerPrefix + "backend-protocol" - ListenPorts = AnnotationLoadBalancerPrefix + "listen-ports" - AccessLog = AnnotationLoadBalancerPrefix + "access-log" - // Listener Attribute - AclStatus = AnnotationLoadBalancerPrefix + "acl-status" // AclStatus enable or disable acl on all listener - AclID = AnnotationLoadBalancerPrefix + "acl-id" // AclID acl id - AclType = AnnotationLoadBalancerPrefix + "acl-type" // AclType acl type, black or white - ProtocolPort = AnnotationLoadBalancerPrefix + "protocol-port" // ProtocolPort protocol port - ForwardPort = AnnotationLoadBalancerPrefix + "forward-port" // ForwardPort loadbalancer forward port - CertID = AnnotationLoadBalancerPrefix + "cert-id" // CertID cert id - HealthCheckEnabled = AnnotationLoadBalancerPrefix + "healthcheck-enabled" // HealthCheckFlag health check flag - HealthCheckPath = AnnotationLoadBalancerPrefix + "healthcheck-path" // HealthCheckType health check type - HealthCheckPort = AnnotationLoadBalancerPrefix + "healthcheck-port" // HealthCheckURI health check uri - HealthCheckProtocol = AnnotationLoadBalancerPrefix + "healthcheck-protocol" // HealthCheckConnectPort health check connect port - HealthCheckMethod = AnnotationLoadBalancerPrefix + "healthcheck-method" // HealthyThreshold health check healthy thresh hold - HealthCheckInterval = AnnotationLoadBalancerPrefix + "healthcheck-interval-seconds" // HealthCheckInterval health check interval - HealthCheckTimeout = AnnotationLoadBalancerPrefix + "healthcheck-timeout-seconds" // HealthCheckTimeout health check timeout - HealthThreshold = AnnotationLoadBalancerPrefix + "healthy-threshold-count" // HealthCheckDomain health check domain - UnHealthThreshold = AnnotationLoadBalancerPrefix + "unhealthy-threshold-count" // HealthCheckHTTPCode health check http code - HealthCheckHTTPCode = AnnotationLoadBalancerPrefix + "healthcheck-httpcode" - SessionStick = AnnotationLoadBalancerPrefix + "sticky-session" // SessionStick sticky session - SessionStickType = AnnotationLoadBalancerPrefix + "sticky-session-type" // SessionStickType session sticky type - CookieTimeout = AnnotationLoadBalancerPrefix + "cookie-timeout" // CookieTimeout cookie timeout - Cookie = AnnotationLoadBalancerPrefix + "cookie" // Cookie lb cookie - PersistenceTimeout = AnnotationLoadBalancerPrefix + "persistence-timeout" // PersistenceTimeout persistence timeout - ConnectionDrain = AnnotationLoadBalancerPrefix + "connection-drain" // ConnectionDrain connection drain - ConnectionDrainTimeout = AnnotationLoadBalancerPrefix + "connection-drain-timeout" // ConnectionDrainTimeout connection drain timeout - PortVGroup = AnnotationLoadBalancerPrefix + "port-vgroup" // VGroupIDs binding user managed vGroup ids to ports - + AddressType = AnnotationLoadBalancerPrefix + "address-type" // AddressType loadbalancer address type + VswitchIds = AnnotationLoadBalancerPrefix + "vswitch-ids" // VswitchId loadbalancer vswitch id + ChargeType = AnnotationLoadBalancerPrefix + "charge-type" // ChargeType lb charge type + LoadBalancerId = AnnotationLoadBalancerPrefix + "id" // LoadBalancerId lb id + OverrideListener = AnnotationLoadBalancerPrefix + "force-override-listeners" // OverrideListener force override listeners + LoadBalancerName = AnnotationLoadBalancerPrefix + "name" // LoadBalancerName slb name + AddressAllocatedMode = AnnotationLoadBalancerPrefix + "address-allocated-mode" + LoadBalancerEdition = AnnotationLoadBalancerPrefix + "edition" + ListenPorts = AnnotationLoadBalancerPrefix + "listen-ports" + AccessLog = AnnotationLoadBalancerPrefix + "access-log" + HealthCheckEnabled = AnnotationLoadBalancerPrefix + "healthcheck-enabled" // HealthCheckFlag health check flag + HealthCheckPath = AnnotationLoadBalancerPrefix + "healthcheck-path" // HealthCheckType health check type + HealthCheckProtocol = AnnotationLoadBalancerPrefix + "healthcheck-protocol" // HealthCheckConnectPort health check connect port + HealthCheckMethod = AnnotationLoadBalancerPrefix + "healthcheck-method" // HealthyThreshold health check healthy thresh hold + HealthCheckInterval = AnnotationLoadBalancerPrefix + "healthcheck-interval-seconds" // HealthCheckInterval health check interval + HealthCheckTimeout = AnnotationLoadBalancerPrefix + "healthcheck-timeout-seconds" // HealthCheckTimeout health check timeout + HealthThreshold = AnnotationLoadBalancerPrefix + "healthy-threshold-count" // HealthCheckDomain health check domain + UnHealthThreshold = AnnotationLoadBalancerPrefix + "unhealthy-threshold-count" // HealthCheckHTTPCode health check http code + HealthCheckHTTPCode = AnnotationLoadBalancerPrefix + "healthcheck-httpcode" // VServerBackend Attribute BackendLabel = AnnotationLoadBalancerPrefix + "backend-label" // BackendLabel backend labels BackendType = "service.beta.kubernetes.io/backend-type" // BackendType backend type RemoveUnscheduled = AnnotationLoadBalancerPrefix + "remove-unscheduled-backend" // RemoveUnscheduled remove unscheduled node from backends - VGroupWeight = AnnotationLoadBalancerPrefix + "vgroup-weight" // VGroupWeight total weight of a vGroup ) const ( @@ -113,72 +64,293 @@ const ( AlbCanaryWeight = AnnotationAlbPrefix + "canary-weight" AlbSslRedirect = AnnotationAlbPrefix + "ssl-redirect" ) -const ( - // ServiceAnnotationPrivateZonePrefix private zone prefix - ServiceAnnotationPrivateZonePrefix = "private-zone-" - // ServiceAnnotationLoadBalancerPrivateZoneName private zone name - PrivateZoneName = ServiceAnnotationPrivateZonePrefix + "name" - // ServiceAnnotationLoadBalancerPrivateZoneId private zone id - PrivateZoneId = ServiceAnnotationPrivateZonePrefix + "id" +type ParseOptions struct { + exact bool + alternativePrefixes []string +} - // ServiceAnnotationLoadBalancerPrivateZoneRecordName private zone record name - PrivateZoneRecordName = ServiceAnnotationPrivateZonePrefix + "record-name" +type ParseOption func(opts *ParseOptions) - // ServiceAnnotationLoadBalancerPrivateZoneRecordTTL private zone record ttl - PrivateZoneRecordTTL = ServiceAnnotationPrivateZonePrefix + "record-ttl" -) +type Parser interface { + ParseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) bool + + ParseBoolAnnotation(annotation string, value *bool, annotations map[string]string, opts ...ParseOption) (bool, error) -func NewAnnotationRequest(svc *corev1.Service) *AnnotationRequest { - return &AnnotationRequest{svc} + ParseInt64Annotation(annotation string, value *int64, annotations map[string]string, opts ...ParseOption) (bool, error) + + ParseStringSliceAnnotation(annotation string, value *[]string, annotations map[string]string, opts ...ParseOption) bool + + ParseJSONAnnotation(annotation string, value interface{}, annotations map[string]string, opts ...ParseOption) (bool, error) + + ParseStringMapAnnotation(annotation string, value *map[string]string, annotations map[string]string, opts ...ParseOption) (bool, error) } -func (n *AnnotationRequest) Get(k string) string { - if n.Svc == nil { - klog.Infof("extract annotation %s from empty service", k) - return "" +func NewSuffixAnnotationParser(annotationPrefix string) *suffixAnnotationParser { + return &suffixAnnotationParser{ + annotationPrefix: annotationPrefix, } +} + +var _ Parser = (*suffixAnnotationParser)(nil) - if n.Svc.Annotations == nil { - return "" +type suffixAnnotationParser struct { + annotationPrefix string +} + +func (p *suffixAnnotationParser) ParseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) bool { + ret, _ := p.parseStringAnnotation(annotation, value, annotations, opts...) + return ret +} + +func (p *suffixAnnotationParser) ParseBoolAnnotation(annotation string, value *bool, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + val, err := strconv.ParseBool(raw) + if err != nil { + return true, errors.Wrapf(err, "failed to parse bool annotation, %v: %v", matchedKey, raw) } + *value = val + return true, nil +} + +func (p *suffixAnnotationParser) ParseInt64Annotation(annotation string, value *int64, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + i, err := strconv.ParseInt(raw, 10, 64) + if err != nil { + return true, errors.Wrapf(err, "failed to parse int64 annotation, %v: %v", matchedKey, raw) + } + *value = i + return true, nil +} - key := composite(AnnotationPrefix, k) - v, ok := n.Svc.Annotations[key] +func (p *suffixAnnotationParser) ParseStringSliceAnnotation(annotation string, value *[]string, annotations map[string]string, opts ...ParseOption) bool { + raw := "" + if exists, _ := p.parseStringAnnotation(annotation, &raw, annotations, opts...); !exists { + return false + } + *value = splitCommaSeparatedString(raw) + return true +} + +func (p *suffixAnnotationParser) ParseJSONAnnotation(annotation string, value interface{}, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + if err := json.Unmarshal([]byte(raw), value); err != nil { + return true, errors.Wrapf(err, "failed to parse json annotation, %v: %v", matchedKey, raw) + } + return true, nil +} + +func (p *suffixAnnotationParser) ParseStringMapAnnotation(annotation string, value *map[string]string, annotations map[string]string, opts ...ParseOption) (bool, error) { + raw := "" + exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) + if !exists { + return false, nil + } + rawKVPairs := splitCommaSeparatedString(raw) + keyValues := make(map[string]string) + for _, kvPair := range rawKVPairs { + parts := strings.SplitN(kvPair, "=", 2) + if len(parts) != 2 { + return false, errors.Errorf("failed to parse stringMap annotation, %v: %v", matchedKey, raw) + } + key := parts[0] + value := parts[1] + if len(key) == 0 { + return false, errors.Errorf("failed to parse stringMap annotation, %v: %v", matchedKey, raw) + } + keyValues[key] = value + } + if value != nil { + *value = keyValues + } + return true, nil +} + +func (p *suffixAnnotationParser) parseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) (bool, string) { + keys := p.buildAnnotationKeys(annotation, opts...) + for _, key := range keys { + if raw, ok := annotations[key]; ok { + *value = raw + return true, key + } + } + return false, "" +} + +// buildAnnotationKey returns list of full annotation keys based on suffix and parse options +func (p *suffixAnnotationParser) buildAnnotationKeys(suffix string, opts ...ParseOption) []string { + keys := []string{} + parseOpts := ParseOptions{} + for _, opt := range opts { + opt(&parseOpts) + } + if parseOpts.exact { + keys = append(keys, suffix) + } else { + keys = append(keys, fmt.Sprintf("%v/%v", p.annotationPrefix, suffix)) + for _, pfx := range parseOpts.alternativePrefixes { + keys = append(keys, fmt.Sprintf("%v/%v", pfx, suffix)) + } + } + return keys +} + +func splitCommaSeparatedString(commaSeparatedString string) []string { + var result []string + parts := strings.Split(commaSeparatedString, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if len(part) == 0 { + continue + } + result = append(result, part) + } + return result +} + +// IngressAnnotation has a method to parse annotations located in Ingress +type IngressAnnotation interface { + Parse(ing *networking.Ingress) (interface{}, error) +} + +type ingAnnotations map[string]string + +func (a ingAnnotations) parseBool(name string) (bool, error) { + val, ok := a[name] if ok { - return v + b, err := strconv.ParseBool(val) + if err != nil { + return false, NewInvalidAnnotationContent(name, val) + } + return b, nil } + return false, ErrMissingAnnotations +} - lkey := composite(AnnotationLegacyPrefix, k) - v, ok = n.Svc.Annotations[lkey] +func (a ingAnnotations) parseString(name string) (string, error) { + val, ok := a[name] if ok { - return v + s := normalizeString(val) + if len(s) == 0 { + return "", NewInvalidAnnotationContent(name, val) + } + + return s, nil + } + return "", ErrMissingAnnotations +} + +func (a ingAnnotations) parseInt(name string) (int, error) { + val, ok := a[name] + if ok { + i, err := strconv.Atoi(val) + if err != nil { + return 0, NewInvalidAnnotationContent(name, val) + } + return i, nil + } + return 0, ErrMissingAnnotations +} + +func checkAnnotation(name string, ing *networking.Ingress) error { + if ing == nil || len(ing.GetAnnotations()) == 0 { + return ErrMissingAnnotations + } + if name == "" { + return ErrInvalidAnnotationName + } + + return nil +} + +// GetStringAnnotation extracts a string from an Ingress annotation +func GetStringAnnotation(name string, ing *networking.Ingress) (string, error) { + v := GetAnnotationWith(name) + err := checkAnnotation(v, ing) + if err != nil { + return "", err } + return ingAnnotations(ing.GetAnnotations()).parseString(v) +} + +// GetStringAnnotationMutil extracts a string from an Ingress annotation +func GetStringAnnotationMutil(name, name1 string, ing *networking.Ingress) string { + if val, ok := ing.Annotations[name]; ok { + return val + } + if val, ok := ing.Annotations[name1]; ok { + return val + } return "" } -func (n *AnnotationRequest) GetRaw(k string) string { - return n.Svc.Annotations[k] +// GetAnnotationWith returns the ingress annotations +func GetAnnotationWith(ann string) string { + return fmt.Sprintf("%v", ann) } -func (n *AnnotationRequest) GetDefaultLoadBalancerName() string { - //GCE requires that the name of a load balancer starts with a lower case letter. - ret := "a" + string(n.Svc.UID) - ret = strings.Replace(ret, "-", "", -1) - //AWS requires that the name of a load balancer is shorter than 32 bytes. - if len(ret) > 32 { - ret = ret[:32] +func normalizeString(input string) string { + trimmedContent := []string{} + for _, line := range strings.Split(input, "\n") { + trimmedContent = append(trimmedContent, strings.TrimSpace(line)) } - return ret + + return strings.Join(trimmedContent, "\n") } -func composite(p, k string) string { - return fmt.Sprintf("%s-%s", p, k) +var ( + // ErrMissingAnnotations the ingress rule does not contain annotations + // This is an error only when annotations are being parsed + ErrMissingAnnotations = errors.New("ingress rule without annotations") + + // ErrInvalidAnnotationName the ingress rule does contains an invalid + // annotation name + ErrInvalidAnnotationName = errors.New("invalid annotation name") +) + +// NewInvalidAnnotationContent returns a new InvalidContent error +func NewInvalidAnnotationContent(name string, val interface{}) error { + return InvalidContent{ + Name: fmt.Sprintf("the annotation %v does not contain a valid value (%v)", name, val), + } +} + +// InvalidConfiguration Error +type InvalidConfiguration struct { + Name string +} + +func (e InvalidConfiguration) Error() string { + return e.Name } -func Annotation(k string) string { - return composite(AnnotationPrefix, k) +// InvalidContent error +type InvalidContent struct { + Name string } -type AnnotationRequest struct{ Svc *corev1.Service } +func (e InvalidContent) Error() string { + return e.Name +} + +// LocationDenied error +type LocationDenied struct { + Reason error +} + +func (e LocationDenied) Error() string { + return e.Reason.Error() +} diff --git a/pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go b/pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go deleted file mode 100644 index cacd37e5b..000000000 --- a/pkg/controller/ingress/reconcile/annotations/class_annotation_matcher.go +++ /dev/null @@ -1,40 +0,0 @@ -package annotations - -import ( - networking "k8s.io/api/networking/v1" - "k8s.io/cloud-provider-alibaba-cloud/pkg/util" -) - -type ClassAnnotationMatcher interface { - Matches(ingClassAnnotation string) bool -} - -func NewDefaultClassAnnotationMatcher(ingressClass string) *defaultClassAnnotationMatcher { - return &defaultClassAnnotationMatcher{ - ingressClass: ingressClass, - } -} - -var _ ClassAnnotationMatcher = &defaultClassAnnotationMatcher{} - -type defaultClassAnnotationMatcher struct { - ingressClass string -} - -func (m *defaultClassAnnotationMatcher) Matches(ingClassAnnotation string) bool { - if m.ingressClass == "" && ingClassAnnotation == util.IngressClassALB { - return true - } - return ingClassAnnotation == m.ingressClass -} - -func IsIngressAlbClass(ing networking.Ingress) bool { - classAnnotationMatcher := NewDefaultClassAnnotationMatcher(util.IngressClassALB) - - if ingClassAnnotation, exists := ing.Annotations[util.IngressClass]; exists { - if matchesIngressClass := classAnnotationMatcher.Matches(ingClassAnnotation); matchesIngressClass { - return true - } - } - return false -} diff --git a/pkg/controller/ingress/reconcile/annotations/parser.go b/pkg/controller/ingress/reconcile/annotations/parser.go deleted file mode 100644 index 84778aaaf..000000000 --- a/pkg/controller/ingress/reconcile/annotations/parser.go +++ /dev/null @@ -1,426 +0,0 @@ -package annotations - -import ( - "encoding/json" - "fmt" - "net/url" - "strconv" - "strings" - - "github.com/pkg/errors" - networking "k8s.io/api/networking/v1" - "k8s.io/apimachinery/pkg/util/sets" -) - -type ParseOptions struct { - exact bool - alternativePrefixes []string -} - -type ParseOption func(opts *ParseOptions) - -func WithExact() ParseOption { - return func(opts *ParseOptions) { - opts.exact = true - } -} - -func WithAlternativePrefixes(prefixes ...string) ParseOption { - return func(opts *ParseOptions) { - opts.alternativePrefixes = append(opts.alternativePrefixes, prefixes...) - } -} - -type Parser interface { - ParseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) bool - - ParseBoolAnnotation(annotation string, value *bool, annotations map[string]string, opts ...ParseOption) (bool, error) - - ParseInt64Annotation(annotation string, value *int64, annotations map[string]string, opts ...ParseOption) (bool, error) - - ParseStringSliceAnnotation(annotation string, value *[]string, annotations map[string]string, opts ...ParseOption) bool - - ParseJSONAnnotation(annotation string, value interface{}, annotations map[string]string, opts ...ParseOption) (bool, error) - - ParseStringMapAnnotation(annotation string, value *map[string]string, annotations map[string]string, opts ...ParseOption) (bool, error) -} - -func NewSuffixAnnotationParser(annotationPrefix string) *suffixAnnotationParser { - return &suffixAnnotationParser{ - annotationPrefix: annotationPrefix, - } -} - -var _ Parser = (*suffixAnnotationParser)(nil) - -type suffixAnnotationParser struct { - annotationPrefix string -} - -func (p *suffixAnnotationParser) ParseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) bool { - ret, _ := p.parseStringAnnotation(annotation, value, annotations, opts...) - return ret -} - -func (p *suffixAnnotationParser) ParseBoolAnnotation(annotation string, value *bool, annotations map[string]string, opts ...ParseOption) (bool, error) { - raw := "" - exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) - if !exists { - return false, nil - } - val, err := strconv.ParseBool(raw) - if err != nil { - return true, errors.Wrapf(err, "failed to parse bool annotation, %v: %v", matchedKey, raw) - } - *value = val - return true, nil -} - -func (p *suffixAnnotationParser) ParseInt64Annotation(annotation string, value *int64, annotations map[string]string, opts ...ParseOption) (bool, error) { - raw := "" - exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) - if !exists { - return false, nil - } - i, err := strconv.ParseInt(raw, 10, 64) - if err != nil { - return true, errors.Wrapf(err, "failed to parse int64 annotation, %v: %v", matchedKey, raw) - } - *value = i - return true, nil -} - -func (p *suffixAnnotationParser) ParseStringSliceAnnotation(annotation string, value *[]string, annotations map[string]string, opts ...ParseOption) bool { - raw := "" - if exists, _ := p.parseStringAnnotation(annotation, &raw, annotations, opts...); !exists { - return false - } - *value = splitCommaSeparatedString(raw) - return true -} - -func (p *suffixAnnotationParser) ParseJSONAnnotation(annotation string, value interface{}, annotations map[string]string, opts ...ParseOption) (bool, error) { - raw := "" - exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) - if !exists { - return false, nil - } - if err := json.Unmarshal([]byte(raw), value); err != nil { - return true, errors.Wrapf(err, "failed to parse json annotation, %v: %v", matchedKey, raw) - } - return true, nil -} - -func (p *suffixAnnotationParser) ParseStringMapAnnotation(annotation string, value *map[string]string, annotations map[string]string, opts ...ParseOption) (bool, error) { - raw := "" - exists, matchedKey := p.parseStringAnnotation(annotation, &raw, annotations, opts...) - if !exists { - return false, nil - } - rawKVPairs := splitCommaSeparatedString(raw) - keyValues := make(map[string]string) - for _, kvPair := range rawKVPairs { - parts := strings.SplitN(kvPair, "=", 2) - if len(parts) != 2 { - return false, errors.Errorf("failed to parse stringMap annotation, %v: %v", matchedKey, raw) - } - key := parts[0] - value := parts[1] - if len(key) == 0 { - return false, errors.Errorf("failed to parse stringMap annotation, %v: %v", matchedKey, raw) - } - keyValues[key] = value - } - if value != nil { - *value = keyValues - } - return true, nil -} - -func (p *suffixAnnotationParser) parseStringAnnotation(annotation string, value *string, annotations map[string]string, opts ...ParseOption) (bool, string) { - keys := p.buildAnnotationKeys(annotation, opts...) - for _, key := range keys { - if raw, ok := annotations[key]; ok { - *value = raw - return true, key - } - } - return false, "" -} - -// buildAnnotationKey returns list of full annotation keys based on suffix and parse options -func (p *suffixAnnotationParser) buildAnnotationKeys(suffix string, opts ...ParseOption) []string { - keys := []string{} - parseOpts := ParseOptions{} - for _, opt := range opts { - opt(&parseOpts) - } - if parseOpts.exact { - keys = append(keys, suffix) - } else { - keys = append(keys, fmt.Sprintf("%v/%v", p.annotationPrefix, suffix)) - for _, pfx := range parseOpts.alternativePrefixes { - keys = append(keys, fmt.Sprintf("%v/%v", pfx, suffix)) - } - } - return keys -} - -func splitCommaSeparatedString(commaSeparatedString string) []string { - var result []string - parts := strings.Split(commaSeparatedString, ",") - for _, part := range parts { - part = strings.TrimSpace(part) - if len(part) == 0 { - continue - } - result = append(result, part) - } - return result -} - -var ( - // AnnotationsPrefix is the mutable attribute that the controller explicitly refers to - AnnotationsPrefix = DefaultAnnotationsPrefix -) - -// IngressAnnotation has a method to parse annotations located in Ingress -type IngressAnnotation interface { - Parse(ing *networking.Ingress) (interface{}, error) -} - -type ingAnnotations map[string]string - -func (a ingAnnotations) parseBool(name string) (bool, error) { - val, ok := a[name] - if ok { - b, err := strconv.ParseBool(val) - if err != nil { - return false, NewInvalidAnnotationContent(name, val) - } - return b, nil - } - return false, ErrMissingAnnotations -} - -func (a ingAnnotations) parseString(name string) (string, error) { - val, ok := a[name] - if ok { - s := normalizeString(val) - if len(s) == 0 { - return "", NewInvalidAnnotationContent(name, val) - } - - return s, nil - } - return "", ErrMissingAnnotations -} - -func (a ingAnnotations) parseInt(name string) (int, error) { - val, ok := a[name] - if ok { - i, err := strconv.Atoi(val) - if err != nil { - return 0, NewInvalidAnnotationContent(name, val) - } - return i, nil - } - return 0, ErrMissingAnnotations -} - -func checkAnnotation(name string, ing *networking.Ingress) error { - if ing == nil || len(ing.GetAnnotations()) == 0 { - return ErrMissingAnnotations - } - if name == "" { - return ErrInvalidAnnotationName - } - - return nil -} - -// GetBoolAnnotation extracts a boolean from an Ingress annotation -func GetBoolAnnotation(name string, ing *networking.Ingress) (bool, error) { - v := GetAnnotationWith(name) - err := checkAnnotation(v, ing) - if err != nil { - return false, err - } - return ingAnnotations(ing.GetAnnotations()).parseBool(v) -} - -// GetStringAnnotation extracts a string from an Ingress annotation -func GetStringAnnotation(name string, ing *networking.Ingress) (string, error) { - v := GetAnnotationWith(name) - err := checkAnnotation(v, ing) - if err != nil { - return "", err - } - - return ingAnnotations(ing.GetAnnotations()).parseString(v) -} - -// GetStringAnnotationMutil extracts a string from an Ingress annotation -func GetStringAnnotationMutil(name, name1 string, ing *networking.Ingress) string { - if val, ok := ing.Annotations[name]; ok { - return val - } - if val, ok := ing.Annotations[name1]; ok { - return val - } - return "" -} - -// GetIntAnnotation extracts an int from an Ingress annotation -func GetIntAnnotation(name string, ing *networking.Ingress) (int, error) { - v := GetAnnotationWith(name) - err := checkAnnotation(v, ing) - if err != nil { - return 0, err - } - return ingAnnotations(ing.GetAnnotations()).parseInt(v) -} - -// GetAnnotationWith returns the ingress annotations -func GetAnnotationWith(ann string) string { - return fmt.Sprintf("%v", ann) -} - -func normalizeString(input string) string { - trimmedContent := []string{} - for _, line := range strings.Split(input, "\n") { - trimmedContent = append(trimmedContent, strings.TrimSpace(line)) - } - - return strings.Join(trimmedContent, "\n") -} - -var configmapAnnotations = sets.NewString( - "auth-proxy-set-header", - "fastcgi-params-configmap", -) - -// AnnotationsReferencesConfigmap checks if at least one annotation in the Ingress rule -// references a configmap. -func AnnotationsReferencesConfigmap(ing *networking.Ingress) bool { - if ing == nil || len(ing.GetAnnotations()) == 0 { - return false - } - - for name := range ing.GetAnnotations() { - if configmapAnnotations.Has(name) { - return true - } - } - - return false -} - -// StringToURL parses the provided string into URL and returns error -// message in case of failure -func StringToURL(input string) (*url.URL, error) { - parsedURL, err := url.Parse(input) - if err != nil { - return nil, fmt.Errorf("%v is not a valid URL: %v", input, err) - } - - if parsedURL.Scheme == "" { - return nil, fmt.Errorf("url scheme is empty") - } else if parsedURL.Host == "" { - return nil, fmt.Errorf("url host is empty") - } else if strings.Contains(parsedURL.Host, "..") { - return nil, fmt.Errorf("invalid url host") - } - - return parsedURL, nil -} - -var ( - // ErrMissingAnnotations the ingress rule does not contain annotations - // This is an error only when annotations are being parsed - ErrMissingAnnotations = errors.New("ingress rule without annotations") - - // ErrInvalidAnnotationName the ingress rule does contains an invalid - // annotation name - ErrInvalidAnnotationName = errors.New("invalid annotation name") -) - -// NewInvalidAnnotationConfiguration returns a new InvalidConfiguration error for use when -// annotations are not correctly configured -func NewInvalidAnnotationConfiguration(name string, reason string) error { - return InvalidConfiguration{ - Name: fmt.Sprintf("the annotation %v does not contain a valid configuration: %v", name, reason), - } -} - -// NewInvalidAnnotationContent returns a new InvalidContent error -func NewInvalidAnnotationContent(name string, val interface{}) error { - return InvalidContent{ - Name: fmt.Sprintf("the annotation %v does not contain a valid value (%v)", name, val), - } -} - -// NewLocationDenied returns a new LocationDenied error -func NewLocationDenied(reason string) error { - return LocationDenied{ - Reason: errors.Errorf("Location denied, reason: %v", reason), - } -} - -// InvalidConfiguration Error -type InvalidConfiguration struct { - Name string -} - -func (e InvalidConfiguration) Error() string { - return e.Name -} - -// InvalidContent error -type InvalidContent struct { - Name string -} - -func (e InvalidContent) Error() string { - return e.Name -} - -// LocationDenied error -type LocationDenied struct { - Reason error -} - -func (e LocationDenied) Error() string { - return e.Reason.Error() -} - -// IsLocationDenied checks if the err is an error which -// indicates a location should return HTTP code 503 -func IsLocationDenied(e error) bool { - _, ok := e.(LocationDenied) - return ok -} - -// IsMissingAnnotations checks if the err is an error which -// indicates the ingress does not contain annotations -func IsMissingAnnotations(e error) bool { - return e == ErrMissingAnnotations -} - -// IsInvalidContent checks if the err is an error which -// indicates an annotations value is not valid -func IsInvalidContent(e error) bool { - _, ok := e.(InvalidContent) - return ok -} - -// New returns a new error -func New(m string) error { - return errors.New(m) -} - -// Errorf formats according to a format specifier and returns the string -// as a value that satisfies error. -func Errorf(format string, args ...interface{}) error { - return errors.Errorf(format, args...) -}