-
Notifications
You must be signed in to change notification settings - Fork 40
/
interface.go
62 lines (50 loc) · 2.45 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package discovery
import "github.com/hashicorp/pandora/tools/sdk/config/definitions"
type ServiceInput struct {
// ServiceName is the name of the Service (e.g. `Compute`).
ServiceName string
// ApiVersion is the version of the API (e.g. `2020-10-01`).
ApiVersion string
// OutputDirectoryJson is the directory where the generated JSON files should be output.
OutputDirectoryJson string
// ResourceProvider is the ResourceProvider associated with this Service (for example `Microsoft.Compute`)
// parsed from the Resource ID.
ResourceProvider *string
// ResourceProviderToFilterTo allows filtering the operations for the given Service/API Version to only
// operations contained within this Resource Provider. Whilst the majority of the time this can be left
// unset, some Services such as Network include operations from different Resource Providers which can
// cause issues - as such this field can be conditionally set to remove unrelated operations.
ResourceProviderToFilterTo *string
// SwaggerDirectory is the path to the directory containing the Swagger/OpenAPI files for this Service/API Version.
SwaggerDirectory string
// SwaggerFiles is a list of the Swagger/OpenAPI files for this Service/API Version.
SwaggerFiles []string
// TerraformServiceDefinition defines the Terraform related details for this Service, used for Terraform
// related processing/generation.
TerraformServiceDefinition *definitions.ServiceDefinition
}
// ResourceManagerServiceInput provides a Resource Manager specific wrapper around a ServiceInput
type ResourceManagerServiceInput struct {
ServiceName string
ApiVersion string
OutputDirectoryJson string
ResourceProvider *string
ResourceProviderToFilterTo *string
SwaggerDirectory string
SwaggerFiles []string
TerraformServiceDefinition *definitions.ServiceDefinition
}
func (rmi ResourceManagerServiceInput) ToRunInput() ServiceInput {
return ServiceInput{
ServiceName: rmi.ServiceName,
ApiVersion: rmi.ApiVersion,
ResourceProvider: rmi.ResourceProvider,
ResourceProviderToFilterTo: rmi.ResourceProviderToFilterTo,
OutputDirectoryJson: rmi.OutputDirectoryJson,
SwaggerDirectory: rmi.SwaggerDirectory,
SwaggerFiles: rmi.SwaggerFiles,
TerraformServiceDefinition: rmi.TerraformServiceDefinition,
}
}