code
stringlengths 12
335k
| docstring
stringlengths 20
20.8k
| func_name
stringlengths 1
105
| language
stringclasses 1
value | repo
stringclasses 498
values | path
stringlengths 5
172
| url
stringlengths 43
235
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go | Apache-2.0 |
func (v *version) ClusterTrustBundles() ClusterTrustBundleInformer {
return &clusterTrustBundleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
} | ClusterTrustBundles returns a ClusterTrustBundleInformer. | ClusterTrustBundles | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/certificates/v1alpha1/interface.go | Apache-2.0 |
func NewClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredClusterTrustBundleInformer(client, resyncPeriod, indexers, nil)
} | NewClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle 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. | NewClusterTrustBundleInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go | Apache-2.0 |
func NewFilteredClusterTrustBundleInformer(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.CertificatesV1alpha1().ClusterTrustBundles().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.CertificatesV1alpha1().ClusterTrustBundles().Watch(context.TODO(), options)
},
},
&certificatesv1alpha1.ClusterTrustBundle{},
resyncPeriod,
indexers,
)
} | NewFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle 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. | NewFilteredClusterTrustBundleInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/interface.go | Apache-2.0 |
func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
} | V1 returns a new v1.Interface. | V1 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/interface.go | Apache-2.0 |
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
} | V1alpha1 returns a new v1alpha1.Interface. | V1alpha1 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/interface.go | Apache-2.0 |
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
} | V1beta1 returns a new v1beta1.Interface. | V1beta1 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/interface.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go | Apache-2.0 |
func (v *version) PriorityClasses() PriorityClassInformer {
return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
} | PriorityClasses returns a PriorityClassInformer. | PriorityClasses | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go | Apache-2.0 |
func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil)
} | 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. | NewPriorityClassInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go | Apache-2.0 |
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,
)
} | 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. | NewFilteredPriorityClassInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go | Apache-2.0 |
func (v *version) PriorityClasses() PriorityClassInformer {
return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
} | PriorityClasses returns a PriorityClassInformer. | PriorityClasses | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go | Apache-2.0 |
func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil)
} | 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. | NewPriorityClassInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go | Apache-2.0 |
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,
)
} | 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. | NewFilteredPriorityClassInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go | Apache-2.0 |
func (v *version) PriorityClasses() PriorityClassInformer {
return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
} | PriorityClasses returns a PriorityClassInformer. | PriorityClasses | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go | Apache-2.0 |
func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil)
} | 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. | NewPriorityClassInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go | Apache-2.0 |
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,
)
} | 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. | NewFilteredPriorityClassInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/interface.go | Apache-2.0 |
func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
} | V1 returns a new v1.Interface. | V1 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/interface.go | Apache-2.0 |
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
} | V1beta1 returns a new v1beta1.Interface. | V1beta1 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/interface.go | Apache-2.0 |
func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil)
} | 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. | NewLeaseInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go | Apache-2.0 |
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,
)
} | 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. | NewFilteredLeaseInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go | Apache-2.0 |
func (v *version) Leases() LeaseInformer {
return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} | Leases returns a LeaseInformer. | Leases | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go | Apache-2.0 |
func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil)
} | 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. | NewLeaseInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1/lease.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1/lease.go | Apache-2.0 |
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,
)
} | 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. | NewFilteredLeaseInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1/lease.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1/lease.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1/interface.go | Apache-2.0 |
func (v *version) Leases() LeaseInformer {
return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} | Leases returns a LeaseInformer. | Leases | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/coordination/v1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/coordination/v1/interface.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/apiserverinternal/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go | Apache-2.0 |
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
} | V1alpha1 returns a new v1alpha1.Interface. | V1alpha1 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/apiserverinternal/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go | Apache-2.0 |
func NewStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredStorageVersionInformer(client, resyncPeriod, indexers, nil)
} | 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. | NewStorageVersionInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go | Apache-2.0 |
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,
)
} | 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. | NewFilteredStorageVersionInformer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go | Apache-2.0 |
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} | New returns a new Interface. | New | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go | Apache-2.0 |
func (v *version) StorageVersions() StorageVersionInformer {
return &storageVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
} | StorageVersions returns a StorageVersionInformer. | StorageVersions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go | Apache-2.0 |
func (c *Fake) AddReactor(verb, resource string, reaction ReactionFunc) {
c.ReactionChain = append(c.ReactionChain, &SimpleReactor{verb, resource, reaction})
} | AddReactor appends a reactor to the end of the chain. | AddReactor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) PrependReactor(verb, resource string, reaction ReactionFunc) {
c.ReactionChain = append([]Reactor{&SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
} | PrependReactor adds a reactor to the beginning of the chain. | PrependReactor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) AddWatchReactor(resource string, reaction WatchReactionFunc) {
c.Lock()
defer c.Unlock()
c.WatchReactionChain = append(c.WatchReactionChain, &SimpleWatchReactor{resource, reaction})
} | AddWatchReactor appends a reactor to the end of the chain. | AddWatchReactor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) PrependWatchReactor(resource string, reaction WatchReactionFunc) {
c.Lock()
defer c.Unlock()
c.WatchReactionChain = append([]WatchReactor{&SimpleWatchReactor{resource, reaction}}, c.WatchReactionChain...)
} | PrependWatchReactor adds a reactor to the beginning of the chain. | PrependWatchReactor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) AddProxyReactor(resource string, reaction ProxyReactionFunc) {
c.ProxyReactionChain = append(c.ProxyReactionChain, &SimpleProxyReactor{resource, reaction})
} | AddProxyReactor appends a reactor to the end of the chain. | AddProxyReactor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) PrependProxyReactor(resource string, reaction ProxyReactionFunc) {
c.ProxyReactionChain = append([]ProxyReactor{&SimpleProxyReactor{resource, reaction}}, c.ProxyReactionChain...)
} | PrependProxyReactor adds a reactor to the beginning of the chain. | PrependProxyReactor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) Invokes(action Action, defaultReturnObj runtime.Object) (runtime.Object, error) {
c.Lock()
defer c.Unlock()
actionCopy := action.DeepCopy()
c.actions = append(c.actions, action.DeepCopy())
for _, reactor := range c.ReactionChain {
if !reactor.Handles(actionCopy) {
continue
}
handled, ret, err := reactor.React(actionCopy)
if !handled {
continue
}
return ret, err
}
return defaultReturnObj, nil
} | Invokes records the provided Action and then invokes the ReactionFunc that
handles the action if one exists. defaultReturnObj is expected to be of the
same type a normal call would return. | Invokes | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) InvokesWatch(action Action) (watch.Interface, error) {
c.Lock()
defer c.Unlock()
actionCopy := action.DeepCopy()
c.actions = append(c.actions, action.DeepCopy())
for _, reactor := range c.WatchReactionChain {
if !reactor.Handles(actionCopy) {
continue
}
handled, ret, err := reactor.React(actionCopy)
if !handled {
continue
}
return ret, err
}
return nil, fmt.Errorf("unhandled watch: %#v", action)
} | InvokesWatch records the provided Action and then invokes the ReactionFunc
that handles the action if one exists. | InvokesWatch | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper {
c.Lock()
defer c.Unlock()
actionCopy := action.DeepCopy()
c.actions = append(c.actions, action.DeepCopy())
for _, reactor := range c.ProxyReactionChain {
if !reactor.Handles(actionCopy) {
continue
}
handled, ret, err := reactor.React(actionCopy)
if !handled || err != nil {
continue
}
return ret
}
return nil
} | InvokesProxy records the provided Action and then invokes the ReactionFunc
that handles the action if one exists. | InvokesProxy | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) ClearActions() {
c.Lock()
defer c.Unlock()
c.actions = make([]Action, 0)
} | ClearActions clears the history of actions called on the fake client. | ClearActions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func (c *Fake) Actions() []Action {
c.RLock()
defer c.RUnlock()
fa := make([]Action, len(c.actions))
copy(fa, c.actions)
return fa
} | Actions returns a chronologically ordered slice fake actions called on the
fake client. | Actions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fake.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fake.go | Apache-2.0 |
func ObjectReaction(tracker ObjectTracker) ReactionFunc {
return func(action Action) (bool, runtime.Object, error) {
ns := action.GetNamespace()
gvr := action.GetResource()
// Here and below we need to switch on implementation types,
// not on interfaces, as some interfaces are identical
// (e.g. UpdateAction and CreateAction), so if we use them,
// updates and creates end up matching the same case branch.
switch action := action.(type) {
case ListActionImpl:
obj, err := tracker.List(gvr, action.GetKind(), ns)
return true, obj, err
case GetActionImpl:
obj, err := tracker.Get(gvr, ns, action.GetName())
return true, obj, err
case CreateActionImpl:
objMeta, err := meta.Accessor(action.GetObject())
if err != nil {
return true, nil, err
}
if action.GetSubresource() == "" {
err = tracker.Create(gvr, action.GetObject(), ns)
} else {
oldObj, getOldObjErr := tracker.Get(gvr, ns, objMeta.GetName())
if getOldObjErr != nil {
return true, nil, getOldObjErr
}
// Check whether the existing historical object type is the same as the current operation object type that needs to be updated, and if it is the same, perform the update operation.
if reflect.TypeOf(oldObj) == reflect.TypeOf(action.GetObject()) {
// TODO: Currently we're handling subresource creation as an update
// on the enclosing resource. This works for some subresources but
// might not be generic enough.
err = tracker.Update(gvr, action.GetObject(), ns)
} else {
// If the historical object type is different from the current object type, need to make sure we return the object submitted,don't persist the submitted object in the tracker.
return true, action.GetObject(), nil
}
}
if err != nil {
return true, nil, err
}
obj, err := tracker.Get(gvr, ns, objMeta.GetName())
return true, obj, err
case UpdateActionImpl:
objMeta, err := meta.Accessor(action.GetObject())
if err != nil {
return true, nil, err
}
err = tracker.Update(gvr, action.GetObject(), ns)
if err != nil {
return true, nil, err
}
obj, err := tracker.Get(gvr, ns, objMeta.GetName())
return true, obj, err
case DeleteActionImpl:
err := tracker.Delete(gvr, ns, action.GetName())
if err != nil {
return true, nil, err
}
return true, nil, nil
case PatchActionImpl:
obj, err := tracker.Get(gvr, ns, action.GetName())
if err != nil {
return true, nil, err
}
old, err := json.Marshal(obj)
if err != nil {
return true, nil, err
}
// reset the object in preparation to unmarshal, since unmarshal does not guarantee that fields
// in obj that are removed by patch are cleared
value := reflect.ValueOf(obj)
value.Elem().Set(reflect.New(value.Type().Elem()).Elem())
switch action.GetPatchType() {
case types.JSONPatchType:
patch, err := jsonpatch.DecodePatch(action.GetPatch())
if err != nil {
return true, nil, err
}
modified, err := patch.Apply(old)
if err != nil {
return true, nil, err
}
if err = json.Unmarshal(modified, obj); err != nil {
return true, nil, err
}
case types.MergePatchType:
modified, err := jsonpatch.MergePatch(old, action.GetPatch())
if err != nil {
return true, nil, err
}
if err := json.Unmarshal(modified, obj); err != nil {
return true, nil, err
}
case types.StrategicMergePatchType, types.ApplyPatchType:
mergedByte, err := strategicpatch.StrategicMergePatch(old, action.GetPatch(), obj)
if err != nil {
return true, nil, err
}
if err = json.Unmarshal(mergedByte, obj); err != nil {
return true, nil, err
}
default:
return true, nil, fmt.Errorf("PatchType is not supported")
}
if err = tracker.Update(gvr, obj, ns); err != nil {
return true, nil, err
}
return true, obj, nil
default:
return false, nil, fmt.Errorf("no reaction implemented for %s", action)
}
} | ObjectReaction returns a ReactionFunc that applies core.Action to
the given tracker. | ObjectReaction | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fixture.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fixture.go | Apache-2.0 |
func NewObjectTracker(scheme ObjectScheme, decoder runtime.Decoder) ObjectTracker {
return &tracker{
scheme: scheme,
decoder: decoder,
objects: make(map[schema.GroupVersionResource]map[types.NamespacedName]runtime.Object),
watchers: make(map[schema.GroupVersionResource]map[string][]*watch.RaceFreeFakeWatcher),
}
} | NewObjectTracker returns an ObjectTracker that can be used to keep track
of objects for the fake clientset. Mostly useful for unit tests. | NewObjectTracker | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fixture.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fixture.go | Apache-2.0 |
func filterByNamespace(objs map[types.NamespacedName]runtime.Object, ns string) ([]runtime.Object, error) {
var res []runtime.Object
for _, obj := range objs {
acc, err := meta.Accessor(obj)
if err != nil {
return nil, err
}
if ns != "" && acc.GetNamespace() != ns {
continue
}
res = append(res, obj)
}
// Sort res to get deterministic order.
sort.Slice(res, func(i, j int) bool {
acc1, _ := meta.Accessor(res[i])
acc2, _ := meta.Accessor(res[j])
if acc1.GetNamespace() != acc2.GetNamespace() {
return acc1.GetNamespace() < acc2.GetNamespace()
}
return acc1.GetName() < acc2.GetName()
})
return res, nil
} | filterByNamespace returns all objects in the collection that
match provided namespace. Empty namespace matches
non-namespaced objects. | filterByNamespace | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/testing/fixture.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/testing/fixture.go | Apache-2.0 |
func ConfigToExecCluster(config *Config) (*clientauthenticationapi.Cluster, error) {
caData, err := dataFromSliceOrFile(config.CAData, config.CAFile)
if err != nil {
return nil, fmt.Errorf("failed to load CA bundle for execProvider: %v", err)
}
var proxyURL string
if config.Proxy != nil {
req, err := http.NewRequest("", config.Host, nil)
if err != nil {
return nil, fmt.Errorf("failed to create proxy URL request for execProvider: %w", err)
}
url, err := config.Proxy(req)
if err != nil {
return nil, fmt.Errorf("failed to get proxy URL for execProvider: %w", err)
}
if url != nil {
proxyURL = url.String()
}
}
return &clientauthenticationapi.Cluster{
Server: config.Host,
TLSServerName: config.ServerName,
InsecureSkipTLSVerify: config.Insecure,
CertificateAuthorityData: caData,
ProxyURL: proxyURL,
DisableCompression: config.DisableCompression,
Config: config.ExecProvider.Config,
}, nil
} | ConfigToExecCluster creates a clientauthenticationapi.Cluster with the corresponding fields from
the provided Config. | ConfigToExecCluster | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/exec.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/exec.go | Apache-2.0 |
func ExecClusterToConfig(cluster *clientauthenticationapi.Cluster) (*Config, error) {
var proxy func(*http.Request) (*url.URL, error)
if cluster.ProxyURL != "" {
proxyURL, err := url.Parse(cluster.ProxyURL)
if err != nil {
return nil, fmt.Errorf("cannot parse proxy URL: %w", err)
}
proxy = http.ProxyURL(proxyURL)
}
return &Config{
Host: cluster.Server,
TLSClientConfig: TLSClientConfig{
Insecure: cluster.InsecureSkipTLSVerify,
ServerName: cluster.TLSServerName,
CAData: cluster.CertificateAuthorityData,
},
Proxy: proxy,
DisableCompression: cluster.DisableCompression,
}, nil
} | ExecClusterToConfig creates a Config with the corresponding fields from the provided
clientauthenticationapi.Cluster. The returned Config will be anonymous (i.e., it will not have
any authentication-related fields set). | ExecClusterToConfig | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/exec.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/exec.go | Apache-2.0 |
func DefaultServerURL(host, apiPath string, groupVersion schema.GroupVersion, defaultTLS bool) (*url.URL, string, error) {
if host == "" {
return nil, "", fmt.Errorf("host must be a URL or a host:port pair")
}
base := host
hostURL, err := url.Parse(base)
if err != nil || hostURL.Scheme == "" || hostURL.Host == "" {
scheme := "http://"
if defaultTLS {
scheme = "https://"
}
hostURL, err = url.Parse(scheme + base)
if err != nil {
return nil, "", err
}
if hostURL.Path != "" && hostURL.Path != "/" {
return nil, "", fmt.Errorf("host must be a URL or a host:port pair: %q", base)
}
}
// hostURL.Path is optional; a non-empty Path is treated as a prefix that is to be applied to
// all URIs used to access the host. this is useful when there's a proxy in front of the
// apiserver that has relocated the apiserver endpoints, forwarding all requests from, for
// example, /a/b/c to the apiserver. in this case the Path should be /a/b/c.
//
// if running without a frontend proxy (that changes the location of the apiserver), then
// hostURL.Path should be blank.
//
// versionedAPIPath, a path relative to baseURL.Path, points to a versioned API base
versionedAPIPath := DefaultVersionedAPIPath(apiPath, groupVersion)
return hostURL, versionedAPIPath, nil
} | DefaultServerURL converts a host, host:port, or URL string to the default base server API path
to use with a Client at a given API version following the standard conventions for a
Kubernetes API. | DefaultServerURL | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/url_utils.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/url_utils.go | Apache-2.0 |
func DefaultVersionedAPIPath(apiPath string, groupVersion schema.GroupVersion) string {
versionedAPIPath := path.Join("/", apiPath)
// Add the version to the end of the path
if len(groupVersion.Group) > 0 {
versionedAPIPath = path.Join(versionedAPIPath, groupVersion.Group, groupVersion.Version)
} else {
versionedAPIPath = path.Join(versionedAPIPath, groupVersion.Version)
}
return versionedAPIPath
} | DefaultVersionedAPIPathFor constructs the default path for the given group version, assuming the given
API path, following the standard conventions of the Kubernetes API. | DefaultVersionedAPIPath | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/url_utils.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/url_utils.go | Apache-2.0 |
func DefaultServerUrlFor(config *Config) (*url.URL, string, error) {
// TODO: move the default to secure when the apiserver supports TLS by default
// config.Insecure is taken to mean "I want HTTPS but don't bother checking the certs against a CA."
hasCA := len(config.CAFile) != 0 || len(config.CAData) != 0
hasCert := len(config.CertFile) != 0 || len(config.CertData) != 0
defaultTLS := hasCA || hasCert || config.Insecure
host := config.Host
if host == "" {
host = "localhost"
}
if config.GroupVersion != nil {
return DefaultServerURL(host, config.APIPath, *config.GroupVersion, defaultTLS)
}
return DefaultServerURL(host, config.APIPath, schema.GroupVersion{}, defaultTLS)
} | DefaultServerUrlFor is shared between IsConfigTransportTLS and RESTClientFor. It
requires Host and Version to be set prior to being called. | DefaultServerUrlFor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/url_utils.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/url_utils.go | Apache-2.0 |
func SetDefaultWarningHandler(l WarningHandler) {
defaultWarningHandlerLock.Lock()
defer defaultWarningHandlerLock.Unlock()
defaultWarningHandler = l
} | SetDefaultWarningHandler sets the default handler clients use when warning headers are encountered.
By default, warnings are logged. Several built-in implementations are provided:
- NoWarnings suppresses warnings.
- WarningLogger logs warnings.
- NewWarningWriter() outputs warnings to the provided writer. | SetDefaultWarningHandler | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/warnings.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/warnings.go | Apache-2.0 |
func NewWarningWriter(out io.Writer, opts WarningWriterOptions) *warningWriter {
h := &warningWriter{out: out, opts: opts}
if opts.Deduplicate {
h.written = map[string]struct{}{}
}
return h
} | NewWarningWriter returns an implementation of WarningHandler that outputs code 299 warnings to the specified writer. | NewWarningWriter | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/warnings.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/warnings.go | Apache-2.0 |
func (w *warningWriter) HandleWarningHeader(code int, agent string, message string) {
if code != 299 || len(message) == 0 {
return
}
w.writtenLock.Lock()
defer w.writtenLock.Unlock()
if w.opts.Deduplicate {
if _, alreadyWritten := w.written[message]; alreadyWritten {
return
}
w.written[message] = struct{}{}
}
w.writtenCount++
if w.opts.Color {
fmt.Fprintf(w.out, "%sWarning:%s %s\n", yellowColor, resetColor, message)
} else {
fmt.Fprintf(w.out, "Warning: %s\n", message)
}
} | HandleWarningHeader prints warnings with code=299 to the configured writer. | HandleWarningHeader | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/warnings.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/warnings.go | Apache-2.0 |
func (b *URLBackoff) Disable() {
klog.V(4).Infof("Disabling backoff strategy")
b.Backoff = flowcontrol.NewBackOff(0*time.Second, 0*time.Second)
} | Disable makes the backoff trivial, i.e., sets it to zero. This might be used
by tests which want to run 1000s of mock requests without slowing down. | Disable | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/urlbackoff.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/urlbackoff.go | Apache-2.0 |
func (b *URLBackoff) baseUrlKey(rawurl *url.URL) string {
// Simple implementation for now, just the host.
// We may backoff specific paths (i.e. "pods") differentially
// in the future.
host, err := url.Parse(rawurl.String())
if err != nil {
klog.V(4).Infof("Error extracting url: %v", rawurl)
panic("bad url!")
}
return host.Host
} | baseUrlKey returns the key which urls will be mapped to.
For example, 127.0.0.1:8080/api/v2/abcde -> 127.0.0.1:8080. | baseUrlKey | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/urlbackoff.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/urlbackoff.go | Apache-2.0 |
func (b *URLBackoff) UpdateBackoff(actualUrl *url.URL, err error, responseCode int) {
// range for retry counts that we store is [0,13]
if responseCode > maxResponseCode || serverIsOverloadedSet.Has(responseCode) {
b.Backoff.Next(b.baseUrlKey(actualUrl), b.Backoff.Clock.Now())
return
} else if responseCode >= 300 || err != nil {
klog.V(4).Infof("Client is returning errors: code %v, error %v", responseCode, err)
}
//If we got this far, there is no backoff required for this URL anymore.
b.Backoff.Reset(b.baseUrlKey(actualUrl))
} | UpdateBackoff updates backoff metadata | UpdateBackoff | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/urlbackoff.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/urlbackoff.go | Apache-2.0 |
func (b *URLBackoff) CalculateBackoff(actualUrl *url.URL) time.Duration {
return b.Backoff.Get(b.baseUrlKey(actualUrl))
} | CalculateBackoff takes a url and back's off exponentially,
based on its knowledge of existing failures. | CalculateBackoff | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/urlbackoff.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/urlbackoff.go | Apache-2.0 |
func (r *RequestConstructionError) Error() string {
return fmt.Sprintf("request construction error: '%v'", r.Err)
} | Error returns a textual description of 'r'. | Error | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func NewRequest(c *RESTClient) *Request {
var backoff BackoffManager
if c.createBackoffMgr != nil {
backoff = c.createBackoffMgr()
}
if backoff == nil {
backoff = noBackoff
}
var pathPrefix string
if c.base != nil {
pathPrefix = path.Join("/", c.base.Path, c.versionedAPIPath)
} else {
pathPrefix = path.Join("/", c.versionedAPIPath)
}
var timeout time.Duration
if c.Client != nil {
timeout = c.Client.Timeout
}
r := &Request{
c: c,
rateLimiter: c.rateLimiter,
backoff: backoff,
timeout: timeout,
pathPrefix: pathPrefix,
maxRetries: 10,
retryFn: defaultRequestRetryFn,
warningHandler: c.warningHandler,
}
switch {
case len(c.content.AcceptContentTypes) > 0:
r.SetHeader("Accept", c.content.AcceptContentTypes)
case len(c.content.ContentType) > 0:
r.SetHeader("Accept", c.content.ContentType+", */*")
}
return r
} | NewRequest creates a new request helper object for accessing runtime.Objects on a server. | NewRequest | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func NewRequestWithClient(base *url.URL, versionedAPIPath string, content ClientContentConfig, client *http.Client) *Request {
return NewRequest(&RESTClient{
base: base,
versionedAPIPath: versionedAPIPath,
content: content,
Client: client,
})
} | NewRequestWithClient creates a Request with an embedded RESTClient for use in test scenarios. | NewRequestWithClient | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Verb(verb string) *Request {
r.verb = verb
return r
} | Verb sets the verb this request will use. | Verb | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Prefix(segments ...string) *Request {
if r.err != nil {
return r
}
r.pathPrefix = path.Join(r.pathPrefix, path.Join(segments...))
return r
} | Prefix adds segments to the relative beginning to the request path. These
items will be placed before the optional Namespace, Resource, or Name sections.
Setting AbsPath will clear any previously set Prefix segments | Prefix | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Suffix(segments ...string) *Request {
if r.err != nil {
return r
}
r.subpath = path.Join(r.subpath, path.Join(segments...))
return r
} | Suffix appends segments to the end of the path. These items will be placed after the prefix and optional
Namespace, Resource, or Name sections. | Suffix | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Resource(resource string) *Request {
if r.err != nil {
return r
}
if len(r.resource) != 0 {
r.err = fmt.Errorf("resource already set to %q, cannot change to %q", r.resource, resource)
return r
}
if msgs := IsValidPathSegmentName(resource); len(msgs) != 0 {
r.err = fmt.Errorf("invalid resource %q: %v", resource, msgs)
return r
}
r.resource = resource
return r
} | Resource sets the resource to access (<resource>/[ns/<namespace>/]<name>) | Resource | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) BackOff(manager BackoffManager) *Request {
if manager == nil {
r.backoff = &NoBackoff{}
return r
}
r.backoff = manager
return r
} | BackOff sets the request's backoff manager to the one specified,
or defaults to the stub implementation if nil is provided | BackOff | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) WarningHandler(handler WarningHandler) *Request {
r.warningHandler = handler
return r
} | WarningHandler sets the handler this client uses when warning headers are encountered.
If set to nil, this client will use the default warning handler (see SetDefaultWarningHandler). | WarningHandler | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Throttle(limiter flowcontrol.RateLimiter) *Request {
r.rateLimiter = limiter
return r
} | Throttle receives a rate-limiter and sets or replaces an existing request limiter | Throttle | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) SubResource(subresources ...string) *Request {
if r.err != nil {
return r
}
subresource := path.Join(subresources...)
if len(r.subresource) != 0 {
r.err = fmt.Errorf("subresource already set to %q, cannot change to %q", r.subresource, subresource)
return r
}
for _, s := range subresources {
if msgs := IsValidPathSegmentName(s); len(msgs) != 0 {
r.err = fmt.Errorf("invalid subresource %q: %v", s, msgs)
return r
}
}
r.subresource = subresource
return r
} | SubResource sets a sub-resource path which can be multiple segments after the resource
name but before the suffix. | SubResource | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Name(resourceName string) *Request {
if r.err != nil {
return r
}
if len(resourceName) == 0 {
r.err = fmt.Errorf("resource name may not be empty")
return r
}
if len(r.resourceName) != 0 {
r.err = fmt.Errorf("resource name already set to %q, cannot change to %q", r.resourceName, resourceName)
return r
}
if msgs := IsValidPathSegmentName(resourceName); len(msgs) != 0 {
r.err = fmt.Errorf("invalid resource name %q: %v", resourceName, msgs)
return r
}
r.resourceName = resourceName
return r
} | Name sets the name of a resource to access (<resource>/[ns/<namespace>/]<name>) | Name | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Namespace(namespace string) *Request {
if r.err != nil {
return r
}
if r.namespaceSet {
r.err = fmt.Errorf("namespace already set to %q, cannot change to %q", r.namespace, namespace)
return r
}
if msgs := IsValidPathSegmentName(namespace); len(msgs) != 0 {
r.err = fmt.Errorf("invalid namespace %q: %v", namespace, msgs)
return r
}
r.namespaceSet = true
r.namespace = namespace
return r
} | Namespace applies the namespace scope to a request (<resource>/[ns/<namespace>/]<name>) | Namespace | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) NamespaceIfScoped(namespace string, scoped bool) *Request {
if scoped {
return r.Namespace(namespace)
}
return r
} | NamespaceIfScoped is a convenience function to set a namespace if scoped is true | NamespaceIfScoped | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) AbsPath(segments ...string) *Request {
if r.err != nil {
return r
}
r.pathPrefix = path.Join(r.c.base.Path, path.Join(segments...))
if len(segments) == 1 && (len(r.c.base.Path) > 1 || len(segments[0]) > 1) && strings.HasSuffix(segments[0], "/") {
// preserve any trailing slashes for legacy behavior
r.pathPrefix += "/"
}
return r
} | AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved
when a single segment is passed. | AbsPath | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) RequestURI(uri string) *Request {
if r.err != nil {
return r
}
locator, err := url.Parse(uri)
if err != nil {
r.err = err
return r
}
r.pathPrefix = locator.Path
if len(locator.Query()) > 0 {
if r.params == nil {
r.params = make(url.Values)
}
for k, v := range locator.Query() {
r.params[k] = v
}
}
return r
} | RequestURI overwrites existing path and parameters with the value of the provided server relative
URI. | RequestURI | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Param(paramName, s string) *Request {
if r.err != nil {
return r
}
return r.setParam(paramName, s)
} | Param creates a query parameter with the given string value. | Param | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) VersionedParams(obj runtime.Object, codec runtime.ParameterCodec) *Request {
return r.SpecificallyVersionedParams(obj, codec, r.c.content.GroupVersion)
} | VersionedParams will take the provided object, serialize it to a map[string][]string using the
implicit RESTClient API version and the default parameter codec, and then add those as parameters
to the request. Use this to provide versioned query parameters from client libraries.
VersionedParams will not write query parameters that have omitempty set and are empty. If a
parameter has already been set it is appended to (Params and VersionedParams are additive). | VersionedParams | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Timeout(d time.Duration) *Request {
if r.err != nil {
return r
}
r.timeout = d
return r
} | Timeout makes the request use the given duration as an overall timeout for the
request. Additionally, if set passes the value as "timeout" parameter in URL. | Timeout | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) MaxRetries(maxRetries int) *Request {
if maxRetries < 0 {
maxRetries = 0
}
r.maxRetries = maxRetries
return r
} | MaxRetries makes the request use the given integer as a ceiling of retrying upon receiving
"Retry-After" headers and 429 status-code in the response. The default is 10 unless this
function is specifically called with a different value.
A zero maxRetries prevent it from doing retires and return an error immediately. | MaxRetries | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func (r *Request) Body(obj interface{}) *Request {
if r.err != nil {
return r
}
switch t := obj.(type) {
case string:
data, err := os.ReadFile(t)
if err != nil {
r.err = err
return r
}
glogBody("Request Body", data)
r.body = nil
r.bodyBytes = data
case []byte:
glogBody("Request Body", t)
r.body = nil
r.bodyBytes = t
case io.Reader:
r.body = t
r.bodyBytes = nil
case runtime.Object:
// callers may pass typed interface pointers, therefore we must check nil with reflection
if reflect.ValueOf(t).IsNil() {
return r
}
encoder, err := r.c.content.Negotiator.Encoder(r.c.content.ContentType, nil)
if err != nil {
r.err = err
return r
}
data, err := runtime.Encode(encoder, t)
if err != nil {
r.err = err
return r
}
glogBody("Request Body", data)
r.body = nil
r.bodyBytes = data
r.SetHeader("Content-Type", r.c.content.ContentType)
default:
r.err = fmt.Errorf("unknown type used for body: %+v", obj)
} | Body makes the request use obj as the body. Optional.
If obj is a string, try to read a file of that name.
If obj is a []byte, send it directly.
If obj is an io.Reader, use it directly.
If obj is a runtime.Object, marshal it correctly, and set Content-Type header.
If obj is a runtime.Object and nil, do nothing.
Otherwise, set an error. | Body | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func updateRequestResultMetric(ctx context.Context, req *Request, resp *http.Response, err error) {
code, host := sanitize(req, resp, err)
metrics.RequestResult.Increment(ctx, code, req.verb, host)
} | updateRequestResultMetric increments the RequestResult metric counter,
it should be called with the (response, err) tuple from the final
reply from the server. | updateRequestResultMetric | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func updateRequestRetryMetric(ctx context.Context, req *Request, resp *http.Response, err error) {
code, host := sanitize(req, resp, err)
metrics.RequestRetry.IncrementRetry(ctx, code, req.verb, host)
} | updateRequestRetryMetric increments the RequestRetry metric counter,
it should be called with the (response, err) tuple for each retry
except for the final attempt. | updateRequestRetryMetric | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func newDNSMetricsTrace(ctx context.Context) *httptrace.ClientTrace {
type dnsMetric struct {
start time.Time
host string
sync.Mutex
}
dns := &dnsMetric{}
return &httptrace.ClientTrace{
DNSStart: func(info httptrace.DNSStartInfo) {
dns.Lock()
defer dns.Unlock()
dns.start = time.Now()
dns.host = info.Host
},
DNSDone: func(info httptrace.DNSDoneInfo) {
dns.Lock()
defer dns.Unlock()
metrics.ResolverLatency.Observe(ctx, dns.host, time.Since(dns.start))
},
}
} | newDNSMetricsTrace returns an HTTP trace that tracks time spent on DNS lookups per host.
This metric is available in client as "rest_client_dns_resolution_duration_seconds". | newDNSMetricsTrace | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/request.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/request.go | Apache-2.0 |
func NewRESTClient(baseURL *url.URL, versionedAPIPath string, config ClientContentConfig, rateLimiter flowcontrol.RateLimiter, client *http.Client) (*RESTClient, error) {
if len(config.ContentType) == 0 {
config.ContentType = "application/json"
}
base := *baseURL
if !strings.HasSuffix(base.Path, "/") {
base.Path += "/"
}
base.RawQuery = ""
base.Fragment = ""
return &RESTClient{
base: &base,
versionedAPIPath: versionedAPIPath,
content: config,
createBackoffMgr: readExpBackoffConfig,
rateLimiter: rateLimiter,
Client: client,
}, nil
} | NewRESTClient creates a new RESTClient. This client performs generic REST functions
such as Get, Put, Post, and Delete on specified paths. | NewRESTClient | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) GetRateLimiter() flowcontrol.RateLimiter {
if c == nil {
return nil
}
return c.rateLimiter
} | GetRateLimiter returns rate limiter for a given client, or nil if it's called on a nil client | GetRateLimiter | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func readExpBackoffConfig() BackoffManager {
backoffBase := os.Getenv(envBackoffBase)
backoffDuration := os.Getenv(envBackoffDuration)
backoffBaseInt, errBase := strconv.ParseInt(backoffBase, 10, 64)
backoffDurationInt, errDuration := strconv.ParseInt(backoffDuration, 10, 64)
if errBase != nil || errDuration != nil {
return &NoBackoff{}
}
return &URLBackoff{
Backoff: flowcontrol.NewBackOff(
time.Duration(backoffBaseInt)*time.Second,
time.Duration(backoffDurationInt)*time.Second)}
} | readExpBackoffConfig handles the internal logic of determining what the
backoff policy is. By default if no information is available, NoBackoff.
TODO Generalize this see #17727 . | readExpBackoffConfig | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) Verb(verb string) *Request {
return NewRequest(c).Verb(verb)
} | Verb begins a request with a verb (GET, POST, PUT, DELETE).
Example usage of RESTClient's request building interface:
c, err := NewRESTClient(...)
if err != nil { ... }
resp, err := c.Verb("GET").
Path("pods").
SelectorParam("labels", "area=staging").
Timeout(10*time.Second).
Do()
if err != nil { ... }
list, ok := resp.(*api.PodList) | Verb | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) Post() *Request {
return c.Verb("POST")
} | Post begins a POST request. Short for c.Verb("POST"). | Post | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) Put() *Request {
return c.Verb("PUT")
} | Put begins a PUT request. Short for c.Verb("PUT"). | Put | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) Patch(pt types.PatchType) *Request {
return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
} | Patch begins a PATCH request. Short for c.Verb("Patch"). | Patch | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) Get() *Request {
return c.Verb("GET")
} | Get begins a GET request. Short for c.Verb("GET"). | Get | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) Delete() *Request {
return c.Verb("DELETE")
} | Delete begins a DELETE request. Short for c.Verb("DELETE"). | Delete | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func (c *RESTClient) APIVersion() schema.GroupVersion {
return c.content.GroupVersion
} | APIVersion returns the APIVersion this RESTClient is expected to use. | APIVersion | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/client.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/client.go | Apache-2.0 |
func HTTPClientFor(config *Config) (*http.Client, error) {
transport, err := TransportFor(config)
if err != nil {
return nil, err
}
var httpClient *http.Client
if transport != http.DefaultTransport || config.Timeout > 0 {
httpClient = &http.Client{
Transport: transport,
Timeout: config.Timeout,
}
} else {
httpClient = http.DefaultClient
}
return httpClient, nil
} | HTTPClientFor returns an http.Client that will provide the authentication
or transport level security defined by the provided Config. Will return the
default http.DefaultClient if no special case behavior is needed. | HTTPClientFor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/transport.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/transport.go | Apache-2.0 |
func TLSConfigFor(config *Config) (*tls.Config, error) {
cfg, err := config.TransportConfig()
if err != nil {
return nil, err
}
return transport.TLSConfigFor(cfg)
} | TLSConfigFor returns a tls.Config that will provide the transport level security defined
by the provided Config. Will return nil if no transport level security is requested. | TLSConfigFor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/transport.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/transport.go | Apache-2.0 |
func TransportFor(config *Config) (http.RoundTripper, error) {
cfg, err := config.TransportConfig()
if err != nil {
return nil, err
}
return transport.New(cfg)
} | TransportFor returns an http.RoundTripper that will provide the authentication
or transport level security defined by the provided Config. Will return the
default http.DefaultTransport if no special case behavior is needed. | TransportFor | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/client-go/rest/transport.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/client-go/rest/transport.go | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.