Skip to content

Commit

Permalink
Merge pull request #66 from amzn/move_code_from_smoke_aws_generate
Browse files Browse the repository at this point in the history
Move code from smoke-aws-generate.
  • Loading branch information
tachyonics authored Oct 3, 2022
2 parents 7e1f1af + 816056c commit 19a9564
Show file tree
Hide file tree
Showing 3 changed files with 434 additions and 0 deletions.
70 changes: 70 additions & 0 deletions Sources/ServiceModelCodeGeneration/InitializerType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// InitializerType.swift
// ServiceModelCodeGeneration
//

import Foundation

public struct InvocationTraceContextDeclaration {
public let name: String
public let importPackage: String?

public init(name: String, importPackage: String? = nil) {
self.name = name
self.importPackage = importPackage
}
}

public enum InitializerType {
case standard
case forGenerator
case copyInitializer
case genericTraceContextType
case usesDefaultReportingType(defaultInvocationTraceContext: InvocationTraceContextDeclaration)
case traceContextTypeFromConfig(configurationObjectName: String)
case traceContextTypeFromOperationsClient(operationsClientName: String)

public var isCopyInitializer: Bool {
if case .copyInitializer = self {
return true
}

return false
}

public var isGenerator: Bool {
if case .forGenerator = self {
return true
}

return false
}

public var isDefaultReportingType: Bool {
if case .usesDefaultReportingType = self {
return true
}

return false
}

public var isStandard: Bool {
if case .standard = self {
return true
}

return false
}
}
50 changes: 50 additions & 0 deletions Sources/ServiceModelCodeGeneration/ModelLocation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// ModelLocation.swift
// ServiceModelCodeGeneration
//

public enum VersionRequirementType: String, Codable {
case from
case branch
case path
}

public struct ModelPackageDependency {
public let versionRequirementType: VersionRequirementType
public let versionRequirement: String?
public let packageLocation: String

public init (versionRequirementType: VersionRequirementType,
versionRequirement: String?,
packageLocation: String) {
self.versionRequirementType = versionRequirementType
self.versionRequirement = versionRequirement
self.packageLocation = packageLocation
}
}

public struct ModelLocation: Codable {
public let modelProductDependency: String?
public let modelTargetDependency: String?
public let modelFilePath: String

public init (modelFilePath: String,
modelProductDependency: String?,
modelTargetDependency: String?) {
self.modelFilePath = modelFilePath
self.modelProductDependency = modelProductDependency
self.modelTargetDependency = modelTargetDependency
}
}
Loading

0 comments on commit 19a9564

Please sign in to comment.