|
| 1 | +/* |
| 2 | +* Copyright 2018 - Present Okta, Inc. |
| 3 | +* |
| 4 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +* you may not use this file except in compliance with the License. |
| 6 | +* You may obtain a copy of the License at |
| 7 | +* |
| 8 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +* |
| 10 | +* Unless required by applicable law or agreed to in writing, software |
| 11 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +* See the License for the specific language governing permissions and |
| 14 | +* limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +// AUTO-GENERATED! DO NOT EDIT FILE DIRECTLY |
| 18 | + |
| 19 | +package okta |
| 20 | + |
| 21 | +import ( |
| 22 | + "fmt" |
| 23 | + "github.com/okta/okta-sdk-golang/okta.v2/query" |
| 24 | + "time" |
| 25 | +) |
| 26 | + |
| 27 | +type AppUserResource resource |
| 28 | + |
| 29 | +type AppUser struct { |
| 30 | + Embedded interface{} `json:"_embedded,omitempty"` |
| 31 | + Links interface{} `json:"_links,omitempty"` |
| 32 | + Created *time.Time `json:"created,omitempty"` |
| 33 | + Credentials *AppUserCredentials `json:"credentials,omitempty"` |
| 34 | + ExternalId string `json:"externalId,omitempty"` |
| 35 | + Id string `json:"id,omitempty"` |
| 36 | + LastSync *time.Time `json:"lastSync,omitempty"` |
| 37 | + LastUpdated *time.Time `json:"lastUpdated,omitempty"` |
| 38 | + PasswordChanged *time.Time `json:"passwordChanged,omitempty"` |
| 39 | + Profile interface{} `json:"profile,omitempty"` |
| 40 | + Scope string `json:"scope,omitempty"` |
| 41 | + Status string `json:"status,omitempty"` |
| 42 | + StatusChanged *time.Time `json:"statusChanged,omitempty"` |
| 43 | + SyncState string `json:"syncState,omitempty"` |
| 44 | +} |
| 45 | + |
| 46 | +func NewAppUser() *AppUser { |
| 47 | + return &AppUser{} |
| 48 | +} |
| 49 | + |
| 50 | +func (a *AppUser) IsApplicationInstance() bool { |
| 51 | + return true |
| 52 | +} |
| 53 | + |
| 54 | +// Updates a user's profile for an application |
| 55 | +func (m *AppUserResource) UpdateApplicationUser(appId string, userId string, body AppUser) (*AppUser, *Response, error) { |
| 56 | + url := fmt.Sprintf("/api/v1/apps/%v/users/%v", appId, userId) |
| 57 | + |
| 58 | + req, err := m.client.requestExecutor.WithAccept("application/json").WithContentType("application/json").NewRequest("POST", url, body) |
| 59 | + if err != nil { |
| 60 | + return nil, nil, err |
| 61 | + } |
| 62 | + |
| 63 | + var appUser *AppUser |
| 64 | + |
| 65 | + resp, err := m.client.requestExecutor.Do(req, &appUser) |
| 66 | + if err != nil { |
| 67 | + return nil, resp, err |
| 68 | + } |
| 69 | + |
| 70 | + return appUser, resp, nil |
| 71 | +} |
| 72 | + |
| 73 | +// Removes an assignment for a user from an application. |
| 74 | +func (m *AppUserResource) DeleteApplicationUser(appId string, userId string, qp *query.Params) (*Response, error) { |
| 75 | + url := fmt.Sprintf("/api/v1/apps/%v/users/%v", appId, userId) |
| 76 | + if qp != nil { |
| 77 | + url = url + qp.String() |
| 78 | + } |
| 79 | + |
| 80 | + req, err := m.client.requestExecutor.WithAccept("application/json").WithContentType("application/json").NewRequest("DELETE", url, nil) |
| 81 | + if err != nil { |
| 82 | + return nil, err |
| 83 | + } |
| 84 | + |
| 85 | + resp, err := m.client.requestExecutor.Do(req, nil) |
| 86 | + if err != nil { |
| 87 | + return resp, err |
| 88 | + } |
| 89 | + |
| 90 | + return resp, nil |
| 91 | +} |
0 commit comments