-
Notifications
You must be signed in to change notification settings - Fork 2
/
getTeam.go
169 lines (150 loc) · 6.29 KB
/
getTeam.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package pagerduty
import (
"context"
"reflect"
"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to get information about a specific [team](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODIyMw-list-teams) that you can use for other PagerDuty resources.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// me, err := pagerduty.LookupUser(ctx, &pagerduty.LookupUserArgs{
// Email: "me@example.com",
// }, nil)
// if err != nil {
// return err
// }
// devops, err := pagerduty.LookupTeam(ctx, &pagerduty.LookupTeamArgs{
// Name: "devops",
// }, nil)
// if err != nil {
// return err
// }
// _, err = pagerduty.NewEscalationPolicy(ctx, "foo", &pagerduty.EscalationPolicyArgs{
// Name: pulumi.String("DevOps Escalation Policy"),
// NumLoops: pulumi.Int(2),
// Teams: pulumi.String(devops.Id),
// Rules: pagerduty.EscalationPolicyRuleArray{
// &pagerduty.EscalationPolicyRuleArgs{
// EscalationDelayInMinutes: pulumi.Int(10),
// Targets: pagerduty.EscalationPolicyRuleTargetArray{
// &pagerduty.EscalationPolicyRuleTargetArgs{
// Type: pulumi.String("user"),
// Id: pulumi.String(me.Id),
// },
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func LookupTeam(ctx *pulumi.Context, args *LookupTeamArgs, opts ...pulumi.InvokeOption) (*LookupTeamResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupTeamResult
err := ctx.Invoke("pagerduty:index/getTeam:getTeam", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getTeam.
type LookupTeamArgs struct {
// (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
DefaultRole *string `pulumi:"defaultRole"`
// The name of the team to find in the PagerDuty API.
Name string `pulumi:"name"`
// ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
Parent *string `pulumi:"parent"`
}
// A collection of values returned by getTeam.
type LookupTeamResult struct {
// (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
DefaultRole *string `pulumi:"defaultRole"`
// A description of the found team.
Description string `pulumi:"description"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The name of the found team.
Name string `pulumi:"name"`
// ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
Parent *string `pulumi:"parent"`
}
func LookupTeamOutput(ctx *pulumi.Context, args LookupTeamOutputArgs, opts ...pulumi.InvokeOption) LookupTeamResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupTeamResult, error) {
args := v.(LookupTeamArgs)
r, err := LookupTeam(ctx, &args, opts...)
var s LookupTeamResult
if r != nil {
s = *r
}
return s, err
}).(LookupTeamResultOutput)
}
// A collection of arguments for invoking getTeam.
type LookupTeamOutputArgs struct {
// (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
DefaultRole pulumi.StringPtrInput `pulumi:"defaultRole"`
// The name of the team to find in the PagerDuty API.
Name pulumi.StringInput `pulumi:"name"`
// ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
Parent pulumi.StringPtrInput `pulumi:"parent"`
}
func (LookupTeamOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupTeamArgs)(nil)).Elem()
}
// A collection of values returned by getTeam.
type LookupTeamResultOutput struct{ *pulumi.OutputState }
func (LookupTeamResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupTeamResult)(nil)).Elem()
}
func (o LookupTeamResultOutput) ToLookupTeamResultOutput() LookupTeamResultOutput {
return o
}
func (o LookupTeamResultOutput) ToLookupTeamResultOutputWithContext(ctx context.Context) LookupTeamResultOutput {
return o
}
// (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
func (o LookupTeamResultOutput) DefaultRole() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupTeamResult) *string { return v.DefaultRole }).(pulumi.StringPtrOutput)
}
// A description of the found team.
func (o LookupTeamResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupTeamResult) string { return v.Description }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupTeamResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupTeamResult) string { return v.Id }).(pulumi.StringOutput)
}
// The name of the found team.
func (o LookupTeamResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupTeamResult) string { return v.Name }).(pulumi.StringOutput)
}
// ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
func (o LookupTeamResultOutput) Parent() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupTeamResult) *string { return v.Parent }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(LookupTeamResultOutput{})
}