blob: 60b8c9f1cfc229ea29aa69ecafacdefe8e6a146b [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* License); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT 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 GRPC
public struct ExpansionClient {
let client: Org_Apache_Beam_Model_Expansion_V1_ExpansionServiceAsyncClient
public init(endpoint: ApiServiceDescriptor) throws {
client = try Org_Apache_Beam_Model_Expansion_V1_ExpansionServiceAsyncClient(channel: GRPCChannelPool.with(endpoint: endpoint, eventLoopGroup: PlatformSupport.makeEventLoopGroup(loopCount: 1)))
}
public func transforms() async throws -> [String: ([String], [String], Schema)] {
let call = try await client.makeDiscoverSchemaTransformCall(.with { _ in }).response
var transforms: [String: ([String], [String], Schema)] = [:]
for (k, v) in call.schemaTransformConfigs {
transforms[k] = (v.inputPcollectionNames, v.outputPcollectionNames, .from(v.configSchema))
}
return transforms
}
}