email.go raw
1 /**
2 * Copyright 2016-2024 IBM Corp.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
8 * on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 * See the License for the specific language governing permissions and limitations under the License.
10 */
11
12 // AUTOMATICALLY GENERATED CODE - DO NOT MODIFY
13
14 package services
15
16 import (
17 "fmt"
18 "strings"
19
20 "github.com/softlayer/softlayer-go/datatypes"
21 "github.com/softlayer/softlayer-go/session"
22 "github.com/softlayer/softlayer-go/sl"
23 )
24
25 // no documentation yet
26 type Email_Subscription struct {
27 Session session.SLSession
28 Options sl.Options
29 }
30
31 // GetEmailSubscriptionService returns an instance of the Email_Subscription SoftLayer service
32 func GetEmailSubscriptionService(sess session.SLSession) Email_Subscription {
33 return Email_Subscription{Session: sess}
34 }
35
36 func (r Email_Subscription) Id(id int) Email_Subscription {
37 r.Options.Id = &id
38 return r
39 }
40
41 func (r Email_Subscription) Mask(mask string) Email_Subscription {
42 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
43 mask = fmt.Sprintf("mask[%s]", mask)
44 }
45
46 r.Options.Mask = mask
47 return r
48 }
49
50 func (r Email_Subscription) Filter(filter string) Email_Subscription {
51 r.Options.Filter = filter
52 return r
53 }
54
55 func (r Email_Subscription) Limit(limit int) Email_Subscription {
56 r.Options.Limit = &limit
57 return r
58 }
59
60 func (r Email_Subscription) Offset(offset int) Email_Subscription {
61 r.Options.Offset = &offset
62 return r
63 }
64
65 // no documentation yet
66 func (r Email_Subscription) Disable() (resp bool, err error) {
67 err = r.Session.DoRequest("SoftLayer_Email_Subscription", "disable", nil, &r.Options, &resp)
68 return
69 }
70
71 // no documentation yet
72 func (r Email_Subscription) Enable() (resp bool, err error) {
73 err = r.Session.DoRequest("SoftLayer_Email_Subscription", "enable", nil, &r.Options, &resp)
74 return
75 }
76
77 // no documentation yet
78 func (r Email_Subscription) GetAllObjects() (resp []datatypes.Email_Subscription, err error) {
79 err = r.Session.DoRequest("SoftLayer_Email_Subscription", "getAllObjects", nil, &r.Options, &resp)
80 return
81 }
82
83 // Retrieve
84 func (r Email_Subscription) GetEnabled() (resp bool, err error) {
85 err = r.Session.DoRequest("SoftLayer_Email_Subscription", "getEnabled", nil, &r.Options, &resp)
86 return
87 }
88
89 // no documentation yet
90 func (r Email_Subscription) GetObject() (resp datatypes.Email_Subscription, err error) {
91 err = r.Session.DoRequest("SoftLayer_Email_Subscription", "getObject", nil, &r.Options, &resp)
92 return
93 }
94
95 // no documentation yet
96 type Email_Subscription_Group struct {
97 Session session.SLSession
98 Options sl.Options
99 }
100
101 // GetEmailSubscriptionGroupService returns an instance of the Email_Subscription_Group SoftLayer service
102 func GetEmailSubscriptionGroupService(sess session.SLSession) Email_Subscription_Group {
103 return Email_Subscription_Group{Session: sess}
104 }
105
106 func (r Email_Subscription_Group) Id(id int) Email_Subscription_Group {
107 r.Options.Id = &id
108 return r
109 }
110
111 func (r Email_Subscription_Group) Mask(mask string) Email_Subscription_Group {
112 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
113 mask = fmt.Sprintf("mask[%s]", mask)
114 }
115
116 r.Options.Mask = mask
117 return r
118 }
119
120 func (r Email_Subscription_Group) Filter(filter string) Email_Subscription_Group {
121 r.Options.Filter = filter
122 return r
123 }
124
125 func (r Email_Subscription_Group) Limit(limit int) Email_Subscription_Group {
126 r.Options.Limit = &limit
127 return r
128 }
129
130 func (r Email_Subscription_Group) Offset(offset int) Email_Subscription_Group {
131 r.Options.Offset = &offset
132 return r
133 }
134
135 // no documentation yet
136 func (r Email_Subscription_Group) GetAllObjects() (resp []datatypes.Email_Subscription_Group, err error) {
137 err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getAllObjects", nil, &r.Options, &resp)
138 return
139 }
140
141 // no documentation yet
142 func (r Email_Subscription_Group) GetObject() (resp datatypes.Email_Subscription_Group, err error) {
143 err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getObject", nil, &r.Options, &resp)
144 return
145 }
146
147 // Retrieve All email subscriptions associated with this group.
148 func (r Email_Subscription_Group) GetSubscriptions() (resp []datatypes.Email_Subscription, err error) {
149 err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getSubscriptions", nil, &r.Options, &resp)
150 return
151 }
152