diff --git a/.swiftformat b/.swiftformat index 6af8867..88fec96 100644 --- a/.swiftformat +++ b/.swiftformat @@ -62,5 +62,5 @@ --wrapreturntype preserve --xcodeindentation disabled --yodaswap always ---disable anyObjectProtocol,blankLinesAtStartOfScope,emptyBraces,initCoderUnavailable,modifierOrder,redundanttype,spaceAroundBrackets,spaceAroundGenerics,spaceAroundParens,strongOutlets,strongifiedSelf,typeSugar,wrapAttributes,yodaConditions +--disable anyObjectProtocol,blankLinesAtStartOfScope,emptyBraces,initCoderUnavailable,modifierOrder,redundantInternal,redundanttype,spaceAroundBrackets,spaceAroundGenerics,spaceAroundParens,strongOutlets,strongifiedSelf,typeSugar,wrapAttributes,yodaConditions --enable markTypes diff --git a/Package.swift b/Package.swift index 05d4506..a3d1a84 100644 --- a/Package.swift +++ b/Package.swift @@ -15,11 +15,11 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/swiftkube/model.git", .upToNextMinor(from: "0.11.0")), + .package(url: "https://github.com/swiftkube/model.git", .upToNextMinor(from: "0.12.0")), .package(url: "https://github.com/swift-server/async-http-client.git", .upToNextMajor(from: "1.18.0")), - .package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.5.2")), - .package(url: "https://github.com/apple/swift-metrics.git", .upToNextMajor(from: "2.4.0")), - .package(url: "https://github.com/jpsim/Yams.git", .upToNextMajor(from: "5.0.5")), + .package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.5.3")), + .package(url: "https://github.com/apple/swift-metrics.git", .upToNextMajor(from: "2.4.1")), + .package(url: "https://github.com/jpsim/Yams.git", .upToNextMajor(from: "5.0.6")), .package(url: "https://github.com/apple/swift-nio", .upToNextMajor(from: "2.54.0")), ], targets: [ diff --git a/Sources/SwiftkubeClient/API Groups/KubernetesClient+admissionregistration.v1beta1.swift b/Sources/SwiftkubeClient/API Groups/KubernetesClient+admissionregistration.v1beta1.swift new file mode 100644 index 0000000..bed0232 --- /dev/null +++ b/Sources/SwiftkubeClient/API Groups/KubernetesClient+admissionregistration.v1beta1.swift @@ -0,0 +1,50 @@ +// +// Copyright 2020 Swiftkube Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation +import SwiftkubeModel + +// MARK: - AdmissionRegistrationV1Beta1API + +public protocol AdmissionRegistrationV1Beta1API { + + var validatingAdmissionPolicies: ClusterScopedGenericKubernetesClient { get } + var validatingAdmissionPolicyBindings: ClusterScopedGenericKubernetesClient { get } +} + +/// DSL for `admissionregistration.k8s.io.v1beta1` API Group +public extension KubernetesClient { + + class AdmissionRegistrationV1Beta1: AdmissionRegistrationV1Beta1API { + private var client: KubernetesClient + + internal init(_ client: KubernetesClient) { + self.client = client + } + + public var validatingAdmissionPolicies: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: admissionregistration.v1beta1.ValidatingAdmissionPolicy.self) + } + + public var validatingAdmissionPolicyBindings: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: admissionregistration.v1beta1.ValidatingAdmissionPolicyBinding.self) + } + } + + var admissionRegistrationV1Beta1: AdmissionRegistrationV1Beta1API { + AdmissionRegistrationV1Beta1(self) + } +} diff --git a/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1.swift b/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1.swift index 148b3f2..1a77692 100644 --- a/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1.swift +++ b/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1.swift @@ -21,6 +21,7 @@ import SwiftkubeModel public protocol AuthenticationV1API { + var selfSubjectReviews: ClusterScopedGenericKubernetesClient { get } var tokenRequests: NamespacedGenericKubernetesClient { get } var tokenReviews: ClusterScopedGenericKubernetesClient { get } } @@ -35,6 +36,10 @@ public extension KubernetesClient { self.client = client } + public var selfSubjectReviews: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: authentication.v1.SelfSubjectReview.self) + } + public var tokenRequests: NamespacedGenericKubernetesClient { client.namespaceScoped(for: authentication.v1.TokenRequest.self) } diff --git a/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1beta1.swift b/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1beta1.swift new file mode 100644 index 0000000..498933e --- /dev/null +++ b/Sources/SwiftkubeClient/API Groups/KubernetesClient+authentication.v1beta1.swift @@ -0,0 +1,45 @@ +// +// Copyright 2020 Swiftkube Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation +import SwiftkubeModel + +// MARK: - AuthenticationV1Beta1API + +public protocol AuthenticationV1Beta1API { + + var selfSubjectReviews: ClusterScopedGenericKubernetesClient { get } +} + +/// DSL for `authentication.k8s.io.v1beta1` API Group +public extension KubernetesClient { + + class AuthenticationV1Beta1: AuthenticationV1Beta1API { + private var client: KubernetesClient + + internal init(_ client: KubernetesClient) { + self.client = client + } + + public var selfSubjectReviews: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: authentication.v1beta1.SelfSubjectReview.self) + } + } + + var authenticationV1Beta1: AuthenticationV1Beta1API { + AuthenticationV1Beta1(self) + } +} diff --git a/Sources/SwiftkubeClient/API Groups/KubernetesClient+storage.v1beta1.swift b/Sources/SwiftkubeClient/API Groups/KubernetesClient+certificates.v1alpha1.swift similarity index 58% rename from Sources/SwiftkubeClient/API Groups/KubernetesClient+storage.v1beta1.swift rename to Sources/SwiftkubeClient/API Groups/KubernetesClient+certificates.v1alpha1.swift index f9d1d8f..d140e08 100644 --- a/Sources/SwiftkubeClient/API Groups/KubernetesClient+storage.v1beta1.swift +++ b/Sources/SwiftkubeClient/API Groups/KubernetesClient+certificates.v1alpha1.swift @@ -17,29 +17,29 @@ import Foundation import SwiftkubeModel -// MARK: - StorageV1Beta1API +// MARK: - CertificatesV1Alpha1API -public protocol StorageV1Beta1API { +public protocol CertificatesV1Alpha1API { - var csiStorageCapacities: NamespacedGenericKubernetesClient { get } + var clusterTrusubundles: ClusterScopedGenericKubernetesClient { get } } -/// DSL for `storage.k8s.io.v1beta1` API Group +/// DSL for `certificates.k8s.io.v1alpha1` API Group public extension KubernetesClient { - class StorageV1Beta1: StorageV1Beta1API { + class CertificatesV1Alpha1: CertificatesV1Alpha1API { private var client: KubernetesClient internal init(_ client: KubernetesClient) { self.client = client } - public var csiStorageCapacities: NamespacedGenericKubernetesClient { - client.namespaceScoped(for: storage.v1beta1.CSIStorageCapacity.self) + public var clusterTrusubundles: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: certificates.v1alpha1.ClusterTrustBundle.self) } } - var storageV1Beta1: StorageV1Beta1API { - StorageV1Beta1(self) + var certificatesV1Alpha1: CertificatesV1Alpha1API { + CertificatesV1Alpha1(self) } } diff --git a/Sources/SwiftkubeClient/API Groups/KubernetesClient+networking.v1alpha1.swift b/Sources/SwiftkubeClient/API Groups/KubernetesClient+networking.v1alpha1.swift index 26cd53e..affc68d 100644 --- a/Sources/SwiftkubeClient/API Groups/KubernetesClient+networking.v1alpha1.swift +++ b/Sources/SwiftkubeClient/API Groups/KubernetesClient+networking.v1alpha1.swift @@ -22,6 +22,7 @@ import SwiftkubeModel public protocol NetworkingV1Alpha1API { var clusterCIDRs: ClusterScopedGenericKubernetesClient { get } + var iPAddresses: ClusterScopedGenericKubernetesClient { get } } /// DSL for `networking.k8s.io.v1alpha1` API Group @@ -37,6 +38,10 @@ public extension KubernetesClient { public var clusterCIDRs: ClusterScopedGenericKubernetesClient { client.clusterScoped(for: networking.v1alpha1.ClusterCIDR.self) } + + public var iPAddresses: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: networking.v1alpha1.IPAddress.self) + } } var networkingV1Alpha1: NetworkingV1Alpha1API { diff --git a/Sources/SwiftkubeClient/API Groups/KubernetesClient+resource.v1alpha1.swift b/Sources/SwiftkubeClient/API Groups/KubernetesClient+resource.v1alpha2.swift similarity index 56% rename from Sources/SwiftkubeClient/API Groups/KubernetesClient+resource.v1alpha1.swift rename to Sources/SwiftkubeClient/API Groups/KubernetesClient+resource.v1alpha2.swift index 6d2a427..20670ab 100644 --- a/Sources/SwiftkubeClient/API Groups/KubernetesClient+resource.v1alpha1.swift +++ b/Sources/SwiftkubeClient/API Groups/KubernetesClient+resource.v1alpha2.swift @@ -17,44 +17,44 @@ import Foundation import SwiftkubeModel -// MARK: - ResourceV1Alpha1API +// MARK: - ResourceV1Alpha2API -public protocol ResourceV1Alpha1API { +public protocol ResourceV1Alpha2API { - var podSchedulings: NamespacedGenericKubernetesClient { get } - var resourceClaims: NamespacedGenericKubernetesClient { get } - var resourceClaimTemplates: NamespacedGenericKubernetesClient { get } - var resourceClasses: ClusterScopedGenericKubernetesClient { get } + var podSchedulingContexts: NamespacedGenericKubernetesClient { get } + var resourceClaims: NamespacedGenericKubernetesClient { get } + var resourceClaimTemplates: NamespacedGenericKubernetesClient { get } + var resourceClasses: ClusterScopedGenericKubernetesClient { get } } -/// DSL for `resource.k8s.io.v1alpha1` API Group +/// DSL for `resource.k8s.io.v1alpha2` API Group public extension KubernetesClient { - class ResourceV1Alpha1: ResourceV1Alpha1API { + class ResourceV1Alpha2: ResourceV1Alpha2API { private var client: KubernetesClient internal init(_ client: KubernetesClient) { self.client = client } - public var podSchedulings: NamespacedGenericKubernetesClient { - client.namespaceScoped(for: resource.v1alpha1.PodScheduling.self) + public var podSchedulingContexts: NamespacedGenericKubernetesClient { + client.namespaceScoped(for: resource.v1alpha2.PodSchedulingContext.self) } - public var resourceClaims: NamespacedGenericKubernetesClient { - client.namespaceScoped(for: resource.v1alpha1.ResourceClaim.self) + public var resourceClaims: NamespacedGenericKubernetesClient { + client.namespaceScoped(for: resource.v1alpha2.ResourceClaim.self) } - public var resourceClaimTemplates: NamespacedGenericKubernetesClient { - client.namespaceScoped(for: resource.v1alpha1.ResourceClaimTemplate.self) + public var resourceClaimTemplates: NamespacedGenericKubernetesClient { + client.namespaceScoped(for: resource.v1alpha2.ResourceClaimTemplate.self) } - public var resourceClasses: ClusterScopedGenericKubernetesClient { - client.clusterScoped(for: resource.v1alpha1.ResourceClass.self) + public var resourceClasses: ClusterScopedGenericKubernetesClient { + client.clusterScoped(for: resource.v1alpha2.ResourceClass.self) } } - var resourceV1Alpha1: ResourceV1Alpha1API { - ResourceV1Alpha1(self) + var resourceV1Alpha2: ResourceV1Alpha2API { + ResourceV1Alpha2(self) } }