cms-20240330/Sources/AlibabacloudCms20240330/Client.swift (616 lines of code) (raw):

import Foundation import Tea import TeaUtils import AlibabacloudOpenApi import AlibabaCloudOpenApiUtil import AlibabacloudEndpointUtil open class Client : AlibabacloudOpenApi.Client { public override init(_ config: AlibabacloudOpenApi.Config) throws { try super.init(config) self._endpointRule = "" try checkConfig(config as! AlibabacloudOpenApi.Config) self._endpoint = try getEndpoint("cms", self._regionId ?? "", self._endpointRule ?? "", self._network ?? "", self._suffix ?? "", self._endpointMap ?? [:], self._endpoint ?? "") } public func getEndpoint(_ productId: String, _ regionId: String, _ endpointRule: String, _ network: String, _ suffix: String, _ endpointMap: [String: String], _ endpoint: String) throws -> String { if (!TeaUtils.Client.empty(endpoint)) { return endpoint as! String } if (!TeaUtils.Client.isUnset(endpointMap) && !TeaUtils.Client.empty(endpointMap[regionId as! String])) { return endpointMap[regionId as! String] ?? "" } return try AlibabacloudEndpointUtil.Client.getEndpointRules(productId, regionId, endpointRule, network, suffix) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func createEntityStoreWithOptions(_ workspaceName: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> CreateEntityStoreResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "CreateEntityStore", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspaceName)) + "/entitystore", "method": "POST", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(CreateEntityStoreResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func createEntityStore(_ workspaceName: String) async throws -> CreateEntityStoreResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await createEntityStoreWithOptions(workspaceName as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func createPrometheusInstanceWithOptions(_ request: CreatePrometheusInstanceRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> CreatePrometheusInstanceResponse { try TeaUtils.Client.validateModel(request) var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.archiveDuration)) { body["archiveDuration"] = request.archiveDuration!; } if (!TeaUtils.Client.isUnset(request.authFreeReadPolicy)) { body["authFreeReadPolicy"] = request.authFreeReadPolicy ?? ""; } if (!TeaUtils.Client.isUnset(request.authFreeWritePolicy)) { body["authFreeWritePolicy"] = request.authFreeWritePolicy ?? ""; } if (!TeaUtils.Client.isUnset(request.enableAuthFreeRead)) { body["enableAuthFreeRead"] = request.enableAuthFreeRead!; } if (!TeaUtils.Client.isUnset(request.enableAuthFreeWrite)) { body["enableAuthFreeWrite"] = request.enableAuthFreeWrite!; } if (!TeaUtils.Client.isUnset(request.enableAuthToken)) { body["enableAuthToken"] = request.enableAuthToken!; } if (!TeaUtils.Client.isUnset(request.paymentType)) { body["paymentType"] = request.paymentType ?? ""; } if (!TeaUtils.Client.isUnset(request.prometheusInstanceName)) { body["prometheusInstanceName"] = request.prometheusInstanceName ?? ""; } if (!TeaUtils.Client.isUnset(request.status)) { body["status"] = request.status ?? ""; } if (!TeaUtils.Client.isUnset(request.storageDuration)) { body["storageDuration"] = request.storageDuration!; } if (!TeaUtils.Client.isUnset(request.tags)) { body["tags"] = request.tags ?? []; } if (!TeaUtils.Client.isUnset(request.workspace)) { body["workspace"] = request.workspace ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "CreatePrometheusInstance", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/prometheus-instances", "method": "POST", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(CreatePrometheusInstanceResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func createPrometheusInstance(_ request: CreatePrometheusInstanceRequest) async throws -> CreatePrometheusInstanceResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await createPrometheusInstanceWithOptions(request as! CreatePrometheusInstanceRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func createUmodelWithOptions(_ workspace: String, _ request: CreateUmodelRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> CreateUmodelResponse { try TeaUtils.Client.validateModel(request) var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.commonSchemaRef)) { body["commonSchemaRef"] = request.commonSchemaRef ?? []; } if (!TeaUtils.Client.isUnset(request.description_)) { body["description"] = request.description_ ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "CreateUmodel", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel", "method": "POST", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(CreateUmodelResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func createUmodel(_ workspace: String, _ request: CreateUmodelRequest) async throws -> CreateUmodelResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await createUmodelWithOptions(workspace as! String, request as! CreateUmodelRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteEntityStoreWithOptions(_ workspaceName: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> DeleteEntityStoreResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "DeleteEntityStore", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspaceName)) + "/entitystore", "method": "DELETE", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(DeleteEntityStoreResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteEntityStore(_ workspaceName: String) async throws -> DeleteEntityStoreResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await deleteEntityStoreWithOptions(workspaceName as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteUmodelWithOptions(_ workspace: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> DeleteUmodelResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "DeleteUmodel", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel", "method": "DELETE", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(DeleteUmodelResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteUmodel(_ workspace: String) async throws -> DeleteUmodelResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await deleteUmodelWithOptions(workspace as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteUmodelDataWithOptions(_ workspace: String, _ request: DeleteUmodelDataRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> DeleteUmodelDataResponse { try TeaUtils.Client.validateModel(request) var query: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.domain)) { query["domain"] = request.domain ?? ""; } if (!TeaUtils.Client.isUnset(request.kind)) { query["kind"] = request.kind ?? ""; } if (!TeaUtils.Client.isUnset(request.name)) { query["name"] = request.name ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "query": AlibabaCloudOpenApiUtil.Client.query(query) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "DeleteUmodelData", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel/data", "method": "DELETE", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(DeleteUmodelDataResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteUmodelData(_ workspace: String, _ request: DeleteUmodelDataRequest) async throws -> DeleteUmodelDataResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await deleteUmodelDataWithOptions(workspace as! String, request as! DeleteUmodelDataRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteWorkspaceWithOptions(_ workspaceName: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> DeleteWorkspaceResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "DeleteWorkspace", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspaceName)), "method": "DELETE", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(DeleteWorkspaceResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func deleteWorkspace(_ workspaceName: String) async throws -> DeleteWorkspaceResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await deleteWorkspaceWithOptions(workspaceName as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getEntityStoreWithOptions(_ workspaceName: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> GetEntityStoreResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "GetEntityStore", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspaceName)) + "/entitystore", "method": "GET", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(GetEntityStoreResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getEntityStore(_ workspaceName: String) async throws -> GetEntityStoreResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await getEntityStoreWithOptions(workspaceName as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getEntityStoreDataWithOptions(_ workspace: String, _ request: GetEntityStoreDataRequest, _ headers: GetEntityStoreDataHeaders, _ runtime: TeaUtils.RuntimeOptions) async throws -> GetEntityStoreDataResponse { try TeaUtils.Client.validateModel(request) var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.from)) { body["from"] = request.from!; } if (!TeaUtils.Client.isUnset(request.query)) { body["query"] = request.query ?? ""; } if (!TeaUtils.Client.isUnset(request.to)) { body["to"] = request.to!; } var realHeaders: [String: String] = [:] if (!TeaUtils.Client.isUnset(headers.commonHeaders)) { realHeaders = headers.commonHeaders ?? [:] } if (!TeaUtils.Client.isUnset(headers.acceptEncoding)) { realHeaders["acceptEncoding"] = TeaUtils.Client.toJSONString(headers.acceptEncoding); } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": realHeaders as! [String: String], "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "GetEntityStoreData", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/entitiesAndRelations", "method": "POST", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(GetEntityStoreDataResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getEntityStoreData(_ workspace: String, _ request: GetEntityStoreDataRequest) async throws -> GetEntityStoreDataResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: GetEntityStoreDataHeaders = GetEntityStoreDataHeaders([:]) return try await getEntityStoreDataWithOptions(workspace as! String, request as! GetEntityStoreDataRequest, headers as! GetEntityStoreDataHeaders, runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getUmodelWithOptions(_ workspace: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> GetUmodelResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "GetUmodel", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel", "method": "GET", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(GetUmodelResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getUmodel(_ workspace: String) async throws -> GetUmodelResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await getUmodelWithOptions(workspace as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getUmodelDataWithOptions(_ workspace: String, _ request: GetUmodelDataRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> GetUmodelDataResponse { try TeaUtils.Client.validateModel(request) var query: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.method)) { query["method"] = request.method ?? ""; } var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.content)) { body["content"] = request.content!; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "query": AlibabaCloudOpenApiUtil.Client.query(query), "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "GetUmodelData", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel/graph", "method": "POST", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(GetUmodelDataResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getUmodelData(_ workspace: String, _ request: GetUmodelDataRequest) async throws -> GetUmodelDataResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await getUmodelDataWithOptions(workspace as! String, request as! GetUmodelDataRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getWorkspaceWithOptions(_ workspaceName: String, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> GetWorkspaceResponse { var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String] ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "GetWorkspace", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspaceName)), "method": "GET", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(GetWorkspaceResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func getWorkspace(_ workspaceName: String) async throws -> GetWorkspaceResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await getWorkspaceWithOptions(workspaceName as! String, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func listAlertActionsWithOptions(_ tmpReq: ListAlertActionsRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> ListAlertActionsResponse { try TeaUtils.Client.validateModel(tmpReq) var request: ListAlertActionsShrinkRequest = ListAlertActionsShrinkRequest([:]) AlibabaCloudOpenApiUtil.Client.convert(tmpReq, request) if (!TeaUtils.Client.isUnset(tmpReq.alertActionIds)) { request.alertActionIdsShrink = AlibabaCloudOpenApiUtil.Client.arrayToStringWithSpecifiedStyle(tmpReq.alertActionIds, "alertActionIds", "json") } var query: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.alertActionIdsShrink)) { query["alertActionIds"] = request.alertActionIdsShrink ?? ""; } if (!TeaUtils.Client.isUnset(request.alertActionName)) { query["alertActionName"] = request.alertActionName ?? ""; } if (!TeaUtils.Client.isUnset(request.pageNumber)) { query["pageNumber"] = request.pageNumber!; } if (!TeaUtils.Client.isUnset(request.pageSize)) { query["pageSize"] = request.pageSize!; } if (!TeaUtils.Client.isUnset(request.type)) { query["type"] = request.type ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "query": AlibabaCloudOpenApiUtil.Client.query(query) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "ListAlertActions", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/alertActions", "method": "GET", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(ListAlertActionsResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func listAlertActions(_ request: ListAlertActionsRequest) async throws -> ListAlertActionsResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await listAlertActionsWithOptions(request as! ListAlertActionsRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func listWorkspacesWithOptions(_ tmpReq: ListWorkspacesRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> ListWorkspacesResponse { try TeaUtils.Client.validateModel(tmpReq) var request: ListWorkspacesShrinkRequest = ListWorkspacesShrinkRequest([:]) AlibabaCloudOpenApiUtil.Client.convert(tmpReq, request) if (!TeaUtils.Client.isUnset(tmpReq.workspaceNameList)) { request.workspaceNameListShrink = AlibabaCloudOpenApiUtil.Client.arrayToStringWithSpecifiedStyle(tmpReq.workspaceNameList, "workspaceNameList", "simple") } var query: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.maxResults)) { query["maxResults"] = request.maxResults!; } if (!TeaUtils.Client.isUnset(request.nextToken)) { query["nextToken"] = request.nextToken ?? ""; } if (!TeaUtils.Client.isUnset(request.region)) { query["region"] = request.region ?? ""; } if (!TeaUtils.Client.isUnset(request.workspaceName)) { query["workspaceName"] = request.workspaceName ?? ""; } if (!TeaUtils.Client.isUnset(request.workspaceNameListShrink)) { query["workspaceNameList"] = request.workspaceNameListShrink ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "query": AlibabaCloudOpenApiUtil.Client.query(query) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "ListWorkspaces", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace", "method": "GET", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(ListWorkspacesResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func listWorkspaces(_ request: ListWorkspacesRequest) async throws -> ListWorkspacesResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await listWorkspacesWithOptions(request as! ListWorkspacesRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func putWorkspaceWithOptions(_ workspaceName: String, _ request: PutWorkspaceRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> PutWorkspaceResponse { try TeaUtils.Client.validateModel(request) var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.description_)) { body["description"] = request.description_ ?? ""; } if (!TeaUtils.Client.isUnset(request.displayName)) { body["displayName"] = request.displayName ?? ""; } if (!TeaUtils.Client.isUnset(request.slsProject)) { body["slsProject"] = request.slsProject ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "PutWorkspace", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspaceName)), "method": "POST", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(PutWorkspaceResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func putWorkspace(_ workspaceName: String, _ request: PutWorkspaceRequest) async throws -> PutWorkspaceResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await putWorkspaceWithOptions(workspaceName as! String, request as! PutWorkspaceRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func updateUmodelWithOptions(_ workspace: String, _ request: UpdateUmodelRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> UpdateUmodelResponse { try TeaUtils.Client.validateModel(request) var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.commonSchemaRef)) { body["commonSchemaRef"] = request.commonSchemaRef ?? []; } if (!TeaUtils.Client.isUnset(request.description_)) { body["description"] = request.description_ ?? ""; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "UpdateUmodel", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel", "method": "PUT", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(UpdateUmodelResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func updateUmodel(_ workspace: String, _ request: UpdateUmodelRequest) async throws -> UpdateUmodelResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await updateUmodelWithOptions(workspace as! String, request as! UpdateUmodelRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func upsertUmodelDataWithOptions(_ workspace: String, _ request: UpsertUmodelDataRequest, _ headers: [String: String], _ runtime: TeaUtils.RuntimeOptions) async throws -> UpsertUmodelDataResponse { try TeaUtils.Client.validateModel(request) var query: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.method)) { query["method"] = request.method ?? ""; } var body: [String: Any] = [:] if (!TeaUtils.Client.isUnset(request.elements)) { body["elements"] = request.elements ?? []; } var req: AlibabacloudOpenApi.OpenApiRequest = AlibabacloudOpenApi.OpenApiRequest([ "headers": headers as! [String: String], "query": AlibabaCloudOpenApiUtil.Client.query(query), "body": AlibabaCloudOpenApiUtil.Client.parseToMap(body) ]) var params: AlibabacloudOpenApi.Params = AlibabacloudOpenApi.Params([ "action": "UpsertUmodelData", "version": "2024-03-30", "protocol": "HTTPS", "pathname": "/workspace/" + (AlibabaCloudOpenApiUtil.Client.getEncodeParam(workspace)) + "/umodel/data", "method": "PATCH", "authType": "AK", "style": "ROA", "reqBodyType": "json", "bodyType": "json" ]) var tmp: [String: Any] = try await callApi(params as! AlibabacloudOpenApi.Params, req as! AlibabacloudOpenApi.OpenApiRequest, runtime as! TeaUtils.RuntimeOptions) return Tea.TeaConverter.fromMap(UpsertUmodelDataResponse(), tmp) } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public func upsertUmodelData(_ workspace: String, _ request: UpsertUmodelDataRequest) async throws -> UpsertUmodelDataResponse { var runtime: TeaUtils.RuntimeOptions = TeaUtils.RuntimeOptions([:]) var headers: [String: String] = [:] return try await upsertUmodelDataWithOptions(workspace as! String, request as! UpsertUmodelDataRequest, headers as! [String: String], runtime as! TeaUtils.RuntimeOptions) } }