diff --git a/.secrets.baseline b/.secrets.baseline index 1d11c2fb..a7f891da 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.sum|^.secrets.baseline$|_test.go|package-lock.json|.cra/.cveignore", "lines": null }, - "generated_at": "2024-03-20T23:37:59Z", + "generated_at": "2024-03-25T17:49:50Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -128,7 +128,7 @@ "hashed_secret": "9b7c68a918b17eb053809b198d7c9abfc142f30a", "is_secret": false, "is_verified": false, - "line_number": 247, + "line_number": 265, "type": "Secret Keyword", "verified_result": null }, @@ -136,7 +136,7 @@ "hashed_secret": "b0caa0271bda35b09c45155df3832b056255bc96", "is_secret": false, "is_verified": false, - "line_number": 301, + "line_number": 327, "type": "Secret Keyword", "verified_result": null }, @@ -144,7 +144,7 @@ "hashed_secret": "783923e57ba5e8f1044632c31fd806ee24814bb5", "is_secret": false, "is_verified": false, - "line_number": 392, + "line_number": 437, "type": "Secret Keyword", "verified_result": null }, @@ -152,7 +152,7 @@ "hashed_secret": "f0f9776696ad22d22eaac21090596c8ff9908a80", "is_secret": false, "is_verified": false, - "line_number": 461, + "line_number": 515, "type": "Secret Keyword", "verified_result": null }, @@ -160,7 +160,7 @@ "hashed_secret": "db4ba57216101b14d842d373717bea5849609df3", "is_secret": false, "is_verified": false, - "line_number": 540, + "line_number": 610, "type": "Secret Keyword", "verified_result": null }, @@ -168,7 +168,7 @@ "hashed_secret": "e117797422d35ce52f036963c7e9603e9955b5c7", "is_secret": false, "is_verified": false, - "line_number": 589, + "line_number": 670, "type": "Secret Keyword", "verified_result": null }, @@ -176,7 +176,15 @@ "hashed_secret": "8ec4981102569463be3512984154c66c098b92c5", "is_secret": false, "is_verified": false, - "line_number": 639, + "line_number": 731, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "9905c33933602ae804e94f7731ecb5faaf4d6770", + "is_secret": false, + "is_verified": false, + "line_number": 852, "type": "Secret Keyword", "verified_result": null }, @@ -184,7 +192,7 @@ "hashed_secret": "4d6a6a4e27cfafab93e0487a9de1f26bdfeb8afb", "is_secret": false, "is_verified": false, - "line_number": 819, + "line_number": 1055, "type": "Secret Keyword", "verified_result": null }, @@ -192,7 +200,7 @@ "hashed_secret": "0d19d250028ff6865c70faea072729d1a888e9ae", "is_secret": false, "is_verified": false, - "line_number": 2526, + "line_number": 3019, "type": "Secret Keyword", "verified_result": null }, @@ -200,7 +208,7 @@ "hashed_secret": "0ec6d150549780250a9772c06b619bcc46a0e560", "is_secret": false, "is_verified": false, - "line_number": 5549, + "line_number": 6441, "type": "Secret Keyword", "verified_result": null }, @@ -208,7 +216,7 @@ "hashed_secret": "e058a1c493ad749bd67d368340e9056ed1c2f3ed", "is_secret": false, "is_verified": false, - "line_number": 5562, + "line_number": 6454, "type": "Secret Keyword", "verified_result": null }, @@ -216,7 +224,7 @@ "hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030", "is_secret": false, "is_verified": false, - "line_number": 6769, + "line_number": 7762, "type": "Secret Keyword", "verified_result": null }, @@ -224,7 +232,7 @@ "hashed_secret": "6452e7c5a42f97b00af1a210afc7d4de315e57ec", "is_secret": false, "is_verified": false, - "line_number": 11404, + "line_number": 12681, "type": "Secret Keyword", "verified_result": null } diff --git a/iamidentityv1/iam_identity_v1.go b/iamidentityv1/iam_identity_v1.go index e475c85b..a9b7394a 100644 --- a/iamidentityv1/iam_identity_v1.go +++ b/iamidentityv1/iam_identity_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553 + * IBM OpenAPI SDK Code Generator Version: 3.87.0-91c7c775-20240320-213027 */ // Package iamidentityv1 : Operations and models for the IamIdentityV1 service @@ -64,22 +64,26 @@ func NewIamIdentityV1UsingExternalConfig(options *IamIdentityV1Options) (iamIden if options.Authenticator == nil { options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) if err != nil { + err = core.SDKErrorf(err, "", "env-auth-error", common.GetComponentInfo()) return } } iamIdentity, err = NewIamIdentityV1(options) + err = core.RepurposeSDKProblem(err, "new-client-error") if err != nil { return } err = iamIdentity.Service.ConfigureService(options.ServiceName) if err != nil { + err = core.SDKErrorf(err, "", "client-config-error", common.GetComponentInfo()) return } if options.URL != "" { err = iamIdentity.Service.SetServiceURL(options.URL) + err = core.RepurposeSDKProblem(err, "url-set-error") } return } @@ -93,12 +97,14 @@ func NewIamIdentityV1(options *IamIdentityV1Options) (service *IamIdentityV1, er baseService, err := core.NewBaseService(serviceOptions) if err != nil { + err = core.SDKErrorf(err, "", "new-base-error", common.GetComponentInfo()) return } if options.URL != "" { err = baseService.SetServiceURL(options.URL) if err != nil { + err = core.SDKErrorf(err, "", "set-url-error", common.GetComponentInfo()) return } } @@ -112,7 +118,7 @@ func NewIamIdentityV1(options *IamIdentityV1Options) (service *IamIdentityV1, er // GetServiceURLForRegion returns the service URL to be used for the specified region func GetServiceURLForRegion(region string) (string, error) { - return "", fmt.Errorf("service does not support regional URLs") + return "", core.SDKErrorf(nil, "service does not support regional URLs", "no-regional-support", common.GetComponentInfo()) } // Clone makes a copy of "iamIdentity" suitable for processing requests. @@ -127,7 +133,11 @@ func (iamIdentity *IamIdentityV1) Clone() *IamIdentityV1 { // SetServiceURL sets the service URL func (iamIdentity *IamIdentityV1) SetServiceURL(url string) error { - return iamIdentity.Service.SetServiceURL(url) + err := iamIdentity.Service.SetServiceURL(url) + if err != nil { + err = core.SDKErrorf(err, "", "url-set-error", common.GetComponentInfo()) + } + return err } // GetServiceURL returns the service URL @@ -167,13 +177,16 @@ func (iamIdentity *IamIdentityV1) DisableRetries() { // service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space // developer in order to manage service IDs of the entity. func (iamIdentity *IamIdentityV1) ListAPIKeys(listAPIKeysOptions *ListAPIKeysOptions) (result *APIKeyList, response *core.DetailedResponse, err error) { - return iamIdentity.ListAPIKeysWithContext(context.Background(), listAPIKeysOptions) + result, response, err = iamIdentity.ListAPIKeysWithContext(context.Background(), listAPIKeysOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListAPIKeysWithContext is an alternate form of the ListAPIKeys method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListAPIKeysWithContext(ctx context.Context, listAPIKeysOptions *ListAPIKeysOptions) (result *APIKeyList, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listAPIKeysOptions, "listAPIKeysOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -182,6 +195,7 @@ func (iamIdentity *IamIdentityV1) ListAPIKeysWithContext(ctx context.Context, li builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -225,17 +239,21 @@ func (iamIdentity *IamIdentityV1) ListAPIKeysWithContext(ctx context.Context, li request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_api_keys", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKeyList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -248,17 +266,21 @@ func (iamIdentity *IamIdentityV1) ListAPIKeysWithContext(ctx context.Context, li // Creates an API key for a UserID or service ID. Users can manage user API keys for themself, or service ID API keys // for service IDs that are bound to an entity they have access to. func (iamIdentity *IamIdentityV1) CreateAPIKey(createAPIKeyOptions *CreateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { - return iamIdentity.CreateAPIKeyWithContext(context.Background(), createAPIKeyOptions) + result, response, err = iamIdentity.CreateAPIKeyWithContext(context.Background(), createAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateAPIKeyWithContext is an alternate form of the CreateAPIKey method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateAPIKeyWithContext(ctx context.Context, createAPIKeyOptions *CreateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createAPIKeyOptions, "createAPIKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createAPIKeyOptions, "createAPIKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -267,6 +289,7 @@ func (iamIdentity *IamIdentityV1) CreateAPIKeyWithContext(ctx context.Context, c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -283,6 +306,9 @@ func (iamIdentity *IamIdentityV1) CreateAPIKeyWithContext(ctx context.Context, c if createAPIKeyOptions.EntityLock != nil { builder.AddHeader("Entity-Lock", fmt.Sprint(*createAPIKeyOptions.EntityLock)) } + if createAPIKeyOptions.EntityDisable != nil { + builder.AddHeader("Entity-Disable", fmt.Sprint(*createAPIKeyOptions.EntityDisable)) + } body := make(map[string]interface{}) if createAPIKeyOptions.Name != nil { @@ -303,24 +329,35 @@ func (iamIdentity *IamIdentityV1) CreateAPIKeyWithContext(ctx context.Context, c if createAPIKeyOptions.StoreValue != nil { body["store_value"] = createAPIKeyOptions.StoreValue } + if createAPIKeyOptions.SupportSessions != nil { + body["support_sessions"] = createAPIKeyOptions.SupportSessions + } + if createAPIKeyOptions.ActionWhenLeaked != nil { + body["action_when_leaked"] = createAPIKeyOptions.ActionWhenLeaked + } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -333,13 +370,16 @@ func (iamIdentity *IamIdentityV1) CreateAPIKeyWithContext(ctx context.Context, c // Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys // for service IDs that are bound to an entity they have access to. func (iamIdentity *IamIdentityV1) GetAPIKeysDetails(getAPIKeysDetailsOptions *GetAPIKeysDetailsOptions) (result *APIKey, response *core.DetailedResponse, err error) { - return iamIdentity.GetAPIKeysDetailsWithContext(context.Background(), getAPIKeysDetailsOptions) + result, response, err = iamIdentity.GetAPIKeysDetailsWithContext(context.Background(), getAPIKeysDetailsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetAPIKeysDetailsWithContext is an alternate form of the GetAPIKeysDetails method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetAPIKeysDetailsWithContext(ctx context.Context, getAPIKeysDetailsOptions *GetAPIKeysDetailsOptions) (result *APIKey, response *core.DetailedResponse, err error) { err = core.ValidateStruct(getAPIKeysDetailsOptions, "getAPIKeysDetailsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -348,6 +388,7 @@ func (iamIdentity *IamIdentityV1) GetAPIKeysDetailsWithContext(ctx context.Conte builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/details`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -370,17 +411,21 @@ func (iamIdentity *IamIdentityV1) GetAPIKeysDetailsWithContext(ctx context.Conte request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_api_keys_details", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -394,17 +439,21 @@ func (iamIdentity *IamIdentityV1) GetAPIKeysDetailsWithContext(ctx context.Conte // IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either // an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. func (iamIdentity *IamIdentityV1) GetAPIKey(getAPIKeyOptions *GetAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { - return iamIdentity.GetAPIKeyWithContext(context.Background(), getAPIKeyOptions) + result, response, err = iamIdentity.GetAPIKeyWithContext(context.Background(), getAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetAPIKeyWithContext is an alternate form of the GetAPIKey method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetAPIKeyWithContext(ctx context.Context, getAPIKeyOptions *GetAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getAPIKeyOptions, "getAPIKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getAPIKeyOptions, "getAPIKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -417,6 +466,7 @@ func (iamIdentity *IamIdentityV1) GetAPIKeyWithContext(ctx context.Context, getA builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -439,17 +489,21 @@ func (iamIdentity *IamIdentityV1) GetAPIKeyWithContext(ctx context.Context, getA request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -464,17 +518,21 @@ func (iamIdentity *IamIdentityV1) GetAPIKeyWithContext(ctx context.Context, getA // property's value, pass the property with an empty value "".Users can manage user API keys for themself, or service ID // API keys for service IDs that are bound to an entity they have access to. func (iamIdentity *IamIdentityV1) UpdateAPIKey(updateAPIKeyOptions *UpdateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateAPIKeyWithContext(context.Background(), updateAPIKeyOptions) + result, response, err = iamIdentity.UpdateAPIKeyWithContext(context.Background(), updateAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateAPIKeyWithContext is an alternate form of the UpdateAPIKey method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateAPIKeyWithContext(ctx context.Context, updateAPIKeyOptions *UpdateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateAPIKeyOptions, "updateAPIKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateAPIKeyOptions, "updateAPIKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -487,6 +545,7 @@ func (iamIdentity *IamIdentityV1) UpdateAPIKeyWithContext(ctx context.Context, u builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -511,24 +570,35 @@ func (iamIdentity *IamIdentityV1) UpdateAPIKeyWithContext(ctx context.Context, u if updateAPIKeyOptions.Description != nil { body["description"] = updateAPIKeyOptions.Description } + if updateAPIKeyOptions.SupportSessions != nil { + body["support_sessions"] = updateAPIKeyOptions.SupportSessions + } + if updateAPIKeyOptions.ActionWhenLeaked != nil { + body["action_when_leaked"] = updateAPIKeyOptions.ActionWhenLeaked + } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -541,17 +611,21 @@ func (iamIdentity *IamIdentityV1) UpdateAPIKeyWithContext(ctx context.Context, u // Deletes an API key. Existing tokens will remain valid until expired. Users can manage user API keys for themself, or // service ID API keys for service IDs that are bound to an entity they have access to. func (iamIdentity *IamIdentityV1) DeleteAPIKey(deleteAPIKeyOptions *DeleteAPIKeyOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteAPIKeyWithContext(context.Background(), deleteAPIKeyOptions) + response, err = iamIdentity.DeleteAPIKeyWithContext(context.Background(), deleteAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteAPIKeyWithContext is an alternate form of the DeleteAPIKey method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteAPIKeyWithContext(ctx context.Context, deleteAPIKeyOptions *DeleteAPIKeyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteAPIKeyOptions, "deleteAPIKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteAPIKeyOptions, "deleteAPIKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -564,6 +638,7 @@ func (iamIdentity *IamIdentityV1) DeleteAPIKeyWithContext(ctx context.Context, d builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -578,10 +653,16 @@ func (iamIdentity *IamIdentityV1) DeleteAPIKeyWithContext(ctx context.Context, d request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -591,17 +672,21 @@ func (iamIdentity *IamIdentityV1) DeleteAPIKeyWithContext(ctx context.Context, d // bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account // owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. func (iamIdentity *IamIdentityV1) LockAPIKey(lockAPIKeyOptions *LockAPIKeyOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.LockAPIKeyWithContext(context.Background(), lockAPIKeyOptions) + response, err = iamIdentity.LockAPIKeyWithContext(context.Background(), lockAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // LockAPIKeyWithContext is an alternate form of the LockAPIKey method which supports a Context parameter func (iamIdentity *IamIdentityV1) LockAPIKeyWithContext(ctx context.Context, lockAPIKeyOptions *LockAPIKeyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(lockAPIKeyOptions, "lockAPIKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(lockAPIKeyOptions, "lockAPIKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -614,6 +699,7 @@ func (iamIdentity *IamIdentityV1) LockAPIKeyWithContext(ctx context.Context, loc builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}/lock`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -628,10 +714,16 @@ func (iamIdentity *IamIdentityV1) LockAPIKeyWithContext(ctx context.Context, loc request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "lock_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -641,17 +733,21 @@ func (iamIdentity *IamIdentityV1) LockAPIKeyWithContext(ctx context.Context, loc // are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an // account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. func (iamIdentity *IamIdentityV1) UnlockAPIKey(unlockAPIKeyOptions *UnlockAPIKeyOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.UnlockAPIKeyWithContext(context.Background(), unlockAPIKeyOptions) + response, err = iamIdentity.UnlockAPIKeyWithContext(context.Background(), unlockAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UnlockAPIKeyWithContext is an alternate form of the UnlockAPIKey method which supports a Context parameter func (iamIdentity *IamIdentityV1) UnlockAPIKeyWithContext(ctx context.Context, unlockAPIKeyOptions *UnlockAPIKeyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(unlockAPIKeyOptions, "unlockAPIKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(unlockAPIKeyOptions, "unlockAPIKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -664,6 +760,7 @@ func (iamIdentity *IamIdentityV1) UnlockAPIKeyWithContext(ctx context.Context, u builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}/lock`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -678,10 +775,136 @@ func (iamIdentity *IamIdentityV1) UnlockAPIKeyWithContext(ctx context.Context, u request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "unlock_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// DisableAPIKey : disable the API key +// Disable an API key. Users can manage user API keys for themself, or service ID API keys for service IDs that are +// bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) DisableAPIKey(disableAPIKeyOptions *DisableAPIKeyOptions) (response *core.DetailedResponse, err error) { + response, err = iamIdentity.DisableAPIKeyWithContext(context.Background(), disableAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DisableAPIKeyWithContext is an alternate form of the DisableAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) DisableAPIKeyWithContext(ctx context.Context, disableAPIKeyOptions *DisableAPIKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(disableAPIKeyOptions, "disableAPIKeyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(disableAPIKeyOptions, "disableAPIKeyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *disableAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}/disable`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range disableAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "DisableAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "disable_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// EnableAPIKey : Enable the API key +// Enable an API key. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound +// to an entity they have access to. +func (iamIdentity *IamIdentityV1) EnableAPIKey(enableAPIKeyOptions *EnableAPIKeyOptions) (response *core.DetailedResponse, err error) { + response, err = iamIdentity.EnableAPIKeyWithContext(context.Background(), enableAPIKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// EnableAPIKeyWithContext is an alternate form of the EnableAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) EnableAPIKeyWithContext(ctx context.Context, enableAPIKeyOptions *EnableAPIKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(enableAPIKeyOptions, "enableAPIKeyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(enableAPIKeyOptions, "enableAPIKeyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *enableAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}/disable`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range enableAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "EnableAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "enable_api_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -691,13 +914,16 @@ func (iamIdentity *IamIdentityV1) UnlockAPIKeyWithContext(ctx context.Context, u // that are bound to an entity they have access to. Note: apikey details are only included in the response when creating // a Service ID with an api key. func (iamIdentity *IamIdentityV1) ListServiceIds(listServiceIdsOptions *ListServiceIdsOptions) (result *ServiceIDList, response *core.DetailedResponse, err error) { - return iamIdentity.ListServiceIdsWithContext(context.Background(), listServiceIdsOptions) + result, response, err = iamIdentity.ListServiceIdsWithContext(context.Background(), listServiceIdsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListServiceIdsWithContext is an alternate form of the ListServiceIds method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListServiceIdsWithContext(ctx context.Context, listServiceIdsOptions *ListServiceIdsOptions) (result *ServiceIDList, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listServiceIdsOptions, "listServiceIdsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -706,6 +932,7 @@ func (iamIdentity *IamIdentityV1) ListServiceIdsWithContext(ctx context.Context, builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -743,17 +970,21 @@ func (iamIdentity *IamIdentityV1) ListServiceIdsWithContext(ctx context.Context, request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_service_ids", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceIDList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -766,17 +997,21 @@ func (iamIdentity *IamIdentityV1) ListServiceIdsWithContext(ctx context.Context, // Creates a service ID for an IBM Cloud account. Users can manage user API keys for themself, or service ID API keys // for service IDs that are bound to an entity they have access to. func (iamIdentity *IamIdentityV1) CreateServiceID(createServiceIDOptions *CreateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { - return iamIdentity.CreateServiceIDWithContext(context.Background(), createServiceIDOptions) + result, response, err = iamIdentity.CreateServiceIDWithContext(context.Background(), createServiceIDOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateServiceIDWithContext is an alternate form of the CreateServiceID method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateServiceIDWithContext(ctx context.Context, createServiceIDOptions *CreateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createServiceIDOptions, "createServiceIDOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createServiceIDOptions, "createServiceIDOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -785,6 +1020,7 @@ func (iamIdentity *IamIdentityV1) CreateServiceIDWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -820,22 +1056,27 @@ func (iamIdentity *IamIdentityV1) CreateServiceIDWithContext(ctx context.Context } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_service_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceID) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -849,17 +1090,21 @@ func (iamIdentity *IamIdentityV1) CreateServiceIDWithContext(ctx context.Context // IDs that are bound to an entity they have access to. Note: apikey details are only included in the response when // creating a Service ID with an api key. func (iamIdentity *IamIdentityV1) GetServiceID(getServiceIDOptions *GetServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { - return iamIdentity.GetServiceIDWithContext(context.Background(), getServiceIDOptions) + result, response, err = iamIdentity.GetServiceIDWithContext(context.Background(), getServiceIDOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetServiceIDWithContext is an alternate form of the GetServiceID method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetServiceIDWithContext(ctx context.Context, getServiceIDOptions *GetServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getServiceIDOptions, "getServiceIDOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getServiceIDOptions, "getServiceIDOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -872,6 +1117,7 @@ func (iamIdentity *IamIdentityV1) GetServiceIDWithContext(ctx context.Context, g builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -894,17 +1140,21 @@ func (iamIdentity *IamIdentityV1) GetServiceIDWithContext(ctx context.Context, g request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_service_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceID) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -920,17 +1170,21 @@ func (iamIdentity *IamIdentityV1) GetServiceIDWithContext(ctx context.Context, g // service ID API keys for service IDs that are bound to an entity they have access to. Note: apikey details are only // included in the response when creating a Service ID with an apikey. func (iamIdentity *IamIdentityV1) UpdateServiceID(updateServiceIDOptions *UpdateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateServiceIDWithContext(context.Background(), updateServiceIDOptions) + result, response, err = iamIdentity.UpdateServiceIDWithContext(context.Background(), updateServiceIDOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateServiceIDWithContext is an alternate form of the UpdateServiceID method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateServiceIDWithContext(ctx context.Context, updateServiceIDOptions *UpdateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateServiceIDOptions, "updateServiceIDOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateServiceIDOptions, "updateServiceIDOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -943,6 +1197,7 @@ func (iamIdentity *IamIdentityV1) UpdateServiceIDWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -972,22 +1227,27 @@ func (iamIdentity *IamIdentityV1) UpdateServiceIDWithContext(ctx context.Context } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_service_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceID) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1002,17 +1262,21 @@ func (iamIdentity *IamIdentityV1) UpdateServiceIDWithContext(ctx context.Context // deleted if the associated API keys were successfully deleted before. Users can manage user API keys for themself, or // service ID API keys for service IDs that are bound to an entity they have access to. func (iamIdentity *IamIdentityV1) DeleteServiceID(deleteServiceIDOptions *DeleteServiceIDOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteServiceIDWithContext(context.Background(), deleteServiceIDOptions) + response, err = iamIdentity.DeleteServiceIDWithContext(context.Background(), deleteServiceIDOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteServiceIDWithContext is an alternate form of the DeleteServiceID method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteServiceIDWithContext(ctx context.Context, deleteServiceIDOptions *DeleteServiceIDOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteServiceIDOptions, "deleteServiceIDOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteServiceIDOptions, "deleteServiceIDOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1025,6 +1289,7 @@ func (iamIdentity *IamIdentityV1) DeleteServiceIDWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1039,10 +1304,16 @@ func (iamIdentity *IamIdentityV1) DeleteServiceIDWithContext(ctx context.Context request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_service_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1052,17 +1323,21 @@ func (iamIdentity *IamIdentityV1) DeleteServiceIDWithContext(ctx context.Context // are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an // account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. func (iamIdentity *IamIdentityV1) LockServiceID(lockServiceIDOptions *LockServiceIDOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.LockServiceIDWithContext(context.Background(), lockServiceIDOptions) + response, err = iamIdentity.LockServiceIDWithContext(context.Background(), lockServiceIDOptions) + err = core.RepurposeSDKProblem(err, "") + return } // LockServiceIDWithContext is an alternate form of the LockServiceID method which supports a Context parameter func (iamIdentity *IamIdentityV1) LockServiceIDWithContext(ctx context.Context, lockServiceIDOptions *LockServiceIDOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(lockServiceIDOptions, "lockServiceIDOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(lockServiceIDOptions, "lockServiceIDOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1075,6 +1350,7 @@ func (iamIdentity *IamIdentityV1) LockServiceIDWithContext(ctx context.Context, builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}/lock`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1089,10 +1365,16 @@ func (iamIdentity *IamIdentityV1) LockServiceIDWithContext(ctx context.Context, request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "lock_service_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1102,17 +1384,21 @@ func (iamIdentity *IamIdentityV1) LockServiceIDWithContext(ctx context.Context, // are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an // account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. func (iamIdentity *IamIdentityV1) UnlockServiceID(unlockServiceIDOptions *UnlockServiceIDOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.UnlockServiceIDWithContext(context.Background(), unlockServiceIDOptions) + response, err = iamIdentity.UnlockServiceIDWithContext(context.Background(), unlockServiceIDOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UnlockServiceIDWithContext is an alternate form of the UnlockServiceID method which supports a Context parameter func (iamIdentity *IamIdentityV1) UnlockServiceIDWithContext(ctx context.Context, unlockServiceIDOptions *UnlockServiceIDOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(unlockServiceIDOptions, "unlockServiceIDOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(unlockServiceIDOptions, "unlockServiceIDOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1125,6 +1411,7 @@ func (iamIdentity *IamIdentityV1) UnlockServiceIDWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}/lock`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1139,10 +1426,16 @@ func (iamIdentity *IamIdentityV1) UnlockServiceIDWithContext(ctx context.Context request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "unlock_service_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1150,17 +1443,21 @@ func (iamIdentity *IamIdentityV1) UnlockServiceIDWithContext(ctx context.Context // CreateProfile : Create a trusted profile // Create a trusted profile for a given account ID. func (iamIdentity *IamIdentityV1) CreateProfile(createProfileOptions *CreateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { - return iamIdentity.CreateProfileWithContext(context.Background(), createProfileOptions) + result, response, err = iamIdentity.CreateProfileWithContext(context.Background(), createProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateProfileWithContext is an alternate form of the CreateProfile method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateProfileWithContext(ctx context.Context, createProfileOptions *CreateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createProfileOptions, "createProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createProfileOptions, "createProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1169,6 +1466,7 @@ func (iamIdentity *IamIdentityV1) CreateProfileWithContext(ctx context.Context, builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1195,22 +1493,27 @@ func (iamIdentity *IamIdentityV1) CreateProfileWithContext(ctx context.Context, } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1223,17 +1526,21 @@ func (iamIdentity *IamIdentityV1) CreateProfileWithContext(ctx context.Context, // List the trusted profiles in an account. The `account_id` query parameter determines the account from which to // retrieve the list of trusted profiles. func (iamIdentity *IamIdentityV1) ListProfiles(listProfilesOptions *ListProfilesOptions) (result *TrustedProfilesList, response *core.DetailedResponse, err error) { - return iamIdentity.ListProfilesWithContext(context.Background(), listProfilesOptions) + result, response, err = iamIdentity.ListProfilesWithContext(context.Background(), listProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListProfilesWithContext is an alternate form of the ListProfiles method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListProfilesWithContext(ctx context.Context, listProfilesOptions *ListProfilesOptions) (result *TrustedProfilesList, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listProfilesOptions, "listProfilesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listProfilesOptions, "listProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1242,6 +1549,7 @@ func (iamIdentity *IamIdentityV1) ListProfilesWithContext(ctx context.Context, l builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1277,17 +1585,21 @@ func (iamIdentity *IamIdentityV1) ListProfilesWithContext(ctx context.Context, l request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfilesList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1300,17 +1612,21 @@ func (iamIdentity *IamIdentityV1) ListProfilesWithContext(ctx context.Context, l // Retrieve a trusted profile by its `profile-id`. Only the trusted profile's data is returned (`name`, `description`, // `iam_id`, etc.), not the federated users or compute resources that qualify to apply the trusted profile. func (iamIdentity *IamIdentityV1) GetProfile(getProfileOptions *GetProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { - return iamIdentity.GetProfileWithContext(context.Background(), getProfileOptions) + result, response, err = iamIdentity.GetProfileWithContext(context.Background(), getProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetProfileWithContext is an alternate form of the GetProfile method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetProfileWithContext(ctx context.Context, getProfileOptions *GetProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getProfileOptions, "getProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getProfileOptions, "getProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1323,6 +1639,7 @@ func (iamIdentity *IamIdentityV1) GetProfileWithContext(ctx context.Context, get builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1342,17 +1659,21 @@ func (iamIdentity *IamIdentityV1) GetProfileWithContext(ctx context.Context, get request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1364,17 +1685,21 @@ func (iamIdentity *IamIdentityV1) GetProfileWithContext(ctx context.Context, get // UpdateProfile : Update a trusted profile // Update the name or description of an existing trusted profile. func (iamIdentity *IamIdentityV1) UpdateProfile(updateProfileOptions *UpdateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateProfileWithContext(context.Background(), updateProfileOptions) + result, response, err = iamIdentity.UpdateProfileWithContext(context.Background(), updateProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateProfileWithContext is an alternate form of the UpdateProfile method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateProfileWithContext(ctx context.Context, updateProfileOptions *UpdateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateProfileOptions, "updateProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateProfileOptions, "updateProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1387,6 +1712,7 @@ func (iamIdentity *IamIdentityV1) UpdateProfileWithContext(ctx context.Context, builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1413,22 +1739,27 @@ func (iamIdentity *IamIdentityV1) UpdateProfileWithContext(ctx context.Context, } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1441,17 +1772,21 @@ func (iamIdentity *IamIdentityV1) UpdateProfileWithContext(ctx context.Context, // Delete a trusted profile. When you delete trusted profile, compute resources and federated users are unlinked from // the profile and can no longer apply the trusted profile identity. func (iamIdentity *IamIdentityV1) DeleteProfile(deleteProfileOptions *DeleteProfileOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteProfileWithContext(context.Background(), deleteProfileOptions) + response, err = iamIdentity.DeleteProfileWithContext(context.Background(), deleteProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteProfileWithContext is an alternate form of the DeleteProfile method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteProfileWithContext(ctx context.Context, deleteProfileOptions *DeleteProfileOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteProfileOptions, "deleteProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteProfileOptions, "deleteProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1464,6 +1799,7 @@ func (iamIdentity *IamIdentityV1) DeleteProfileWithContext(ctx context.Context, builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1478,10 +1814,16 @@ func (iamIdentity *IamIdentityV1) DeleteProfileWithContext(ctx context.Context, request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1489,17 +1831,21 @@ func (iamIdentity *IamIdentityV1) DeleteProfileWithContext(ctx context.Context, // CreateClaimRule : Create claim rule for a trusted profile // Create a claim rule for a trusted profile. There is a limit of 20 rules per trusted profile. func (iamIdentity *IamIdentityV1) CreateClaimRule(createClaimRuleOptions *CreateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { - return iamIdentity.CreateClaimRuleWithContext(context.Background(), createClaimRuleOptions) + result, response, err = iamIdentity.CreateClaimRuleWithContext(context.Background(), createClaimRuleOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateClaimRuleWithContext is an alternate form of the CreateClaimRule method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateClaimRuleWithContext(ctx context.Context, createClaimRuleOptions *CreateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createClaimRuleOptions, "createClaimRuleOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createClaimRuleOptions, "createClaimRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1512,6 +1858,7 @@ func (iamIdentity *IamIdentityV1) CreateClaimRuleWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1550,22 +1897,27 @@ func (iamIdentity *IamIdentityV1) CreateClaimRuleWithContext(ctx context.Context } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_claim_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1578,17 +1930,21 @@ func (iamIdentity *IamIdentityV1) CreateClaimRuleWithContext(ctx context.Context // Get a list of all claim rules for a trusted profile. The `profile-id` query parameter determines the profile from // which to retrieve the list of claim rules. func (iamIdentity *IamIdentityV1) ListClaimRules(listClaimRulesOptions *ListClaimRulesOptions) (result *ProfileClaimRuleList, response *core.DetailedResponse, err error) { - return iamIdentity.ListClaimRulesWithContext(context.Background(), listClaimRulesOptions) + result, response, err = iamIdentity.ListClaimRulesWithContext(context.Background(), listClaimRulesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListClaimRulesWithContext is an alternate form of the ListClaimRules method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListClaimRulesWithContext(ctx context.Context, listClaimRulesOptions *ListClaimRulesOptions) (result *ProfileClaimRuleList, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listClaimRulesOptions, "listClaimRulesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listClaimRulesOptions, "listClaimRulesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1601,6 +1957,7 @@ func (iamIdentity *IamIdentityV1) ListClaimRulesWithContext(ctx context.Context, builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1616,17 +1973,21 @@ func (iamIdentity *IamIdentityV1) ListClaimRulesWithContext(ctx context.Context, request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_claim_rules", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRuleList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1638,23 +1999,27 @@ func (iamIdentity *IamIdentityV1) ListClaimRulesWithContext(ctx context.Context, // GetClaimRule : Get a claim rule for a trusted profile // A specific claim rule can be fetched for a given trusted profile ID and rule ID. func (iamIdentity *IamIdentityV1) GetClaimRule(getClaimRuleOptions *GetClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { - return iamIdentity.GetClaimRuleWithContext(context.Background(), getClaimRuleOptions) + result, response, err = iamIdentity.GetClaimRuleWithContext(context.Background(), getClaimRuleOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetClaimRuleWithContext is an alternate form of the GetClaimRule method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetClaimRuleWithContext(ctx context.Context, getClaimRuleOptions *GetClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getClaimRuleOptions, "getClaimRuleOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getClaimRuleOptions, "getClaimRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "profile-id": *getClaimRuleOptions.ProfileID, - "rule-id": *getClaimRuleOptions.RuleID, + "rule-id": *getClaimRuleOptions.RuleID, } builder := core.NewRequestBuilder(core.GET) @@ -1662,6 +2027,7 @@ func (iamIdentity *IamIdentityV1) GetClaimRuleWithContext(ctx context.Context, g builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules/{rule-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1677,17 +2043,21 @@ func (iamIdentity *IamIdentityV1) GetClaimRuleWithContext(ctx context.Context, g request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_claim_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1699,23 +2069,27 @@ func (iamIdentity *IamIdentityV1) GetClaimRuleWithContext(ctx context.Context, g // UpdateClaimRule : Update claim rule for a trusted profile // Update a specific claim rule for a given trusted profile ID and rule ID. func (iamIdentity *IamIdentityV1) UpdateClaimRule(updateClaimRuleOptions *UpdateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateClaimRuleWithContext(context.Background(), updateClaimRuleOptions) + result, response, err = iamIdentity.UpdateClaimRuleWithContext(context.Background(), updateClaimRuleOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateClaimRuleWithContext is an alternate form of the UpdateClaimRule method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateClaimRuleWithContext(ctx context.Context, updateClaimRuleOptions *UpdateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateClaimRuleOptions, "updateClaimRuleOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateClaimRuleOptions, "updateClaimRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "profile-id": *updateClaimRuleOptions.ProfileID, - "rule-id": *updateClaimRuleOptions.RuleID, + "rule-id": *updateClaimRuleOptions.RuleID, } builder := core.NewRequestBuilder(core.PUT) @@ -1723,6 +2097,7 @@ func (iamIdentity *IamIdentityV1) UpdateClaimRuleWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules/{rule-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1764,22 +2139,27 @@ func (iamIdentity *IamIdentityV1) UpdateClaimRuleWithContext(ctx context.Context } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_claim_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1792,23 +2172,27 @@ func (iamIdentity *IamIdentityV1) UpdateClaimRuleWithContext(ctx context.Context // Delete a claim rule. When you delete a claim rule, federated user or compute resources are no longer required to meet // the conditions of the claim rule in order to apply the trusted profile. func (iamIdentity *IamIdentityV1) DeleteClaimRule(deleteClaimRuleOptions *DeleteClaimRuleOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteClaimRuleWithContext(context.Background(), deleteClaimRuleOptions) + response, err = iamIdentity.DeleteClaimRuleWithContext(context.Background(), deleteClaimRuleOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteClaimRuleWithContext is an alternate form of the DeleteClaimRule method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteClaimRuleWithContext(ctx context.Context, deleteClaimRuleOptions *DeleteClaimRuleOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteClaimRuleOptions, "deleteClaimRuleOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteClaimRuleOptions, "deleteClaimRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "profile-id": *deleteClaimRuleOptions.ProfileID, - "rule-id": *deleteClaimRuleOptions.RuleID, + "rule-id": *deleteClaimRuleOptions.RuleID, } builder := core.NewRequestBuilder(core.DELETE) @@ -1816,6 +2200,7 @@ func (iamIdentity *IamIdentityV1) DeleteClaimRuleWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules/{rule-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1830,10 +2215,16 @@ func (iamIdentity *IamIdentityV1) DeleteClaimRuleWithContext(ctx context.Context request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_claim_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1842,17 +2233,21 @@ func (iamIdentity *IamIdentityV1) DeleteClaimRuleWithContext(ctx context.Context // Create a direct link between a specific compute resource and a trusted profile, rather than creating conditions that // a compute resource must fulfill to apply a trusted profile. func (iamIdentity *IamIdentityV1) CreateLink(createLinkOptions *CreateLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { - return iamIdentity.CreateLinkWithContext(context.Background(), createLinkOptions) + result, response, err = iamIdentity.CreateLinkWithContext(context.Background(), createLinkOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateLinkWithContext is an alternate form of the CreateLink method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateLinkWithContext(ctx context.Context, createLinkOptions *CreateLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createLinkOptions, "createLinkOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLinkOptions, "createLinkOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1865,6 +2260,7 @@ func (iamIdentity *IamIdentityV1) CreateLinkWithContext(ctx context.Context, cre builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1891,22 +2287,27 @@ func (iamIdentity *IamIdentityV1) CreateLinkWithContext(ctx context.Context, cre } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_link", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileLink) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1918,17 +2319,21 @@ func (iamIdentity *IamIdentityV1) CreateLinkWithContext(ctx context.Context, cre // ListLinks : List links to a trusted profile // Get a list of links to a trusted profile. func (iamIdentity *IamIdentityV1) ListLinks(listLinksOptions *ListLinksOptions) (result *ProfileLinkList, response *core.DetailedResponse, err error) { - return iamIdentity.ListLinksWithContext(context.Background(), listLinksOptions) + result, response, err = iamIdentity.ListLinksWithContext(context.Background(), listLinksOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListLinksWithContext is an alternate form of the ListLinks method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListLinksWithContext(ctx context.Context, listLinksOptions *ListLinksOptions) (result *ProfileLinkList, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listLinksOptions, "listLinksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listLinksOptions, "listLinksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1941,6 +2346,7 @@ func (iamIdentity *IamIdentityV1) ListLinksWithContext(ctx context.Context, list builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1956,17 +2362,21 @@ func (iamIdentity *IamIdentityV1) ListLinksWithContext(ctx context.Context, list request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_links", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileLinkList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1978,23 +2388,27 @@ func (iamIdentity *IamIdentityV1) ListLinksWithContext(ctx context.Context, list // GetLink : Get link to a trusted profile // Get a specific link to a trusted profile by `link_id`. func (iamIdentity *IamIdentityV1) GetLink(getLinkOptions *GetLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { - return iamIdentity.GetLinkWithContext(context.Background(), getLinkOptions) + result, response, err = iamIdentity.GetLinkWithContext(context.Background(), getLinkOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetLinkWithContext is an alternate form of the GetLink method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetLinkWithContext(ctx context.Context, getLinkOptions *GetLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getLinkOptions, "getLinkOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLinkOptions, "getLinkOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "profile-id": *getLinkOptions.ProfileID, - "link-id": *getLinkOptions.LinkID, + "link-id": *getLinkOptions.LinkID, } builder := core.NewRequestBuilder(core.GET) @@ -2002,6 +2416,7 @@ func (iamIdentity *IamIdentityV1) GetLinkWithContext(ctx context.Context, getLin builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links/{link-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2017,17 +2432,21 @@ func (iamIdentity *IamIdentityV1) GetLinkWithContext(ctx context.Context, getLin request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_link", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileLink) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2039,23 +2458,27 @@ func (iamIdentity *IamIdentityV1) GetLinkWithContext(ctx context.Context, getLin // DeleteLink : Delete link to a trusted profile // Delete a link between a compute resource and a trusted profile. func (iamIdentity *IamIdentityV1) DeleteLink(deleteLinkOptions *DeleteLinkOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteLinkWithContext(context.Background(), deleteLinkOptions) + response, err = iamIdentity.DeleteLinkWithContext(context.Background(), deleteLinkOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteLinkWithContext is an alternate form of the DeleteLink method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteLinkWithContext(ctx context.Context, deleteLinkOptions *DeleteLinkOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteLinkOptions, "deleteLinkOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLinkOptions, "deleteLinkOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "profile-id": *deleteLinkOptions.ProfileID, - "link-id": *deleteLinkOptions.LinkID, + "link-id": *deleteLinkOptions.LinkID, } builder := core.NewRequestBuilder(core.DELETE) @@ -2063,6 +2486,7 @@ func (iamIdentity *IamIdentityV1) DeleteLinkWithContext(ctx context.Context, del builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links/{link-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2077,10 +2501,16 @@ func (iamIdentity *IamIdentityV1) DeleteLinkWithContext(ctx context.Context, del request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_link", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2088,17 +2518,21 @@ func (iamIdentity *IamIdentityV1) DeleteLinkWithContext(ctx context.Context, del // GetProfileIdentities : Get a list of identities that can assume the trusted profile // Get a list of identities that can assume the trusted profile. func (iamIdentity *IamIdentityV1) GetProfileIdentities(getProfileIdentitiesOptions *GetProfileIdentitiesOptions) (result *ProfileIdentitiesResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetProfileIdentitiesWithContext(context.Background(), getProfileIdentitiesOptions) + result, response, err = iamIdentity.GetProfileIdentitiesWithContext(context.Background(), getProfileIdentitiesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetProfileIdentitiesWithContext is an alternate form of the GetProfileIdentities method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetProfileIdentitiesWithContext(ctx context.Context, getProfileIdentitiesOptions *GetProfileIdentitiesOptions) (result *ProfileIdentitiesResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getProfileIdentitiesOptions, "getProfileIdentitiesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getProfileIdentitiesOptions, "getProfileIdentitiesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2111,6 +2545,7 @@ func (iamIdentity *IamIdentityV1) GetProfileIdentitiesWithContext(ctx context.Co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/identities`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2126,17 +2561,21 @@ func (iamIdentity *IamIdentityV1) GetProfileIdentitiesWithContext(ctx context.Co request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_profile_identities", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileIdentitiesResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2148,17 +2587,21 @@ func (iamIdentity *IamIdentityV1) GetProfileIdentitiesWithContext(ctx context.Co // SetProfileIdentities : Update the list of identities that can assume the trusted profile // Update the list of identities that can assume the trusted profile. func (iamIdentity *IamIdentityV1) SetProfileIdentities(setProfileIdentitiesOptions *SetProfileIdentitiesOptions) (result *ProfileIdentitiesResponse, response *core.DetailedResponse, err error) { - return iamIdentity.SetProfileIdentitiesWithContext(context.Background(), setProfileIdentitiesOptions) + result, response, err = iamIdentity.SetProfileIdentitiesWithContext(context.Background(), setProfileIdentitiesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // SetProfileIdentitiesWithContext is an alternate form of the SetProfileIdentities method which supports a Context parameter func (iamIdentity *IamIdentityV1) SetProfileIdentitiesWithContext(ctx context.Context, setProfileIdentitiesOptions *SetProfileIdentitiesOptions) (result *ProfileIdentitiesResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(setProfileIdentitiesOptions, "setProfileIdentitiesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(setProfileIdentitiesOptions, "setProfileIdentitiesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2171,6 +2614,7 @@ func (iamIdentity *IamIdentityV1) SetProfileIdentitiesWithContext(ctx context.Co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/identities`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2194,22 +2638,27 @@ func (iamIdentity *IamIdentityV1) SetProfileIdentitiesWithContext(ctx context.Co } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "set_profile_identities", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileIdentitiesResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2221,22 +2670,26 @@ func (iamIdentity *IamIdentityV1) SetProfileIdentitiesWithContext(ctx context.Co // SetProfileIdentity : Add a specific identity that can assume the trusted profile // Add a specific identity that can assume the trusted profile. func (iamIdentity *IamIdentityV1) SetProfileIdentity(setProfileIdentityOptions *SetProfileIdentityOptions) (result *ProfileIdentityResponse, response *core.DetailedResponse, err error) { - return iamIdentity.SetProfileIdentityWithContext(context.Background(), setProfileIdentityOptions) + result, response, err = iamIdentity.SetProfileIdentityWithContext(context.Background(), setProfileIdentityOptions) + err = core.RepurposeSDKProblem(err, "") + return } // SetProfileIdentityWithContext is an alternate form of the SetProfileIdentity method which supports a Context parameter func (iamIdentity *IamIdentityV1) SetProfileIdentityWithContext(ctx context.Context, setProfileIdentityOptions *SetProfileIdentityOptions) (result *ProfileIdentityResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(setProfileIdentityOptions, "setProfileIdentityOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(setProfileIdentityOptions, "setProfileIdentityOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "profile-id": *setProfileIdentityOptions.ProfileID, + "profile-id": *setProfileIdentityOptions.ProfileID, "identity-type": *setProfileIdentityOptions.IdentityType, } @@ -2245,6 +2698,7 @@ func (iamIdentity *IamIdentityV1) SetProfileIdentityWithContext(ctx context.Cont builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/identities/{identity-type}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2274,22 +2728,27 @@ func (iamIdentity *IamIdentityV1) SetProfileIdentityWithContext(ctx context.Cont } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "set_profile_identity", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileIdentityResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2301,22 +2760,26 @@ func (iamIdentity *IamIdentityV1) SetProfileIdentityWithContext(ctx context.Cont // GetProfileIdentity : Get the identity that can assume the trusted profile // Get the identity that can assume the trusted profile. func (iamIdentity *IamIdentityV1) GetProfileIdentity(getProfileIdentityOptions *GetProfileIdentityOptions) (result *ProfileIdentityResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetProfileIdentityWithContext(context.Background(), getProfileIdentityOptions) + result, response, err = iamIdentity.GetProfileIdentityWithContext(context.Background(), getProfileIdentityOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetProfileIdentityWithContext is an alternate form of the GetProfileIdentity method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetProfileIdentityWithContext(ctx context.Context, getProfileIdentityOptions *GetProfileIdentityOptions) (result *ProfileIdentityResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getProfileIdentityOptions, "getProfileIdentityOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getProfileIdentityOptions, "getProfileIdentityOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "profile-id": *getProfileIdentityOptions.ProfileID, + "profile-id": *getProfileIdentityOptions.ProfileID, "identity-type": *getProfileIdentityOptions.IdentityType, "identifier-id": *getProfileIdentityOptions.IdentifierID, } @@ -2326,6 +2789,7 @@ func (iamIdentity *IamIdentityV1) GetProfileIdentityWithContext(ctx context.Cont builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/identities/{identity-type}/{identifier-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2341,17 +2805,21 @@ func (iamIdentity *IamIdentityV1) GetProfileIdentityWithContext(ctx context.Cont request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_profile_identity", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileIdentityResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2363,22 +2831,26 @@ func (iamIdentity *IamIdentityV1) GetProfileIdentityWithContext(ctx context.Cont // DeleteProfileIdentity : Delete the identity that can assume the trusted profile // Delete the identity that can assume the trusted profile. func (iamIdentity *IamIdentityV1) DeleteProfileIdentity(deleteProfileIdentityOptions *DeleteProfileIdentityOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteProfileIdentityWithContext(context.Background(), deleteProfileIdentityOptions) + response, err = iamIdentity.DeleteProfileIdentityWithContext(context.Background(), deleteProfileIdentityOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteProfileIdentityWithContext is an alternate form of the DeleteProfileIdentity method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteProfileIdentityWithContext(ctx context.Context, deleteProfileIdentityOptions *DeleteProfileIdentityOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteProfileIdentityOptions, "deleteProfileIdentityOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteProfileIdentityOptions, "deleteProfileIdentityOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "profile-id": *deleteProfileIdentityOptions.ProfileID, + "profile-id": *deleteProfileIdentityOptions.ProfileID, "identity-type": *deleteProfileIdentityOptions.IdentityType, "identifier-id": *deleteProfileIdentityOptions.IdentifierID, } @@ -2388,6 +2860,7 @@ func (iamIdentity *IamIdentityV1) DeleteProfileIdentityWithContext(ctx context.C builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/identities/{identity-type}/{identifier-id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2402,10 +2875,16 @@ func (iamIdentity *IamIdentityV1) DeleteProfileIdentityWithContext(ctx context.C request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_profile_identity", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2413,17 +2892,21 @@ func (iamIdentity *IamIdentityV1) DeleteProfileIdentityWithContext(ctx context.C // GetAccountSettings : Get account configurations // Returns the details of an account's configuration. func (iamIdentity *IamIdentityV1) GetAccountSettings(getAccountSettingsOptions *GetAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetAccountSettingsWithContext(context.Background(), getAccountSettingsOptions) + result, response, err = iamIdentity.GetAccountSettingsWithContext(context.Background(), getAccountSettingsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetAccountSettingsWithContext is an alternate form of the GetAccountSettings method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetAccountSettingsWithContext(ctx context.Context, getAccountSettingsOptions *GetAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getAccountSettingsOptions, "getAccountSettingsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getAccountSettingsOptions, "getAccountSettingsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2436,6 +2919,7 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsWithContext(ctx context.Cont builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/accounts/{account_id}/settings/identity`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2455,17 +2939,21 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsWithContext(ctx context.Cont request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "getAccountSettings", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2478,17 +2966,21 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsWithContext(ctx context.Cont // Allows a user to configure settings on their account with regards to MFA, MFA excemption list, session lifetimes, // access control for creating new identities, and enforcing IP restrictions on token creation. func (iamIdentity *IamIdentityV1) UpdateAccountSettings(updateAccountSettingsOptions *UpdateAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateAccountSettingsWithContext(context.Background(), updateAccountSettingsOptions) + result, response, err = iamIdentity.UpdateAccountSettingsWithContext(context.Background(), updateAccountSettingsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateAccountSettingsWithContext is an alternate form of the UpdateAccountSettings method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateAccountSettingsWithContext(ctx context.Context, updateAccountSettingsOptions *UpdateAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateAccountSettingsOptions, "updateAccountSettingsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateAccountSettingsOptions, "updateAccountSettingsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2501,6 +2993,7 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsWithContext(ctx context.C builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/accounts/{account_id}/settings/identity`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2551,22 +3044,27 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsWithContext(ctx context.C } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "updateAccountSettings", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2578,17 +3076,21 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsWithContext(ctx context.C // GetMfaStatus : Get MFA enrollment status for a single user in the account // Get MFA enrollment status for a single user in the account. func (iamIdentity *IamIdentityV1) GetMfaStatus(getMfaStatusOptions *GetMfaStatusOptions) (result *UserMfaEnrollments, response *core.DetailedResponse, err error) { - return iamIdentity.GetMfaStatusWithContext(context.Background(), getMfaStatusOptions) + result, response, err = iamIdentity.GetMfaStatusWithContext(context.Background(), getMfaStatusOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetMfaStatusWithContext is an alternate form of the GetMfaStatus method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetMfaStatusWithContext(ctx context.Context, getMfaStatusOptions *GetMfaStatusOptions) (result *UserMfaEnrollments, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getMfaStatusOptions, "getMfaStatusOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getMfaStatusOptions, "getMfaStatusOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2601,6 +3103,7 @@ func (iamIdentity *IamIdentityV1) GetMfaStatusWithContext(ctx context.Context, g builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/mfa/accounts/{account_id}/status`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2618,17 +3121,21 @@ func (iamIdentity *IamIdentityV1) GetMfaStatusWithContext(ctx context.Context, g request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_mfa_status", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalUserMfaEnrollments) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2641,17 +3148,21 @@ func (iamIdentity *IamIdentityV1) GetMfaStatusWithContext(ctx context.Context, g // Trigger MFA enrollment status report for the account by specifying the account ID. It can take a few minutes to // generate the report for retrieval. func (iamIdentity *IamIdentityV1) CreateMfaReport(createMfaReportOptions *CreateMfaReportOptions) (result *ReportReference, response *core.DetailedResponse, err error) { - return iamIdentity.CreateMfaReportWithContext(context.Background(), createMfaReportOptions) + result, response, err = iamIdentity.CreateMfaReportWithContext(context.Background(), createMfaReportOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateMfaReportWithContext is an alternate form of the CreateMfaReport method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateMfaReportWithContext(ctx context.Context, createMfaReportOptions *CreateMfaReportOptions) (result *ReportReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createMfaReportOptions, "createMfaReportOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createMfaReportOptions, "createMfaReportOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2664,6 +3175,7 @@ func (iamIdentity *IamIdentityV1) CreateMfaReportWithContext(ctx context.Context builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/mfa/accounts/{account_id}/report`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2683,17 +3195,21 @@ func (iamIdentity *IamIdentityV1) CreateMfaReportWithContext(ctx context.Context request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_mfa_report", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReportReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2706,23 +3222,27 @@ func (iamIdentity *IamIdentityV1) CreateMfaReportWithContext(ctx context.Context // Get MFA enrollment status report for the account by specifying the account ID and the reference that is generated by // triggering the report. Reports older than a day are deleted when generating a new report. func (iamIdentity *IamIdentityV1) GetMfaReport(getMfaReportOptions *GetMfaReportOptions) (result *ReportMfaEnrollmentStatus, response *core.DetailedResponse, err error) { - return iamIdentity.GetMfaReportWithContext(context.Background(), getMfaReportOptions) + result, response, err = iamIdentity.GetMfaReportWithContext(context.Background(), getMfaReportOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetMfaReportWithContext is an alternate form of the GetMfaReport method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetMfaReportWithContext(ctx context.Context, getMfaReportOptions *GetMfaReportOptions) (result *ReportMfaEnrollmentStatus, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getMfaReportOptions, "getMfaReportOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getMfaReportOptions, "getMfaReportOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "account_id": *getMfaReportOptions.AccountID, - "reference": *getMfaReportOptions.Reference, + "reference": *getMfaReportOptions.Reference, } builder := core.NewRequestBuilder(core.GET) @@ -2730,6 +3250,7 @@ func (iamIdentity *IamIdentityV1) GetMfaReportWithContext(ctx context.Context, g builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/mfa/accounts/{account_id}/report/{reference}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2745,17 +3266,21 @@ func (iamIdentity *IamIdentityV1) GetMfaReportWithContext(ctx context.Context, g request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_mfa_report", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReportMfaEnrollmentStatus) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2767,13 +3292,16 @@ func (iamIdentity *IamIdentityV1) GetMfaReportWithContext(ctx context.Context, g // ListAccountSettingsAssignments : List assignments // List account settings assignments. func (iamIdentity *IamIdentityV1) ListAccountSettingsAssignments(listAccountSettingsAssignmentsOptions *ListAccountSettingsAssignmentsOptions) (result *TemplateAssignmentListResponse, response *core.DetailedResponse, err error) { - return iamIdentity.ListAccountSettingsAssignmentsWithContext(context.Background(), listAccountSettingsAssignmentsOptions) + result, response, err = iamIdentity.ListAccountSettingsAssignmentsWithContext(context.Background(), listAccountSettingsAssignmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListAccountSettingsAssignmentsWithContext is an alternate form of the ListAccountSettingsAssignments method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListAccountSettingsAssignmentsWithContext(ctx context.Context, listAccountSettingsAssignmentsOptions *ListAccountSettingsAssignmentsOptions) (result *TemplateAssignmentListResponse, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listAccountSettingsAssignmentsOptions, "listAccountSettingsAssignmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2782,6 +3310,7 @@ func (iamIdentity *IamIdentityV1) ListAccountSettingsAssignmentsWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_assignments/`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2828,17 +3357,21 @@ func (iamIdentity *IamIdentityV1) ListAccountSettingsAssignmentsWithContext(ctx request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_account_settings_assignments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentListResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2850,17 +3383,21 @@ func (iamIdentity *IamIdentityV1) ListAccountSettingsAssignmentsWithContext(ctx // CreateAccountSettingsAssignment : Create assignment // Create an assigment for an account settings template. func (iamIdentity *IamIdentityV1) CreateAccountSettingsAssignment(createAccountSettingsAssignmentOptions *CreateAccountSettingsAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { - return iamIdentity.CreateAccountSettingsAssignmentWithContext(context.Background(), createAccountSettingsAssignmentOptions) + result, response, err = iamIdentity.CreateAccountSettingsAssignmentWithContext(context.Background(), createAccountSettingsAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateAccountSettingsAssignmentWithContext is an alternate form of the CreateAccountSettingsAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateAccountSettingsAssignmentWithContext(ctx context.Context, createAccountSettingsAssignmentOptions *CreateAccountSettingsAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createAccountSettingsAssignmentOptions, "createAccountSettingsAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createAccountSettingsAssignmentOptions, "createAccountSettingsAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2869,6 +3406,7 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsAssignmentWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_assignments/`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2898,22 +3436,27 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsAssignmentWithContext(ctx } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_account_settings_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2925,17 +3468,21 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsAssignmentWithContext(ctx // GetAccountSettingsAssignment : Get assignment // Get an assigment for an account settings template. func (iamIdentity *IamIdentityV1) GetAccountSettingsAssignment(getAccountSettingsAssignmentOptions *GetAccountSettingsAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetAccountSettingsAssignmentWithContext(context.Background(), getAccountSettingsAssignmentOptions) + result, response, err = iamIdentity.GetAccountSettingsAssignmentWithContext(context.Background(), getAccountSettingsAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetAccountSettingsAssignmentWithContext is an alternate form of the GetAccountSettingsAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetAccountSettingsAssignmentWithContext(ctx context.Context, getAccountSettingsAssignmentOptions *GetAccountSettingsAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getAccountSettingsAssignmentOptions, "getAccountSettingsAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getAccountSettingsAssignmentOptions, "getAccountSettingsAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2948,6 +3495,7 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsAssignmentWithContext(ctx co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_assignments/{assignment_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2967,17 +3515,21 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsAssignmentWithContext(ctx co request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_account_settings_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2990,17 +3542,21 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsAssignmentWithContext(ctx co // Delete an account settings template assignment. This removes any IAM resources created by this assignment in child // accounts. func (iamIdentity *IamIdentityV1) DeleteAccountSettingsAssignment(deleteAccountSettingsAssignmentOptions *DeleteAccountSettingsAssignmentOptions) (result *ExceptionResponse, response *core.DetailedResponse, err error) { - return iamIdentity.DeleteAccountSettingsAssignmentWithContext(context.Background(), deleteAccountSettingsAssignmentOptions) + result, response, err = iamIdentity.DeleteAccountSettingsAssignmentWithContext(context.Background(), deleteAccountSettingsAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteAccountSettingsAssignmentWithContext is an alternate form of the DeleteAccountSettingsAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteAccountSettingsAssignmentWithContext(ctx context.Context, deleteAccountSettingsAssignmentOptions *DeleteAccountSettingsAssignmentOptions) (result *ExceptionResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteAccountSettingsAssignmentOptions, "deleteAccountSettingsAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteAccountSettingsAssignmentOptions, "deleteAccountSettingsAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3013,6 +3569,7 @@ func (iamIdentity *IamIdentityV1) DeleteAccountSettingsAssignmentWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_assignments/{assignment_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3028,17 +3585,21 @@ func (iamIdentity *IamIdentityV1) DeleteAccountSettingsAssignmentWithContext(ctx request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "delete_account_settings_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalExceptionResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3051,17 +3612,21 @@ func (iamIdentity *IamIdentityV1) DeleteAccountSettingsAssignmentWithContext(ctx // Update an account settings assignment. Call this method to retry failed assignments or migrate the settings in child // accounts to a new version. func (iamIdentity *IamIdentityV1) UpdateAccountSettingsAssignment(updateAccountSettingsAssignmentOptions *UpdateAccountSettingsAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateAccountSettingsAssignmentWithContext(context.Background(), updateAccountSettingsAssignmentOptions) + result, response, err = iamIdentity.UpdateAccountSettingsAssignmentWithContext(context.Background(), updateAccountSettingsAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateAccountSettingsAssignmentWithContext is an alternate form of the UpdateAccountSettingsAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateAccountSettingsAssignmentWithContext(ctx context.Context, updateAccountSettingsAssignmentOptions *UpdateAccountSettingsAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateAccountSettingsAssignmentOptions, "updateAccountSettingsAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateAccountSettingsAssignmentOptions, "updateAccountSettingsAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3074,6 +3639,7 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsAssignmentWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_assignments/{assignment_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3097,22 +3663,27 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsAssignmentWithContext(ctx } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_account_settings_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3124,13 +3695,16 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsAssignmentWithContext(ctx // ListAccountSettingsTemplates : List account settings templates // List account settings templates in an enterprise account. func (iamIdentity *IamIdentityV1) ListAccountSettingsTemplates(listAccountSettingsTemplatesOptions *ListAccountSettingsTemplatesOptions) (result *AccountSettingsTemplateList, response *core.DetailedResponse, err error) { - return iamIdentity.ListAccountSettingsTemplatesWithContext(context.Background(), listAccountSettingsTemplatesOptions) + result, response, err = iamIdentity.ListAccountSettingsTemplatesWithContext(context.Background(), listAccountSettingsTemplatesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListAccountSettingsTemplatesWithContext is an alternate form of the ListAccountSettingsTemplates method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListAccountSettingsTemplatesWithContext(ctx context.Context, listAccountSettingsTemplatesOptions *ListAccountSettingsTemplatesOptions) (result *AccountSettingsTemplateList, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listAccountSettingsTemplatesOptions, "listAccountSettingsTemplatesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3139,6 +3713,7 @@ func (iamIdentity *IamIdentityV1) ListAccountSettingsTemplatesWithContext(ctx co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3173,17 +3748,21 @@ func (iamIdentity *IamIdentityV1) ListAccountSettingsTemplatesWithContext(ctx co request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_account_settings_templates", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3195,17 +3774,21 @@ func (iamIdentity *IamIdentityV1) ListAccountSettingsTemplatesWithContext(ctx co // CreateAccountSettingsTemplate : Create an account settings template // Create a new account settings template in an enterprise account. func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplate(createAccountSettingsTemplateOptions *CreateAccountSettingsTemplateOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.CreateAccountSettingsTemplateWithContext(context.Background(), createAccountSettingsTemplateOptions) + result, response, err = iamIdentity.CreateAccountSettingsTemplateWithContext(context.Background(), createAccountSettingsTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateAccountSettingsTemplateWithContext is an alternate form of the CreateAccountSettingsTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateWithContext(ctx context.Context, createAccountSettingsTemplateOptions *CreateAccountSettingsTemplateOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createAccountSettingsTemplateOptions, "createAccountSettingsTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createAccountSettingsTemplateOptions, "createAccountSettingsTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3214,6 +3797,7 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateWithContext(ctx c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3243,22 +3827,27 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateWithContext(ctx c } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_account_settings_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3270,17 +3859,21 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateWithContext(ctx c // GetLatestAccountSettingsTemplateVersion : Get latest version of an account settings template // Get the latest version of a specific account settings template in an enterprise account. func (iamIdentity *IamIdentityV1) GetLatestAccountSettingsTemplateVersion(getLatestAccountSettingsTemplateVersionOptions *GetLatestAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetLatestAccountSettingsTemplateVersionWithContext(context.Background(), getLatestAccountSettingsTemplateVersionOptions) + result, response, err = iamIdentity.GetLatestAccountSettingsTemplateVersionWithContext(context.Background(), getLatestAccountSettingsTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetLatestAccountSettingsTemplateVersionWithContext is an alternate form of the GetLatestAccountSettingsTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetLatestAccountSettingsTemplateVersionWithContext(ctx context.Context, getLatestAccountSettingsTemplateVersionOptions *GetLatestAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getLatestAccountSettingsTemplateVersionOptions, "getLatestAccountSettingsTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLatestAccountSettingsTemplateVersionOptions, "getLatestAccountSettingsTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3293,6 +3886,7 @@ func (iamIdentity *IamIdentityV1) GetLatestAccountSettingsTemplateVersionWithCon builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3312,17 +3906,21 @@ func (iamIdentity *IamIdentityV1) GetLatestAccountSettingsTemplateVersionWithCon request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_latest_account_settings_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3335,17 +3933,21 @@ func (iamIdentity *IamIdentityV1) GetLatestAccountSettingsTemplateVersionWithCon // Delete all versions of an account settings template in an enterprise account. If any version is assigned to child // accounts, you must first delete the assignment. func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfAccountSettingsTemplate(deleteAllVersionsOfAccountSettingsTemplateOptions *DeleteAllVersionsOfAccountSettingsTemplateOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteAllVersionsOfAccountSettingsTemplateWithContext(context.Background(), deleteAllVersionsOfAccountSettingsTemplateOptions) + response, err = iamIdentity.DeleteAllVersionsOfAccountSettingsTemplateWithContext(context.Background(), deleteAllVersionsOfAccountSettingsTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteAllVersionsOfAccountSettingsTemplateWithContext is an alternate form of the DeleteAllVersionsOfAccountSettingsTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfAccountSettingsTemplateWithContext(ctx context.Context, deleteAllVersionsOfAccountSettingsTemplateOptions *DeleteAllVersionsOfAccountSettingsTemplateOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteAllVersionsOfAccountSettingsTemplateOptions, "deleteAllVersionsOfAccountSettingsTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteAllVersionsOfAccountSettingsTemplateOptions, "deleteAllVersionsOfAccountSettingsTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3358,6 +3960,7 @@ func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfAccountSettingsTemplateWith builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3372,10 +3975,16 @@ func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfAccountSettingsTemplateWith request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_all_versions_of_account_settings_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3383,17 +3992,21 @@ func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfAccountSettingsTemplateWith // ListVersionsOfAccountSettingsTemplate : List account settings template versions // List the versions of a specific account settings template in an enterprise account. func (iamIdentity *IamIdentityV1) ListVersionsOfAccountSettingsTemplate(listVersionsOfAccountSettingsTemplateOptions *ListVersionsOfAccountSettingsTemplateOptions) (result *AccountSettingsTemplateList, response *core.DetailedResponse, err error) { - return iamIdentity.ListVersionsOfAccountSettingsTemplateWithContext(context.Background(), listVersionsOfAccountSettingsTemplateOptions) + result, response, err = iamIdentity.ListVersionsOfAccountSettingsTemplateWithContext(context.Background(), listVersionsOfAccountSettingsTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVersionsOfAccountSettingsTemplateWithContext is an alternate form of the ListVersionsOfAccountSettingsTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListVersionsOfAccountSettingsTemplateWithContext(ctx context.Context, listVersionsOfAccountSettingsTemplateOptions *ListVersionsOfAccountSettingsTemplateOptions) (result *AccountSettingsTemplateList, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVersionsOfAccountSettingsTemplateOptions, "listVersionsOfAccountSettingsTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVersionsOfAccountSettingsTemplateOptions, "listVersionsOfAccountSettingsTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3406,6 +4019,7 @@ func (iamIdentity *IamIdentityV1) ListVersionsOfAccountSettingsTemplateWithConte builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}/versions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3437,17 +4051,21 @@ func (iamIdentity *IamIdentityV1) ListVersionsOfAccountSettingsTemplateWithConte request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_versions_of_account_settings_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3459,17 +4077,21 @@ func (iamIdentity *IamIdentityV1) ListVersionsOfAccountSettingsTemplateWithConte // CreateAccountSettingsTemplateVersion : Create a new version of an account settings template // Create a new version of an account settings template in an Enterprise Account. func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateVersion(createAccountSettingsTemplateVersionOptions *CreateAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.CreateAccountSettingsTemplateVersionWithContext(context.Background(), createAccountSettingsTemplateVersionOptions) + result, response, err = iamIdentity.CreateAccountSettingsTemplateVersionWithContext(context.Background(), createAccountSettingsTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateAccountSettingsTemplateVersionWithContext is an alternate form of the CreateAccountSettingsTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateVersionWithContext(ctx context.Context, createAccountSettingsTemplateVersionOptions *CreateAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createAccountSettingsTemplateVersionOptions, "createAccountSettingsTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createAccountSettingsTemplateVersionOptions, "createAccountSettingsTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3482,6 +4104,7 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateVersionWithContex builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}/versions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3511,22 +4134,27 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateVersionWithContex } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_account_settings_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3538,23 +4166,27 @@ func (iamIdentity *IamIdentityV1) CreateAccountSettingsTemplateVersionWithContex // GetAccountSettingsTemplateVersion : Get version of an account settings template // Get a specific version of an account settings template in an Enterprise Account. func (iamIdentity *IamIdentityV1) GetAccountSettingsTemplateVersion(getAccountSettingsTemplateVersionOptions *GetAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetAccountSettingsTemplateVersionWithContext(context.Background(), getAccountSettingsTemplateVersionOptions) + result, response, err = iamIdentity.GetAccountSettingsTemplateVersionWithContext(context.Background(), getAccountSettingsTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetAccountSettingsTemplateVersionWithContext is an alternate form of the GetAccountSettingsTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetAccountSettingsTemplateVersionWithContext(ctx context.Context, getAccountSettingsTemplateVersionOptions *GetAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getAccountSettingsTemplateVersionOptions, "getAccountSettingsTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getAccountSettingsTemplateVersionOptions, "getAccountSettingsTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *getAccountSettingsTemplateVersionOptions.TemplateID, - "version": *getAccountSettingsTemplateVersionOptions.Version, + "version": *getAccountSettingsTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.GET) @@ -3562,6 +4194,7 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsTemplateVersionWithContext(c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}/versions/{version}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3581,17 +4214,21 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsTemplateVersionWithContext(c request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_account_settings_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3603,23 +4240,27 @@ func (iamIdentity *IamIdentityV1) GetAccountSettingsTemplateVersionWithContext(c // UpdateAccountSettingsTemplateVersion : Update version of an account settings template // Update a specific version of an account settings template in an Enterprise Account. func (iamIdentity *IamIdentityV1) UpdateAccountSettingsTemplateVersion(updateAccountSettingsTemplateVersionOptions *UpdateAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateAccountSettingsTemplateVersionWithContext(context.Background(), updateAccountSettingsTemplateVersionOptions) + result, response, err = iamIdentity.UpdateAccountSettingsTemplateVersionWithContext(context.Background(), updateAccountSettingsTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateAccountSettingsTemplateVersionWithContext is an alternate form of the UpdateAccountSettingsTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateAccountSettingsTemplateVersionWithContext(ctx context.Context, updateAccountSettingsTemplateVersionOptions *UpdateAccountSettingsTemplateVersionOptions) (result *AccountSettingsTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateAccountSettingsTemplateVersionOptions, "updateAccountSettingsTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateAccountSettingsTemplateVersionOptions, "updateAccountSettingsTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *updateAccountSettingsTemplateVersionOptions.TemplateID, - "version": *updateAccountSettingsTemplateVersionOptions.Version, + "version": *updateAccountSettingsTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.PUT) @@ -3627,6 +4268,7 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsTemplateVersionWithContex builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}/versions/{version}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3659,22 +4301,27 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsTemplateVersionWithContex } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_account_settings_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3686,23 +4333,27 @@ func (iamIdentity *IamIdentityV1) UpdateAccountSettingsTemplateVersionWithContex // DeleteAccountSettingsTemplateVersion : Delete version of an account settings template // Delete a specific version of an account settings template in an Enterprise Account. func (iamIdentity *IamIdentityV1) DeleteAccountSettingsTemplateVersion(deleteAccountSettingsTemplateVersionOptions *DeleteAccountSettingsTemplateVersionOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteAccountSettingsTemplateVersionWithContext(context.Background(), deleteAccountSettingsTemplateVersionOptions) + response, err = iamIdentity.DeleteAccountSettingsTemplateVersionWithContext(context.Background(), deleteAccountSettingsTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteAccountSettingsTemplateVersionWithContext is an alternate form of the DeleteAccountSettingsTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteAccountSettingsTemplateVersionWithContext(ctx context.Context, deleteAccountSettingsTemplateVersionOptions *DeleteAccountSettingsTemplateVersionOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteAccountSettingsTemplateVersionOptions, "deleteAccountSettingsTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteAccountSettingsTemplateVersionOptions, "deleteAccountSettingsTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *deleteAccountSettingsTemplateVersionOptions.TemplateID, - "version": *deleteAccountSettingsTemplateVersionOptions.Version, + "version": *deleteAccountSettingsTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.DELETE) @@ -3710,6 +4361,7 @@ func (iamIdentity *IamIdentityV1) DeleteAccountSettingsTemplateVersionWithContex builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}/versions/{version}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3724,10 +4376,16 @@ func (iamIdentity *IamIdentityV1) DeleteAccountSettingsTemplateVersionWithContex request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_account_settings_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3736,23 +4394,27 @@ func (iamIdentity *IamIdentityV1) DeleteAccountSettingsTemplateVersionWithContex // Commit a specific version of an account settings template in an Enterprise Account. A Template must be committed // before being assigned, and once committed, can no longer be modified. func (iamIdentity *IamIdentityV1) CommitAccountSettingsTemplate(commitAccountSettingsTemplateOptions *CommitAccountSettingsTemplateOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.CommitAccountSettingsTemplateWithContext(context.Background(), commitAccountSettingsTemplateOptions) + response, err = iamIdentity.CommitAccountSettingsTemplateWithContext(context.Background(), commitAccountSettingsTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CommitAccountSettingsTemplateWithContext is an alternate form of the CommitAccountSettingsTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) CommitAccountSettingsTemplateWithContext(ctx context.Context, commitAccountSettingsTemplateOptions *CommitAccountSettingsTemplateOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(commitAccountSettingsTemplateOptions, "commitAccountSettingsTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(commitAccountSettingsTemplateOptions, "commitAccountSettingsTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *commitAccountSettingsTemplateOptions.TemplateID, - "version": *commitAccountSettingsTemplateOptions.Version, + "version": *commitAccountSettingsTemplateOptions.Version, } builder := core.NewRequestBuilder(core.POST) @@ -3760,6 +4422,7 @@ func (iamIdentity *IamIdentityV1) CommitAccountSettingsTemplateWithContext(ctx c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/account_settings_templates/{template_id}/versions/{version}/commit`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3774,10 +4437,16 @@ func (iamIdentity *IamIdentityV1) CommitAccountSettingsTemplateWithContext(ctx c request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "commit_account_settings_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3786,17 +4455,21 @@ func (iamIdentity *IamIdentityV1) CommitAccountSettingsTemplateWithContext(ctx c // Trigger activity report for the account by specifying the account ID. It can take a few minutes to generate the // report for retrieval. func (iamIdentity *IamIdentityV1) CreateReport(createReportOptions *CreateReportOptions) (result *ReportReference, response *core.DetailedResponse, err error) { - return iamIdentity.CreateReportWithContext(context.Background(), createReportOptions) + result, response, err = iamIdentity.CreateReportWithContext(context.Background(), createReportOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateReportWithContext is an alternate form of the CreateReport method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateReportWithContext(ctx context.Context, createReportOptions *CreateReportOptions) (result *ReportReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createReportOptions, "createReportOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createReportOptions, "createReportOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3809,6 +4482,7 @@ func (iamIdentity *IamIdentityV1) CreateReportWithContext(ctx context.Context, c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/activity/accounts/{account_id}/report`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3831,17 +4505,21 @@ func (iamIdentity *IamIdentityV1) CreateReportWithContext(ctx context.Context, c request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_report", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReportReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3854,23 +4532,27 @@ func (iamIdentity *IamIdentityV1) CreateReportWithContext(ctx context.Context, c // Get activity report for the account by specifying the account ID and the reference that is generated by triggering // the report. Reports older than a day are deleted when generating a new report. func (iamIdentity *IamIdentityV1) GetReport(getReportOptions *GetReportOptions) (result *Report, response *core.DetailedResponse, err error) { - return iamIdentity.GetReportWithContext(context.Background(), getReportOptions) + result, response, err = iamIdentity.GetReportWithContext(context.Background(), getReportOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetReportWithContext is an alternate form of the GetReport method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetReportWithContext(ctx context.Context, getReportOptions *GetReportOptions) (result *Report, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getReportOptions, "getReportOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getReportOptions, "getReportOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "account_id": *getReportOptions.AccountID, - "reference": *getReportOptions.Reference, + "reference": *getReportOptions.Reference, } builder := core.NewRequestBuilder(core.GET) @@ -3878,6 +4560,7 @@ func (iamIdentity *IamIdentityV1) GetReportWithContext(ctx context.Context, getR builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/activity/accounts/{account_id}/report/{reference}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3893,17 +4576,21 @@ func (iamIdentity *IamIdentityV1) GetReportWithContext(ctx context.Context, getR request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_report", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReport) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3915,13 +4602,16 @@ func (iamIdentity *IamIdentityV1) GetReportWithContext(ctx context.Context, getR // ListTrustedProfileAssignments : List assignments // List trusted profile template assignments. func (iamIdentity *IamIdentityV1) ListTrustedProfileAssignments(listTrustedProfileAssignmentsOptions *ListTrustedProfileAssignmentsOptions) (result *TemplateAssignmentListResponse, response *core.DetailedResponse, err error) { - return iamIdentity.ListTrustedProfileAssignmentsWithContext(context.Background(), listTrustedProfileAssignmentsOptions) + result, response, err = iamIdentity.ListTrustedProfileAssignmentsWithContext(context.Background(), listTrustedProfileAssignmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListTrustedProfileAssignmentsWithContext is an alternate form of the ListTrustedProfileAssignments method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListTrustedProfileAssignmentsWithContext(ctx context.Context, listTrustedProfileAssignmentsOptions *ListTrustedProfileAssignmentsOptions) (result *TemplateAssignmentListResponse, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listTrustedProfileAssignmentsOptions, "listTrustedProfileAssignmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3930,6 +4620,7 @@ func (iamIdentity *IamIdentityV1) ListTrustedProfileAssignmentsWithContext(ctx c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_assignments/`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3976,17 +4667,21 @@ func (iamIdentity *IamIdentityV1) ListTrustedProfileAssignmentsWithContext(ctx c request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_trusted_profile_assignments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentListResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3998,17 +4693,21 @@ func (iamIdentity *IamIdentityV1) ListTrustedProfileAssignmentsWithContext(ctx c // CreateTrustedProfileAssignment : Create assignment // Create an assigment for a trusted profile template. func (iamIdentity *IamIdentityV1) CreateTrustedProfileAssignment(createTrustedProfileAssignmentOptions *CreateTrustedProfileAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { - return iamIdentity.CreateTrustedProfileAssignmentWithContext(context.Background(), createTrustedProfileAssignmentOptions) + result, response, err = iamIdentity.CreateTrustedProfileAssignmentWithContext(context.Background(), createTrustedProfileAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateTrustedProfileAssignmentWithContext is an alternate form of the CreateTrustedProfileAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateTrustedProfileAssignmentWithContext(ctx context.Context, createTrustedProfileAssignmentOptions *CreateTrustedProfileAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createTrustedProfileAssignmentOptions, "createTrustedProfileAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createTrustedProfileAssignmentOptions, "createTrustedProfileAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4017,6 +4716,7 @@ func (iamIdentity *IamIdentityV1) CreateTrustedProfileAssignmentWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_assignments/`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4046,22 +4746,27 @@ func (iamIdentity *IamIdentityV1) CreateTrustedProfileAssignmentWithContext(ctx } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_trusted_profile_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4073,17 +4778,21 @@ func (iamIdentity *IamIdentityV1) CreateTrustedProfileAssignmentWithContext(ctx // GetTrustedProfileAssignment : Get assignment // Get an assigment for a trusted profile template. func (iamIdentity *IamIdentityV1) GetTrustedProfileAssignment(getTrustedProfileAssignmentOptions *GetTrustedProfileAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetTrustedProfileAssignmentWithContext(context.Background(), getTrustedProfileAssignmentOptions) + result, response, err = iamIdentity.GetTrustedProfileAssignmentWithContext(context.Background(), getTrustedProfileAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetTrustedProfileAssignmentWithContext is an alternate form of the GetTrustedProfileAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetTrustedProfileAssignmentWithContext(ctx context.Context, getTrustedProfileAssignmentOptions *GetTrustedProfileAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getTrustedProfileAssignmentOptions, "getTrustedProfileAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getTrustedProfileAssignmentOptions, "getTrustedProfileAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4096,6 +4805,7 @@ func (iamIdentity *IamIdentityV1) GetTrustedProfileAssignmentWithContext(ctx con builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_assignments/{assignment_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4115,17 +4825,21 @@ func (iamIdentity *IamIdentityV1) GetTrustedProfileAssignmentWithContext(ctx con request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_trusted_profile_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4137,17 +4851,21 @@ func (iamIdentity *IamIdentityV1) GetTrustedProfileAssignmentWithContext(ctx con // DeleteTrustedProfileAssignment : Delete assignment // Delete a trusted profile assignment. This removes any IAM resources created by this assignment in child accounts. func (iamIdentity *IamIdentityV1) DeleteTrustedProfileAssignment(deleteTrustedProfileAssignmentOptions *DeleteTrustedProfileAssignmentOptions) (result *ExceptionResponse, response *core.DetailedResponse, err error) { - return iamIdentity.DeleteTrustedProfileAssignmentWithContext(context.Background(), deleteTrustedProfileAssignmentOptions) + result, response, err = iamIdentity.DeleteTrustedProfileAssignmentWithContext(context.Background(), deleteTrustedProfileAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteTrustedProfileAssignmentWithContext is an alternate form of the DeleteTrustedProfileAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteTrustedProfileAssignmentWithContext(ctx context.Context, deleteTrustedProfileAssignmentOptions *DeleteTrustedProfileAssignmentOptions) (result *ExceptionResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteTrustedProfileAssignmentOptions, "deleteTrustedProfileAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteTrustedProfileAssignmentOptions, "deleteTrustedProfileAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4160,6 +4878,7 @@ func (iamIdentity *IamIdentityV1) DeleteTrustedProfileAssignmentWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_assignments/{assignment_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4175,17 +4894,21 @@ func (iamIdentity *IamIdentityV1) DeleteTrustedProfileAssignmentWithContext(ctx request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "delete_trusted_profile_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalExceptionResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4198,17 +4921,21 @@ func (iamIdentity *IamIdentityV1) DeleteTrustedProfileAssignmentWithContext(ctx // Update a trusted profile assignment. Call this method to retry failed assignments or migrate the trusted profile in // child accounts to a new version. func (iamIdentity *IamIdentityV1) UpdateTrustedProfileAssignment(updateTrustedProfileAssignmentOptions *UpdateTrustedProfileAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateTrustedProfileAssignmentWithContext(context.Background(), updateTrustedProfileAssignmentOptions) + result, response, err = iamIdentity.UpdateTrustedProfileAssignmentWithContext(context.Background(), updateTrustedProfileAssignmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateTrustedProfileAssignmentWithContext is an alternate form of the UpdateTrustedProfileAssignment method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateTrustedProfileAssignmentWithContext(ctx context.Context, updateTrustedProfileAssignmentOptions *UpdateTrustedProfileAssignmentOptions) (result *TemplateAssignmentResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateTrustedProfileAssignmentOptions, "updateTrustedProfileAssignmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateTrustedProfileAssignmentOptions, "updateTrustedProfileAssignmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4221,6 +4948,7 @@ func (iamIdentity *IamIdentityV1) UpdateTrustedProfileAssignmentWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_assignments/{assignment_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4244,22 +4972,27 @@ func (iamIdentity *IamIdentityV1) UpdateTrustedProfileAssignmentWithContext(ctx } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_trusted_profile_assignment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4271,13 +5004,16 @@ func (iamIdentity *IamIdentityV1) UpdateTrustedProfileAssignmentWithContext(ctx // ListProfileTemplates : List trusted profile templates // List the trusted profile templates in an enterprise account. func (iamIdentity *IamIdentityV1) ListProfileTemplates(listProfileTemplatesOptions *ListProfileTemplatesOptions) (result *TrustedProfileTemplateList, response *core.DetailedResponse, err error) { - return iamIdentity.ListProfileTemplatesWithContext(context.Background(), listProfileTemplatesOptions) + result, response, err = iamIdentity.ListProfileTemplatesWithContext(context.Background(), listProfileTemplatesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListProfileTemplatesWithContext is an alternate form of the ListProfileTemplates method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListProfileTemplatesWithContext(ctx context.Context, listProfileTemplatesOptions *ListProfileTemplatesOptions) (result *TrustedProfileTemplateList, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listProfileTemplatesOptions, "listProfileTemplatesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4286,6 +5022,7 @@ func (iamIdentity *IamIdentityV1) ListProfileTemplatesWithContext(ctx context.Co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4320,17 +5057,21 @@ func (iamIdentity *IamIdentityV1) ListProfileTemplatesWithContext(ctx context.Co request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_profile_templates", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4342,17 +5083,21 @@ func (iamIdentity *IamIdentityV1) ListProfileTemplatesWithContext(ctx context.Co // CreateProfileTemplate : Create a trusted profile template // Create a new trusted profile template in an enterprise account. func (iamIdentity *IamIdentityV1) CreateProfileTemplate(createProfileTemplateOptions *CreateProfileTemplateOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.CreateProfileTemplateWithContext(context.Background(), createProfileTemplateOptions) + result, response, err = iamIdentity.CreateProfileTemplateWithContext(context.Background(), createProfileTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateProfileTemplateWithContext is an alternate form of the CreateProfileTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateProfileTemplateWithContext(ctx context.Context, createProfileTemplateOptions *CreateProfileTemplateOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createProfileTemplateOptions, "createProfileTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createProfileTemplateOptions, "createProfileTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4361,6 +5106,7 @@ func (iamIdentity *IamIdentityV1) CreateProfileTemplateWithContext(ctx context.C builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4393,22 +5139,27 @@ func (iamIdentity *IamIdentityV1) CreateProfileTemplateWithContext(ctx context.C } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_profile_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4420,17 +5171,21 @@ func (iamIdentity *IamIdentityV1) CreateProfileTemplateWithContext(ctx context.C // GetLatestProfileTemplateVersion : Get latest version of a trusted profile template // Get the latest version of a trusted profile template in an enterprise account. func (iamIdentity *IamIdentityV1) GetLatestProfileTemplateVersion(getLatestProfileTemplateVersionOptions *GetLatestProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetLatestProfileTemplateVersionWithContext(context.Background(), getLatestProfileTemplateVersionOptions) + result, response, err = iamIdentity.GetLatestProfileTemplateVersionWithContext(context.Background(), getLatestProfileTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetLatestProfileTemplateVersionWithContext is an alternate form of the GetLatestProfileTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetLatestProfileTemplateVersionWithContext(ctx context.Context, getLatestProfileTemplateVersionOptions *GetLatestProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getLatestProfileTemplateVersionOptions, "getLatestProfileTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLatestProfileTemplateVersionOptions, "getLatestProfileTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4443,6 +5198,7 @@ func (iamIdentity *IamIdentityV1) GetLatestProfileTemplateVersionWithContext(ctx builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4462,17 +5218,21 @@ func (iamIdentity *IamIdentityV1) GetLatestProfileTemplateVersionWithContext(ctx request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_latest_profile_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4485,17 +5245,21 @@ func (iamIdentity *IamIdentityV1) GetLatestProfileTemplateVersionWithContext(ctx // Delete all versions of a trusted profile template in an enterprise account. If any version is assigned to child // accounts, you must first delete the assignment. func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfProfileTemplate(deleteAllVersionsOfProfileTemplateOptions *DeleteAllVersionsOfProfileTemplateOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteAllVersionsOfProfileTemplateWithContext(context.Background(), deleteAllVersionsOfProfileTemplateOptions) + response, err = iamIdentity.DeleteAllVersionsOfProfileTemplateWithContext(context.Background(), deleteAllVersionsOfProfileTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteAllVersionsOfProfileTemplateWithContext is an alternate form of the DeleteAllVersionsOfProfileTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfProfileTemplateWithContext(ctx context.Context, deleteAllVersionsOfProfileTemplateOptions *DeleteAllVersionsOfProfileTemplateOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteAllVersionsOfProfileTemplateOptions, "deleteAllVersionsOfProfileTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteAllVersionsOfProfileTemplateOptions, "deleteAllVersionsOfProfileTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4508,6 +5272,7 @@ func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfProfileTemplateWithContext( builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4522,10 +5287,16 @@ func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfProfileTemplateWithContext( request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_all_versions_of_profile_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4533,17 +5304,21 @@ func (iamIdentity *IamIdentityV1) DeleteAllVersionsOfProfileTemplateWithContext( // ListVersionsOfProfileTemplate : List trusted profile template versions // List the versions of a trusted profile template in an enterprise account. func (iamIdentity *IamIdentityV1) ListVersionsOfProfileTemplate(listVersionsOfProfileTemplateOptions *ListVersionsOfProfileTemplateOptions) (result *TrustedProfileTemplateList, response *core.DetailedResponse, err error) { - return iamIdentity.ListVersionsOfProfileTemplateWithContext(context.Background(), listVersionsOfProfileTemplateOptions) + result, response, err = iamIdentity.ListVersionsOfProfileTemplateWithContext(context.Background(), listVersionsOfProfileTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVersionsOfProfileTemplateWithContext is an alternate form of the ListVersionsOfProfileTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) ListVersionsOfProfileTemplateWithContext(ctx context.Context, listVersionsOfProfileTemplateOptions *ListVersionsOfProfileTemplateOptions) (result *TrustedProfileTemplateList, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVersionsOfProfileTemplateOptions, "listVersionsOfProfileTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVersionsOfProfileTemplateOptions, "listVersionsOfProfileTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4556,6 +5331,7 @@ func (iamIdentity *IamIdentityV1) ListVersionsOfProfileTemplateWithContext(ctx c builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}/versions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4587,17 +5363,21 @@ func (iamIdentity *IamIdentityV1) ListVersionsOfProfileTemplateWithContext(ctx c request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "list_versions_of_profile_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateList) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4609,17 +5389,21 @@ func (iamIdentity *IamIdentityV1) ListVersionsOfProfileTemplateWithContext(ctx c // CreateProfileTemplateVersion : Create new version of a trusted profile template // Create a new version of a trusted profile template in an enterprise account. func (iamIdentity *IamIdentityV1) CreateProfileTemplateVersion(createProfileTemplateVersionOptions *CreateProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.CreateProfileTemplateVersionWithContext(context.Background(), createProfileTemplateVersionOptions) + result, response, err = iamIdentity.CreateProfileTemplateVersionWithContext(context.Background(), createProfileTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateProfileTemplateVersionWithContext is an alternate form of the CreateProfileTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) CreateProfileTemplateVersionWithContext(ctx context.Context, createProfileTemplateVersionOptions *CreateProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createProfileTemplateVersionOptions, "createProfileTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createProfileTemplateVersionOptions, "createProfileTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4632,6 +5416,7 @@ func (iamIdentity *IamIdentityV1) CreateProfileTemplateVersionWithContext(ctx co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}/versions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4664,22 +5449,27 @@ func (iamIdentity *IamIdentityV1) CreateProfileTemplateVersionWithContext(ctx co } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_profile_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4691,23 +5481,27 @@ func (iamIdentity *IamIdentityV1) CreateProfileTemplateVersionWithContext(ctx co // GetProfileTemplateVersion : Get version of trusted profile template // Get a specific version of a trusted profile template in an enterprise account. func (iamIdentity *IamIdentityV1) GetProfileTemplateVersion(getProfileTemplateVersionOptions *GetProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.GetProfileTemplateVersionWithContext(context.Background(), getProfileTemplateVersionOptions) + result, response, err = iamIdentity.GetProfileTemplateVersionWithContext(context.Background(), getProfileTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetProfileTemplateVersionWithContext is an alternate form of the GetProfileTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) GetProfileTemplateVersionWithContext(ctx context.Context, getProfileTemplateVersionOptions *GetProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getProfileTemplateVersionOptions, "getProfileTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getProfileTemplateVersionOptions, "getProfileTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *getProfileTemplateVersionOptions.TemplateID, - "version": *getProfileTemplateVersionOptions.Version, + "version": *getProfileTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.GET) @@ -4715,6 +5509,7 @@ func (iamIdentity *IamIdentityV1) GetProfileTemplateVersionWithContext(ctx conte builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}/versions/{version}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4734,17 +5529,21 @@ func (iamIdentity *IamIdentityV1) GetProfileTemplateVersionWithContext(ctx conte request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "get_profile_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4756,23 +5555,27 @@ func (iamIdentity *IamIdentityV1) GetProfileTemplateVersionWithContext(ctx conte // UpdateProfileTemplateVersion : Update version of trusted profile template // Update a specific version of a trusted profile template in an enterprise account. func (iamIdentity *IamIdentityV1) UpdateProfileTemplateVersion(updateProfileTemplateVersionOptions *UpdateProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { - return iamIdentity.UpdateProfileTemplateVersionWithContext(context.Background(), updateProfileTemplateVersionOptions) + result, response, err = iamIdentity.UpdateProfileTemplateVersionWithContext(context.Background(), updateProfileTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateProfileTemplateVersionWithContext is an alternate form of the UpdateProfileTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) UpdateProfileTemplateVersionWithContext(ctx context.Context, updateProfileTemplateVersionOptions *UpdateProfileTemplateVersionOptions) (result *TrustedProfileTemplateResponse, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateProfileTemplateVersionOptions, "updateProfileTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateProfileTemplateVersionOptions, "updateProfileTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *updateProfileTemplateVersionOptions.TemplateID, - "version": *updateProfileTemplateVersionOptions.Version, + "version": *updateProfileTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.PUT) @@ -4780,6 +5583,7 @@ func (iamIdentity *IamIdentityV1) UpdateProfileTemplateVersionWithContext(ctx co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}/versions/{version}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4815,22 +5619,27 @@ func (iamIdentity *IamIdentityV1) UpdateProfileTemplateVersionWithContext(ctx co } _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = iamIdentity.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "update_profile_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfileTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4843,23 +5652,27 @@ func (iamIdentity *IamIdentityV1) UpdateProfileTemplateVersionWithContext(ctx co // Delete a specific version of a trusted profile template in an enterprise account. If the version is assigned to child // accounts, you must first delete the assignment. func (iamIdentity *IamIdentityV1) DeleteProfileTemplateVersion(deleteProfileTemplateVersionOptions *DeleteProfileTemplateVersionOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.DeleteProfileTemplateVersionWithContext(context.Background(), deleteProfileTemplateVersionOptions) + response, err = iamIdentity.DeleteProfileTemplateVersionWithContext(context.Background(), deleteProfileTemplateVersionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteProfileTemplateVersionWithContext is an alternate form of the DeleteProfileTemplateVersion method which supports a Context parameter func (iamIdentity *IamIdentityV1) DeleteProfileTemplateVersionWithContext(ctx context.Context, deleteProfileTemplateVersionOptions *DeleteProfileTemplateVersionOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteProfileTemplateVersionOptions, "deleteProfileTemplateVersionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteProfileTemplateVersionOptions, "deleteProfileTemplateVersionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *deleteProfileTemplateVersionOptions.TemplateID, - "version": *deleteProfileTemplateVersionOptions.Version, + "version": *deleteProfileTemplateVersionOptions.Version, } builder := core.NewRequestBuilder(core.DELETE) @@ -4867,6 +5680,7 @@ func (iamIdentity *IamIdentityV1) DeleteProfileTemplateVersionWithContext(ctx co builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}/versions/{version}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4881,10 +5695,16 @@ func (iamIdentity *IamIdentityV1) DeleteProfileTemplateVersionWithContext(ctx co request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_profile_template_version", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4893,23 +5713,27 @@ func (iamIdentity *IamIdentityV1) DeleteProfileTemplateVersionWithContext(ctx co // Commit a specific version of a trusted profile template in an enterprise account. You must commit a template before // you can assign it to child accounts. Once a template is committed, you can no longer modify the template. func (iamIdentity *IamIdentityV1) CommitProfileTemplate(commitProfileTemplateOptions *CommitProfileTemplateOptions) (response *core.DetailedResponse, err error) { - return iamIdentity.CommitProfileTemplateWithContext(context.Background(), commitProfileTemplateOptions) + response, err = iamIdentity.CommitProfileTemplateWithContext(context.Background(), commitProfileTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CommitProfileTemplateWithContext is an alternate form of the CommitProfileTemplate method which supports a Context parameter func (iamIdentity *IamIdentityV1) CommitProfileTemplateWithContext(ctx context.Context, commitProfileTemplateOptions *CommitProfileTemplateOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(commitProfileTemplateOptions, "commitProfileTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(commitProfileTemplateOptions, "commitProfileTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ "template_id": *commitProfileTemplateOptions.TemplateID, - "version": *commitProfileTemplateOptions.Version, + "version": *commitProfileTemplateOptions.Version, } builder := core.NewRequestBuilder(core.POST) @@ -4917,6 +5741,7 @@ func (iamIdentity *IamIdentityV1) CommitProfileTemplateWithContext(ctx context.C builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profile_templates/{template_id}/versions/{version}/commit`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4931,13 +5756,22 @@ func (iamIdentity *IamIdentityV1) CommitProfileTemplateWithContext(ctx context.C request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = iamIdentity.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "commit_profile_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } +func getServiceComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent(DefaultServiceName, "1.0.0") +} // AccountBasedMfaEnrollment : AccountBasedMfaEnrollment struct type AccountBasedMfaEnrollment struct { @@ -4956,18 +5790,22 @@ func UnmarshalAccountBasedMfaEnrollment(m map[string]json.RawMessage, result int obj := new(AccountBasedMfaEnrollment) err = core.UnmarshalModel(m, "security_questions", &obj.SecurityQuestions, UnmarshalMfaEnrollmentTypeStatus) if err != nil { + err = core.SDKErrorf(err, "", "security_questions-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "totp", &obj.Totp, UnmarshalMfaEnrollmentTypeStatus) if err != nil { + err = core.SDKErrorf(err, "", "totp-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "verisign", &obj.Verisign, UnmarshalMfaEnrollmentTypeStatus) if err != nil { + err = core.SDKErrorf(err, "", "verisign-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "complies", &obj.Complies) if err != nil { + err = core.SDKErrorf(err, "", "complies-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5033,44 +5871,45 @@ type AccountSettingsComponent struct { // Constants associated with the AccountSettingsComponent.RestrictCreateServiceID property. // Defines whether or not creating a service ID is access controlled. Valid values: -// * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service +// - RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service +// // IDs, including the account owner -// * NOT_RESTRICTED - all members of an account can create service IDs -// * NOT_SET - to 'unset' a previous set value. +// - NOT_RESTRICTED - all members of an account can create service IDs +// - NOT_SET - to 'unset' a previous set value. const ( AccountSettingsComponentRestrictCreateServiceIDNotRestrictedConst = "NOT_RESTRICTED" - AccountSettingsComponentRestrictCreateServiceIDNotSetConst = "NOT_SET" - AccountSettingsComponentRestrictCreateServiceIDRestrictedConst = "RESTRICTED" + AccountSettingsComponentRestrictCreateServiceIDNotSetConst = "NOT_SET" + AccountSettingsComponentRestrictCreateServiceIDRestrictedConst = "RESTRICTED" ) // Constants associated with the AccountSettingsComponent.RestrictCreatePlatformApikey property. // Defines whether or not creating platform API keys is access controlled. Valid values: -// * RESTRICTED - to apply access control -// * NOT_RESTRICTED - to remove access control -// * NOT_SET - to 'unset' a previous set value. +// - RESTRICTED - to apply access control +// - NOT_RESTRICTED - to remove access control +// - NOT_SET - to 'unset' a previous set value. const ( AccountSettingsComponentRestrictCreatePlatformApikeyNotRestrictedConst = "NOT_RESTRICTED" - AccountSettingsComponentRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" - AccountSettingsComponentRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" + AccountSettingsComponentRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" + AccountSettingsComponentRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" ) // Constants associated with the AccountSettingsComponent.Mfa property. // Defines the MFA trait for the account. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - AccountSettingsComponentMfaLevel1Const = "LEVEL1" - AccountSettingsComponentMfaLevel2Const = "LEVEL2" - AccountSettingsComponentMfaLevel3Const = "LEVEL3" - AccountSettingsComponentMfaNoneConst = "NONE" + AccountSettingsComponentMfaLevel1Const = "LEVEL1" + AccountSettingsComponentMfaLevel2Const = "LEVEL2" + AccountSettingsComponentMfaLevel3Const = "LEVEL3" + AccountSettingsComponentMfaNoneConst = "NONE" AccountSettingsComponentMfaNoneNoRopcConst = "NONE_NO_ROPC" - AccountSettingsComponentMfaTotpConst = "TOTP" - AccountSettingsComponentMfaTotp4allConst = "TOTP4ALL" + AccountSettingsComponentMfaTotpConst = "TOTP" + AccountSettingsComponentMfaTotp4allConst = "TOTP4ALL" ) // UnmarshalAccountSettingsComponent unmarshals an instance of AccountSettingsComponent from the specified map of raw messages. @@ -5078,42 +5917,52 @@ func UnmarshalAccountSettingsComponent(m map[string]json.RawMessage, result inte obj := new(AccountSettingsComponent) err = core.UnmarshalPrimitive(m, "restrict_create_service_id", &obj.RestrictCreateServiceID) if err != nil { + err = core.SDKErrorf(err, "", "restrict_create_service_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "restrict_create_platform_apikey", &obj.RestrictCreatePlatformApikey) if err != nil { + err = core.SDKErrorf(err, "", "restrict_create_platform_apikey-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "allowed_ip_addresses", &obj.AllowedIPAddresses) if err != nil { + err = core.SDKErrorf(err, "", "allowed_ip_addresses-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mfa", &obj.Mfa) if err != nil { + err = core.SDKErrorf(err, "", "mfa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "user_mfa", &obj.UserMfa, UnmarshalAccountSettingsUserMfa) if err != nil { + err = core.SDKErrorf(err, "", "user_mfa-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "session_expiration_in_seconds", &obj.SessionExpirationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "session_expiration_in_seconds-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "session_invalidation_in_seconds", &obj.SessionInvalidationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "session_invalidation_in_seconds-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_sessions_per_identity", &obj.MaxSessionsPerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "max_sessions_per_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "system_access_token_expiration_in_seconds", &obj.SystemAccessTokenExpirationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "system_access_token_expiration_in_seconds-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "system_refresh_token_expiration_in_seconds", &obj.SystemRefreshTokenExpirationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "system_refresh_token_expiration_in_seconds-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5191,44 +6040,45 @@ type AccountSettingsResponse struct { // Constants associated with the AccountSettingsResponse.RestrictCreateServiceID property. // Defines whether or not creating a service ID is access controlled. Valid values: -// * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service +// - RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service +// // IDs, including the account owner -// * NOT_RESTRICTED - all members of an account can create service IDs -// * NOT_SET - to 'unset' a previous set value. +// - NOT_RESTRICTED - all members of an account can create service IDs +// - NOT_SET - to 'unset' a previous set value. const ( AccountSettingsResponseRestrictCreateServiceIDNotRestrictedConst = "NOT_RESTRICTED" - AccountSettingsResponseRestrictCreateServiceIDNotSetConst = "NOT_SET" - AccountSettingsResponseRestrictCreateServiceIDRestrictedConst = "RESTRICTED" + AccountSettingsResponseRestrictCreateServiceIDNotSetConst = "NOT_SET" + AccountSettingsResponseRestrictCreateServiceIDRestrictedConst = "RESTRICTED" ) // Constants associated with the AccountSettingsResponse.RestrictCreatePlatformApikey property. // Defines whether or not creating platform API keys is access controlled. Valid values: -// * RESTRICTED - to apply access control -// * NOT_RESTRICTED - to remove access control -// * NOT_SET - to 'unset' a previous set value. +// - RESTRICTED - to apply access control +// - NOT_RESTRICTED - to remove access control +// - NOT_SET - to 'unset' a previous set value. const ( AccountSettingsResponseRestrictCreatePlatformApikeyNotRestrictedConst = "NOT_RESTRICTED" - AccountSettingsResponseRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" - AccountSettingsResponseRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" + AccountSettingsResponseRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" + AccountSettingsResponseRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" ) // Constants associated with the AccountSettingsResponse.Mfa property. // Defines the MFA trait for the account. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - AccountSettingsResponseMfaLevel1Const = "LEVEL1" - AccountSettingsResponseMfaLevel2Const = "LEVEL2" - AccountSettingsResponseMfaLevel3Const = "LEVEL3" - AccountSettingsResponseMfaNoneConst = "NONE" + AccountSettingsResponseMfaLevel1Const = "LEVEL1" + AccountSettingsResponseMfaLevel2Const = "LEVEL2" + AccountSettingsResponseMfaLevel3Const = "LEVEL3" + AccountSettingsResponseMfaNoneConst = "NONE" AccountSettingsResponseMfaNoneNoRopcConst = "NONE_NO_ROPC" - AccountSettingsResponseMfaTotpConst = "TOTP" - AccountSettingsResponseMfaTotp4allConst = "TOTP4ALL" + AccountSettingsResponseMfaTotpConst = "TOTP" + AccountSettingsResponseMfaTotp4allConst = "TOTP4ALL" ) // UnmarshalAccountSettingsResponse unmarshals an instance of AccountSettingsResponse from the specified map of raw messages. @@ -5236,58 +6086,72 @@ func UnmarshalAccountSettingsResponse(m map[string]json.RawMessage, result inter obj := new(AccountSettingsResponse) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "restrict_create_service_id", &obj.RestrictCreateServiceID) if err != nil { + err = core.SDKErrorf(err, "", "restrict_create_service_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "restrict_create_platform_apikey", &obj.RestrictCreatePlatformApikey) if err != nil { + err = core.SDKErrorf(err, "", "restrict_create_platform_apikey-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "allowed_ip_addresses", &obj.AllowedIPAddresses) if err != nil { + err = core.SDKErrorf(err, "", "allowed_ip_addresses-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mfa", &obj.Mfa) if err != nil { + err = core.SDKErrorf(err, "", "mfa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "user_mfa", &obj.UserMfa, UnmarshalAccountSettingsUserMfa) if err != nil { + err = core.SDKErrorf(err, "", "user_mfa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "session_expiration_in_seconds", &obj.SessionExpirationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "session_expiration_in_seconds-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "session_invalidation_in_seconds", &obj.SessionInvalidationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "session_invalidation_in_seconds-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_sessions_per_identity", &obj.MaxSessionsPerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "max_sessions_per_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "system_access_token_expiration_in_seconds", &obj.SystemAccessTokenExpirationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "system_access_token_expiration_in_seconds-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "system_refresh_token_expiration_in_seconds", &obj.SystemRefreshTokenExpirationInSeconds) if err != nil { + err = core.SDKErrorf(err, "", "system_refresh_token_expiration_in_seconds-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5325,30 +6189,37 @@ func UnmarshalAccountSettingsTemplateList(m map[string]json.RawMessage, result i obj := new(AccountSettingsTemplateList) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "first", &obj.First) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) if err != nil { + err = core.SDKErrorf(err, "", "previous-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next", &obj.Next) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "account_settings_templates", &obj.AccountSettingsTemplates, UnmarshalAccountSettingsTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "account_settings_templates-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5404,58 +6275,72 @@ func UnmarshalAccountSettingsTemplateResponse(m map[string]json.RawMessage, resu obj := new(AccountSettingsTemplateResponse) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "committed", &obj.Committed) if err != nil { + err = core.SDKErrorf(err, "", "committed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "account_settings", &obj.AccountSettings, UnmarshalAccountSettingsComponent) if err != nil { + err = core.SDKErrorf(err, "", "account_settings-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_by_id", &obj.CreatedByID) if err != nil { + err = core.SDKErrorf(err, "", "created_by_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_modified_at", &obj.LastModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_modified_by_id", &obj.LastModifiedByID) if err != nil { + err = core.SDKErrorf(err, "", "last_modified_by_id-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5480,30 +6365,33 @@ type AccountSettingsUserMfa struct { // Constants associated with the AccountSettingsUserMfa.Mfa property. // Defines the MFA requirement for the user. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - AccountSettingsUserMfaMfaLevel1Const = "LEVEL1" - AccountSettingsUserMfaMfaLevel2Const = "LEVEL2" - AccountSettingsUserMfaMfaLevel3Const = "LEVEL3" - AccountSettingsUserMfaMfaNoneConst = "NONE" + AccountSettingsUserMfaMfaLevel1Const = "LEVEL1" + AccountSettingsUserMfaMfaLevel2Const = "LEVEL2" + AccountSettingsUserMfaMfaLevel3Const = "LEVEL3" + AccountSettingsUserMfaMfaNoneConst = "NONE" AccountSettingsUserMfaMfaNoneNoRopcConst = "NONE_NO_ROPC" - AccountSettingsUserMfaMfaTotpConst = "TOTP" - AccountSettingsUserMfaMfaTotp4allConst = "TOTP4ALL" + AccountSettingsUserMfaMfaTotpConst = "TOTP" + AccountSettingsUserMfaMfaTotp4allConst = "TOTP4ALL" ) // NewAccountSettingsUserMfa : Instantiate AccountSettingsUserMfa (Generic Model Constructor) func (*IamIdentityV1) NewAccountSettingsUserMfa(iamID string, mfa string) (_model *AccountSettingsUserMfa, err error) { _model = &AccountSettingsUserMfa{ IamID: core.StringPtr(iamID), - Mfa: core.StringPtr(mfa), + Mfa: core.StringPtr(mfa), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -5512,10 +6400,12 @@ func UnmarshalAccountSettingsUserMfa(m map[string]json.RawMessage, result interf obj := new(AccountSettingsUserMfa) err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mfa", &obj.Mfa) if err != nil { + err = core.SDKErrorf(err, "", "mfa-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5536,10 +6426,12 @@ func UnmarshalActivity(m map[string]json.RawMessage, result interface{}) (err er obj := new(Activity) err = core.UnmarshalPrimitive(m, "last_authn", &obj.LastAuthn) if err != nil { + err = core.SDKErrorf(err, "", "last_authn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "authn_count", &obj.AuthnCount) if err != nil { + err = core.SDKErrorf(err, "", "authn_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5565,6 +6457,9 @@ type APIKey struct { // The API key cannot be changed if set to true. Locked *bool `json:"locked" validate:"required"` + // Defines if API key is disabled, API key cannot be used if 'disabled' is set to true. + Disabled *bool `json:"disabled,omitempty"` + // If set contains a date time string of the creation date in ISO format. CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` @@ -5578,6 +6473,12 @@ type APIKey struct { // Access is done via the UUID of the API key. Name *string `json:"name" validate:"required"` + // Defines if the API key supports sessions. Sessions are only supported for user apikeys. + SupportSessions *bool `json:"support_sessions,omitempty"` + + // Defines the action to take when API key is leaked, valid values are 'none', 'disable' and 'delete'. + ActionWhenLeaked *string `json:"action_when_leaked,omitempty"` + // The optional description of the API key. The 'description' property is only available if a description was provided // during a create of an API key. Description *string `json:"description,omitempty"` @@ -5605,62 +6506,92 @@ func UnmarshalAPIKey(m map[string]json.RawMessage, result interface{}) (err erro obj := new(APIKey) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "locked", &obj.Locked) if err != nil { + err = core.SDKErrorf(err, "", "locked-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "disabled", &obj.Disabled) + if err != nil { + err = core.SDKErrorf(err, "", "disabled-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "support_sessions", &obj.SupportSessions) + if err != nil { + err = core.SDKErrorf(err, "", "support_sessions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "action_when_leaked", &obj.ActionWhenLeaked) + if err != nil { + err = core.SDKErrorf(err, "", "action_when_leaked-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) if err != nil { + err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "activity", &obj.Activity, UnmarshalActivity) if err != nil { + err = core.SDKErrorf(err, "", "activity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5677,9 +6608,10 @@ type APIKeyInsideCreateServiceIDRequest struct { // during a create of an API key. Description *string `json:"description,omitempty"` - // You can optionally passthrough the API key value for this API key. If passed, NO validation of that apiKey value is - // done, i.e. the value can be non-URL safe. If omitted, the API key management will create an URL safe opaque API key - // value. The value of the API key is checked for uniqueness. Please ensure enough variations when passing in this + // You can optionally passthrough the API key value for this API key. If passed, a minimum length validation of 32 + // characters for that apiKey value is done, i.e. the value can contain any characters and can even be non-URL safe, + // but the minimum length requirement must be met. If omitted, the API key management will create an URL safe opaque + // API key value. The value of the API key is checked for uniqueness. Ensure enough variations when passing in this // value. Apikey *string `json:"apikey,omitempty"` @@ -5695,6 +6627,9 @@ func (*IamIdentityV1) NewAPIKeyInsideCreateServiceIDRequest(name string) (_model Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -5703,18 +6638,22 @@ func UnmarshalAPIKeyInsideCreateServiceIDRequest(m map[string]json.RawMessage, r obj := new(APIKeyInsideCreateServiceIDRequest) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) if err != nil { + err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "store_value", &obj.StoreValue) if err != nil { + err = core.SDKErrorf(err, "", "store_value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5752,30 +6691,37 @@ func UnmarshalAPIKeyList(m map[string]json.RawMessage, result interface{}) (err obj := new(APIKeyList) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "first", &obj.First) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) if err != nil { + err = core.SDKErrorf(err, "", "previous-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next", &obj.Next) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "apikeys", &obj.Apikeys, UnmarshalAPIKey) if err != nil { + err = core.SDKErrorf(err, "", "apikeys-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5808,26 +6754,32 @@ func UnmarshalApikeyActivity(m map[string]json.RawMessage, result interface{}) ( obj := new(ApikeyActivity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "serviceid", &obj.Serviceid, UnmarshalApikeyActivityServiceid) if err != nil { + err = core.SDKErrorf(err, "", "serviceid-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "user", &obj.User, UnmarshalApikeyActivityUser) if err != nil { + err = core.SDKErrorf(err, "", "user-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_authn", &obj.LastAuthn) if err != nil { + err = core.SDKErrorf(err, "", "last_authn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5848,10 +6800,12 @@ func UnmarshalApikeyActivityServiceid(m map[string]json.RawMessage, result inter obj := new(ApikeyActivityServiceid) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5878,18 +6832,22 @@ func UnmarshalApikeyActivityUser(m map[string]json.RawMessage, result interface{ obj := new(ApikeyActivityUser) err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "email", &obj.Email) if err != nil { + err = core.SDKErrorf(err, "", "email-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -5912,7 +6870,7 @@ type CommitAccountSettingsTemplateOptions struct { func (*IamIdentityV1) NewCommitAccountSettingsTemplateOptions(templateID string, version string) *CommitAccountSettingsTemplateOptions { return &CommitAccountSettingsTemplateOptions{ TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -5950,7 +6908,7 @@ type CommitProfileTemplateOptions struct { func (*IamIdentityV1) NewCommitProfileTemplateOptions(templateID string, version string) *CommitProfileTemplateOptions { return &CommitProfileTemplateOptions{ TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -5993,17 +6951,17 @@ type CreateAccountSettingsAssignmentOptions struct { // Constants associated with the CreateAccountSettingsAssignmentOptions.TargetType property. // Type of target to deploy to. const ( - CreateAccountSettingsAssignmentOptionsTargetTypeAccountConst = "Account" + CreateAccountSettingsAssignmentOptionsTargetTypeAccountConst = "Account" CreateAccountSettingsAssignmentOptionsTargetTypeAccountgroupConst = "AccountGroup" ) // NewCreateAccountSettingsAssignmentOptions : Instantiate CreateAccountSettingsAssignmentOptions func (*IamIdentityV1) NewCreateAccountSettingsAssignmentOptions(templateID string, templateVersion int64, targetType string, target string) *CreateAccountSettingsAssignmentOptions { return &CreateAccountSettingsAssignmentOptions{ - TemplateID: core.StringPtr(templateID), + TemplateID: core.StringPtr(templateID), TemplateVersion: core.Int64Ptr(templateVersion), - TargetType: core.StringPtr(targetType), - Target: core.StringPtr(target), + TargetType: core.StringPtr(targetType), + Target: core.StringPtr(target), } } @@ -6168,9 +7126,11 @@ type CreateAPIKeyOptions struct { // The account ID of the API key. AccountID *string `json:"account_id,omitempty"` - // You can optionally passthrough the API key value for this API key. If passed, NO validation of that apiKey value is - // done, i.e. the value can be non-URL safe. If omitted, the API key management will create an URL safe opaque API key - // value. The value of the API key is checked for uniqueness. Ensure enough variations when passing in this value. + // You can optionally passthrough the API key value for this API key. If passed, a minimum length validation of 32 + // characters for that apiKey value is done, i.e. the value can contain any characters and can even be non-URL safe, + // but the minimum length requirement must be met. If omitted, the API key management will create an URL safe opaque + // API key value. The value of the API key is checked for uniqueness. Ensure enough variations when passing in this + // value. Apikey *string `json:"apikey,omitempty"` // Send true or false to set whether the API key value is retrievable in the future by using the Get details of an API @@ -6178,9 +7138,18 @@ type CreateAPIKeyOptions struct { // of API keys for users. StoreValue *bool `json:"store_value,omitempty"` + // Defines if the API key supports sessions. Sessions are only supported for user apikeys. + SupportSessions *bool `json:"support_sessions,omitempty"` + + // Defines the action to take when API key is leaked, valid values are 'none', 'disable' and 'delete'. + ActionWhenLeaked *string `json:"action_when_leaked,omitempty"` + // Indicates if the API key is locked for further write operations. False by default. EntityLock *string `json:"Entity-Lock,omitempty"` + // Indicates if the API key is disabled. False by default. + EntityDisable *string `json:"Entity-Disable,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -6188,7 +7157,7 @@ type CreateAPIKeyOptions struct { // NewCreateAPIKeyOptions : Instantiate CreateAPIKeyOptions func (*IamIdentityV1) NewCreateAPIKeyOptions(name string, iamID string) *CreateAPIKeyOptions { return &CreateAPIKeyOptions{ - Name: core.StringPtr(name), + Name: core.StringPtr(name), IamID: core.StringPtr(iamID), } } @@ -6229,12 +7198,30 @@ func (_options *CreateAPIKeyOptions) SetStoreValue(storeValue bool) *CreateAPIKe return _options } +// SetSupportSessions : Allow user to set SupportSessions +func (_options *CreateAPIKeyOptions) SetSupportSessions(supportSessions bool) *CreateAPIKeyOptions { + _options.SupportSessions = core.BoolPtr(supportSessions) + return _options +} + +// SetActionWhenLeaked : Allow user to set ActionWhenLeaked +func (_options *CreateAPIKeyOptions) SetActionWhenLeaked(actionWhenLeaked string) *CreateAPIKeyOptions { + _options.ActionWhenLeaked = core.StringPtr(actionWhenLeaked) + return _options +} + // SetEntityLock : Allow user to set EntityLock func (_options *CreateAPIKeyOptions) SetEntityLock(entityLock string) *CreateAPIKeyOptions { _options.EntityLock = core.StringPtr(entityLock) return _options } +// SetEntityDisable : Allow user to set EntityDisable +func (_options *CreateAPIKeyOptions) SetEntityDisable(entityDisable string) *CreateAPIKeyOptions { + _options.EntityDisable = core.StringPtr(entityDisable) + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateAPIKeyOptions) SetHeaders(param map[string]string) *CreateAPIKeyOptions { options.Headers = param @@ -6276,8 +7263,8 @@ type CreateClaimRuleOptions struct { // NewCreateClaimRuleOptions : Instantiate CreateClaimRuleOptions func (*IamIdentityV1) NewCreateClaimRuleOptions(profileID string, typeVar string, conditions []ProfileClaimRuleConditions) *CreateClaimRuleOptions { return &CreateClaimRuleOptions{ - ProfileID: core.StringPtr(profileID), - Type: core.StringPtr(typeVar), + ProfileID: core.StringPtr(profileID), + Type: core.StringPtr(typeVar), Conditions: conditions, } } @@ -6358,8 +7345,8 @@ type CreateLinkOptions struct { func (*IamIdentityV1) NewCreateLinkOptions(profileID string, crType string, link *CreateProfileLinkRequestLink) *CreateLinkOptions { return &CreateLinkOptions{ ProfileID: core.StringPtr(profileID), - CrType: core.StringPtr(crType), - Link: link, + CrType: core.StringPtr(crType), + Link: link, } } @@ -6445,10 +7432,13 @@ type CreateProfileLinkRequestLink struct { // NewCreateProfileLinkRequestLink : Instantiate CreateProfileLinkRequestLink (Generic Model Constructor) func (*IamIdentityV1) NewCreateProfileLinkRequestLink(crn string, namespace string) (_model *CreateProfileLinkRequestLink, err error) { _model = &CreateProfileLinkRequestLink{ - CRN: core.StringPtr(crn), + CRN: core.StringPtr(crn), Namespace: core.StringPtr(namespace), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -6457,14 +7447,17 @@ func UnmarshalCreateProfileLinkRequestLink(m map[string]json.RawMessage, result obj := new(CreateProfileLinkRequestLink) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) if err != nil { + err = core.SDKErrorf(err, "", "namespace-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -6491,7 +7484,7 @@ type CreateProfileOptions struct { // NewCreateProfileOptions : Instantiate CreateProfileOptions func (*IamIdentityV1) NewCreateProfileOptions(name string, accountID string) *CreateProfileOptions { return &CreateProfileOptions{ - Name: core.StringPtr(name), + Name: core.StringPtr(name), AccountID: core.StringPtr(accountID), } } @@ -6736,7 +7729,7 @@ type CreateServiceIDOptions struct { func (*IamIdentityV1) NewCreateServiceIDOptions(accountID string, name string) *CreateServiceIDOptions { return &CreateServiceIDOptions{ AccountID: core.StringPtr(accountID), - Name: core.StringPtr(name), + Name: core.StringPtr(name), } } @@ -6803,17 +7796,17 @@ type CreateTrustedProfileAssignmentOptions struct { // Constants associated with the CreateTrustedProfileAssignmentOptions.TargetType property. // Type of target to deploy to. const ( - CreateTrustedProfileAssignmentOptionsTargetTypeAccountConst = "Account" + CreateTrustedProfileAssignmentOptionsTargetTypeAccountConst = "Account" CreateTrustedProfileAssignmentOptionsTargetTypeAccountgroupConst = "AccountGroup" ) // NewCreateTrustedProfileAssignmentOptions : Instantiate CreateTrustedProfileAssignmentOptions func (*IamIdentityV1) NewCreateTrustedProfileAssignmentOptions(templateID string, templateVersion int64, targetType string, target string) *CreateTrustedProfileAssignmentOptions { return &CreateTrustedProfileAssignmentOptions{ - TemplateID: core.StringPtr(templateID), + TemplateID: core.StringPtr(templateID), TemplateVersion: core.Int64Ptr(templateVersion), - TargetType: core.StringPtr(targetType), - Target: core.StringPtr(target), + TargetType: core.StringPtr(targetType), + Target: core.StringPtr(target), } } @@ -6891,7 +7884,7 @@ type DeleteAccountSettingsTemplateVersionOptions struct { func (*IamIdentityV1) NewDeleteAccountSettingsTemplateVersionOptions(templateID string, version string) *DeleteAccountSettingsTemplateVersionOptions { return &DeleteAccountSettingsTemplateVersionOptions{ TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -7013,7 +8006,7 @@ type DeleteClaimRuleOptions struct { func (*IamIdentityV1) NewDeleteClaimRuleOptions(profileID string, ruleID string) *DeleteClaimRuleOptions { return &DeleteClaimRuleOptions{ ProfileID: core.StringPtr(profileID), - RuleID: core.StringPtr(ruleID), + RuleID: core.StringPtr(ruleID), } } @@ -7051,7 +8044,7 @@ type DeleteLinkOptions struct { func (*IamIdentityV1) NewDeleteLinkOptions(profileID string, linkID string) *DeleteLinkOptions { return &DeleteLinkOptions{ ProfileID: core.StringPtr(profileID), - LinkID: core.StringPtr(linkID), + LinkID: core.StringPtr(linkID), } } @@ -7091,15 +8084,15 @@ type DeleteProfileIdentityOptions struct { // Constants associated with the DeleteProfileIdentityOptions.IdentityType property. // Type of the identity. const ( - DeleteProfileIdentityOptionsIdentityTypeCRNConst = "crn" + DeleteProfileIdentityOptionsIdentityTypeCRNConst = "crn" DeleteProfileIdentityOptionsIdentityTypeServiceidConst = "serviceid" - DeleteProfileIdentityOptionsIdentityTypeUserConst = "user" + DeleteProfileIdentityOptionsIdentityTypeUserConst = "user" ) // NewDeleteProfileIdentityOptions : Instantiate DeleteProfileIdentityOptions func (*IamIdentityV1) NewDeleteProfileIdentityOptions(profileID string, identityType string, identifierID string) *DeleteProfileIdentityOptions { return &DeleteProfileIdentityOptions{ - ProfileID: core.StringPtr(profileID), + ProfileID: core.StringPtr(profileID), IdentityType: core.StringPtr(identityType), IdentifierID: core.StringPtr(identifierID), } @@ -7173,7 +8166,7 @@ type DeleteProfileTemplateVersionOptions struct { func (*IamIdentityV1) NewDeleteProfileTemplateVersionOptions(templateID string, version string) *DeleteProfileTemplateVersionOptions { return &DeleteProfileTemplateVersionOptions{ TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -7251,6 +8244,62 @@ func (options *DeleteTrustedProfileAssignmentOptions) SetHeaders(param map[strin return options } +// DisableAPIKeyOptions : The DisableAPIKey options. +type DisableAPIKeyOptions struct { + // Unique ID of the API key. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDisableAPIKeyOptions : Instantiate DisableAPIKeyOptions +func (*IamIdentityV1) NewDisableAPIKeyOptions(id string) *DisableAPIKeyOptions { + return &DisableAPIKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DisableAPIKeyOptions) SetID(id string) *DisableAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DisableAPIKeyOptions) SetHeaders(param map[string]string) *DisableAPIKeyOptions { + options.Headers = param + return options +} + +// EnableAPIKeyOptions : The EnableAPIKey options. +type EnableAPIKeyOptions struct { + // Unique ID of the API key. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewEnableAPIKeyOptions : Instantiate EnableAPIKeyOptions +func (*IamIdentityV1) NewEnableAPIKeyOptions(id string) *EnableAPIKeyOptions { + return &EnableAPIKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *EnableAPIKeyOptions) SetID(id string) *EnableAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *EnableAPIKeyOptions) SetHeaders(param map[string]string) *EnableAPIKeyOptions { + options.Headers = param + return options +} + // EnityHistoryRecord : Response body format for an entity history record. type EnityHistoryRecord struct { // Timestamp when the action was triggered. @@ -7277,26 +8326,32 @@ func UnmarshalEnityHistoryRecord(m map[string]json.RawMessage, result interface{ obj := new(EnityHistoryRecord) err = core.UnmarshalPrimitive(m, "timestamp", &obj.Timestamp) if err != nil { + err = core.SDKErrorf(err, "", "timestamp-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iam_id_account", &obj.IamIDAccount) if err != nil { + err = core.SDKErrorf(err, "", "iam_id_account-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "params", &obj.Params) if err != nil { + err = core.SDKErrorf(err, "", "params-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -7320,14 +8375,17 @@ func UnmarshalEntityActivity(m map[string]json.RawMessage, result interface{}) ( obj := new(EntityActivity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_authn", &obj.LastAuthn) if err != nil { + err = core.SDKErrorf(err, "", "last_authn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -7356,18 +8414,22 @@ func UnmarshalError(m map[string]json.RawMessage, result interface{}) (err error obj := new(Error) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) if err != nil { + err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "details", &obj.Details) if err != nil { + err = core.SDKErrorf(err, "", "details-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -7394,18 +8456,22 @@ func UnmarshalExceptionResponse(m map[string]json.RawMessage, result interface{} obj := new(ExceptionResponse) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) if err != nil { + err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "errors", &obj.Errors, UnmarshalError) if err != nil { + err = core.SDKErrorf(err, "", "errors-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "trace", &obj.Trace) if err != nil { + err = core.SDKErrorf(err, "", "trace-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -7505,7 +8571,7 @@ type GetAccountSettingsTemplateVersionOptions struct { func (*IamIdentityV1) NewGetAccountSettingsTemplateVersionOptions(templateID string, version string) *GetAccountSettingsTemplateVersionOptions { return &GetAccountSettingsTemplateVersionOptions{ TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -7631,7 +8697,7 @@ type GetClaimRuleOptions struct { func (*IamIdentityV1) NewGetClaimRuleOptions(profileID string, ruleID string) *GetClaimRuleOptions { return &GetClaimRuleOptions{ ProfileID: core.StringPtr(profileID), - RuleID: core.StringPtr(ruleID), + RuleID: core.StringPtr(ruleID), } } @@ -7743,7 +8809,7 @@ type GetLinkOptions struct { func (*IamIdentityV1) NewGetLinkOptions(profileID string, linkID string) *GetLinkOptions { return &GetLinkOptions{ ProfileID: core.StringPtr(profileID), - LinkID: core.StringPtr(linkID), + LinkID: core.StringPtr(linkID), } } @@ -7819,7 +8885,7 @@ type GetMfaStatusOptions struct { func (*IamIdentityV1) NewGetMfaStatusOptions(accountID string, iamID string) *GetMfaStatusOptions { return &GetMfaStatusOptions{ AccountID: core.StringPtr(accountID), - IamID: core.StringPtr(iamID), + IamID: core.StringPtr(iamID), } } @@ -7887,15 +8953,15 @@ type GetProfileIdentityOptions struct { // Constants associated with the GetProfileIdentityOptions.IdentityType property. // Type of the identity. const ( - GetProfileIdentityOptionsIdentityTypeCRNConst = "crn" + GetProfileIdentityOptionsIdentityTypeCRNConst = "crn" GetProfileIdentityOptionsIdentityTypeServiceidConst = "serviceid" - GetProfileIdentityOptionsIdentityTypeUserConst = "user" + GetProfileIdentityOptionsIdentityTypeUserConst = "user" ) // NewGetProfileIdentityOptions : Instantiate GetProfileIdentityOptions func (*IamIdentityV1) NewGetProfileIdentityOptions(profileID string, identityType string, identifierID string) *GetProfileIdentityOptions { return &GetProfileIdentityOptions{ - ProfileID: core.StringPtr(profileID), + ProfileID: core.StringPtr(profileID), IdentityType: core.StringPtr(identityType), IdentifierID: core.StringPtr(identifierID), } @@ -7982,7 +9048,7 @@ type GetProfileTemplateVersionOptions struct { func (*IamIdentityV1) NewGetProfileTemplateVersionOptions(templateID string, version string) *GetProfileTemplateVersionOptions { return &GetProfileTemplateVersionOptions{ TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -8177,71 +9243,72 @@ type IDBasedMfaEnrollment struct { // Constants associated with the IDBasedMfaEnrollment.TraitAccountDefault property. // Defines the MFA trait for the account. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - IDBasedMfaEnrollmentTraitAccountDefaultLevel1Const = "LEVEL1" - IDBasedMfaEnrollmentTraitAccountDefaultLevel2Const = "LEVEL2" - IDBasedMfaEnrollmentTraitAccountDefaultLevel3Const = "LEVEL3" - IDBasedMfaEnrollmentTraitAccountDefaultNoneConst = "NONE" + IDBasedMfaEnrollmentTraitAccountDefaultLevel1Const = "LEVEL1" + IDBasedMfaEnrollmentTraitAccountDefaultLevel2Const = "LEVEL2" + IDBasedMfaEnrollmentTraitAccountDefaultLevel3Const = "LEVEL3" + IDBasedMfaEnrollmentTraitAccountDefaultNoneConst = "NONE" IDBasedMfaEnrollmentTraitAccountDefaultNoneNoRopcConst = "NONE_NO_ROPC" - IDBasedMfaEnrollmentTraitAccountDefaultTotpConst = "TOTP" - IDBasedMfaEnrollmentTraitAccountDefaultTotp4allConst = "TOTP4ALL" + IDBasedMfaEnrollmentTraitAccountDefaultTotpConst = "TOTP" + IDBasedMfaEnrollmentTraitAccountDefaultTotp4allConst = "TOTP4ALL" ) // Constants associated with the IDBasedMfaEnrollment.TraitUserSpecific property. // Defines the MFA trait for the account. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - IDBasedMfaEnrollmentTraitUserSpecificLevel1Const = "LEVEL1" - IDBasedMfaEnrollmentTraitUserSpecificLevel2Const = "LEVEL2" - IDBasedMfaEnrollmentTraitUserSpecificLevel3Const = "LEVEL3" - IDBasedMfaEnrollmentTraitUserSpecificNoneConst = "NONE" + IDBasedMfaEnrollmentTraitUserSpecificLevel1Const = "LEVEL1" + IDBasedMfaEnrollmentTraitUserSpecificLevel2Const = "LEVEL2" + IDBasedMfaEnrollmentTraitUserSpecificLevel3Const = "LEVEL3" + IDBasedMfaEnrollmentTraitUserSpecificNoneConst = "NONE" IDBasedMfaEnrollmentTraitUserSpecificNoneNoRopcConst = "NONE_NO_ROPC" - IDBasedMfaEnrollmentTraitUserSpecificTotpConst = "TOTP" - IDBasedMfaEnrollmentTraitUserSpecificTotp4allConst = "TOTP4ALL" + IDBasedMfaEnrollmentTraitUserSpecificTotpConst = "TOTP" + IDBasedMfaEnrollmentTraitUserSpecificTotp4allConst = "TOTP4ALL" ) // Constants associated with the IDBasedMfaEnrollment.TraitEffective property. // Defines the MFA trait for the account. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - IDBasedMfaEnrollmentTraitEffectiveLevel1Const = "LEVEL1" - IDBasedMfaEnrollmentTraitEffectiveLevel2Const = "LEVEL2" - IDBasedMfaEnrollmentTraitEffectiveLevel3Const = "LEVEL3" - IDBasedMfaEnrollmentTraitEffectiveNoneConst = "NONE" + IDBasedMfaEnrollmentTraitEffectiveLevel1Const = "LEVEL1" + IDBasedMfaEnrollmentTraitEffectiveLevel2Const = "LEVEL2" + IDBasedMfaEnrollmentTraitEffectiveLevel3Const = "LEVEL3" + IDBasedMfaEnrollmentTraitEffectiveNoneConst = "NONE" IDBasedMfaEnrollmentTraitEffectiveNoneNoRopcConst = "NONE_NO_ROPC" - IDBasedMfaEnrollmentTraitEffectiveTotpConst = "TOTP" - IDBasedMfaEnrollmentTraitEffectiveTotp4allConst = "TOTP4ALL" + IDBasedMfaEnrollmentTraitEffectiveTotpConst = "TOTP" + IDBasedMfaEnrollmentTraitEffectiveTotp4allConst = "TOTP4ALL" ) // Constants associated with the IDBasedMfaEnrollment.ComplyState property. // Defines comply state for the account. Valid values: -// * NO - User does not comply in the given account. -// * ACCOUNT- User complies in the given account, but does not comply in at least one of the other account +// - NO - User does not comply in the given account. +// - ACCOUNT- User complies in the given account, but does not comply in at least one of the other account +// // memberships. -// * CROSS_ACCOUNT - User complies in the given account and across all other account memberships. +// - CROSS_ACCOUNT - User complies in the given account and across all other account memberships. const ( - IDBasedMfaEnrollmentComplyStateAccountConst = "ACCOUNT" + IDBasedMfaEnrollmentComplyStateAccountConst = "ACCOUNT" IDBasedMfaEnrollmentComplyStateCrossAccountConst = "CROSS_ACCOUNT" - IDBasedMfaEnrollmentComplyStateNoConst = "NO" + IDBasedMfaEnrollmentComplyStateNoConst = "NO" ) // UnmarshalIDBasedMfaEnrollment unmarshals an instance of IDBasedMfaEnrollment from the specified map of raw messages. @@ -8249,22 +9316,27 @@ func UnmarshalIDBasedMfaEnrollment(m map[string]json.RawMessage, result interfac obj := new(IDBasedMfaEnrollment) err = core.UnmarshalPrimitive(m, "trait_account_default", &obj.TraitAccountDefault) if err != nil { + err = core.SDKErrorf(err, "", "trait_account_default-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "trait_user_specific", &obj.TraitUserSpecific) if err != nil { + err = core.SDKErrorf(err, "", "trait_user_specific-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "trait_effective", &obj.TraitEffective) if err != nil { + err = core.SDKErrorf(err, "", "trait_effective-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "complies", &obj.Complies) if err != nil { + err = core.SDKErrorf(err, "", "complies-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "comply_state", &obj.ComplyState) if err != nil { + err = core.SDKErrorf(err, "", "comply_state-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -8310,22 +9382,22 @@ type ListAccountSettingsAssignmentsOptions struct { // Constants associated with the ListAccountSettingsAssignmentsOptions.TargetType property. // Filter results by the assignment's target type. const ( - ListAccountSettingsAssignmentsOptionsTargetTypeAccountConst = "Account" + ListAccountSettingsAssignmentsOptionsTargetTypeAccountConst = "Account" ListAccountSettingsAssignmentsOptionsTargetTypeAccountgroupConst = "AccountGroup" ) // Constants associated with the ListAccountSettingsAssignmentsOptions.Sort property. // If specified, the items are sorted by the value of this property. const ( - ListAccountSettingsAssignmentsOptionsSortCreatedAtConst = "created_at" + ListAccountSettingsAssignmentsOptionsSortCreatedAtConst = "created_at" ListAccountSettingsAssignmentsOptionsSortLastModifiedAtConst = "last_modified_at" - ListAccountSettingsAssignmentsOptionsSortTemplateIDConst = "template_id" + ListAccountSettingsAssignmentsOptionsSortTemplateIDConst = "template_id" ) // Constants associated with the ListAccountSettingsAssignmentsOptions.Order property. // Sort order. const ( - ListAccountSettingsAssignmentsOptionsOrderAscConst = "asc" + ListAccountSettingsAssignmentsOptionsOrderAscConst = "asc" ListAccountSettingsAssignmentsOptionsOrderDescConst = "desc" ) @@ -8427,15 +9499,15 @@ type ListAccountSettingsTemplatesOptions struct { // Constants associated with the ListAccountSettingsTemplatesOptions.Sort property. // Optional sort property. If specified, the returned templated are sorted according to this property. const ( - ListAccountSettingsTemplatesOptionsSortCreatedAtConst = "created_at" + ListAccountSettingsTemplatesOptionsSortCreatedAtConst = "created_at" ListAccountSettingsTemplatesOptionsSortLastModifiedAtConst = "last_modified_at" - ListAccountSettingsTemplatesOptionsSortNameConst = "name" + ListAccountSettingsTemplatesOptionsSortNameConst = "name" ) // Constants associated with the ListAccountSettingsTemplatesOptions.Order property. // Optional sort order. const ( - ListAccountSettingsTemplatesOptionsOrderAscConst = "asc" + ListAccountSettingsTemplatesOptionsOrderAscConst = "asc" ListAccountSettingsTemplatesOptionsOrderDescConst = "desc" ) @@ -8527,20 +9599,20 @@ type ListAPIKeysOptions struct { // Optional parameter to define the scope of the queried API keys. Can be 'entity' (default) or 'account'. const ( ListAPIKeysOptionsScopeAccountConst = "account" - ListAPIKeysOptionsScopeEntityConst = "entity" + ListAPIKeysOptionsScopeEntityConst = "entity" ) // Constants associated with the ListAPIKeysOptions.Type property. // Optional parameter to filter the type of the queried API keys. Can be 'user' or 'serviceid'. const ( ListAPIKeysOptionsTypeServiceidConst = "serviceid" - ListAPIKeysOptionsTypeUserConst = "user" + ListAPIKeysOptionsTypeUserConst = "user" ) // Constants associated with the ListAPIKeysOptions.Order property. // Optional sort order, valid values are asc and desc. Default: asc. const ( - ListAPIKeysOptionsOrderAscConst = "asc" + ListAPIKeysOptionsOrderAscConst = "asc" ListAPIKeysOptionsOrderDescConst = "desc" ) @@ -8692,15 +9764,15 @@ type ListProfileTemplatesOptions struct { // Constants associated with the ListProfileTemplatesOptions.Sort property. // Optional sort property. If specified, the returned templates are sorted according to this property. const ( - ListProfileTemplatesOptionsSortCreatedAtConst = "created_at" + ListProfileTemplatesOptionsSortCreatedAtConst = "created_at" ListProfileTemplatesOptionsSortLastModifiedAtConst = "last_modified_at" - ListProfileTemplatesOptionsSortNameConst = "name" + ListProfileTemplatesOptionsSortNameConst = "name" ) // Constants associated with the ListProfileTemplatesOptions.Order property. // Optional sort order. const ( - ListProfileTemplatesOptionsOrderAscConst = "asc" + ListProfileTemplatesOptionsOrderAscConst = "asc" ListProfileTemplatesOptionsOrderDescConst = "desc" ) @@ -8782,7 +9854,7 @@ type ListProfilesOptions struct { // Constants associated with the ListProfilesOptions.Order property. // Optional sort order, valid values are asc and desc. Default: asc. const ( - ListProfilesOptionsOrderAscConst = "asc" + ListProfilesOptionsOrderAscConst = "asc" ListProfilesOptionsOrderDescConst = "desc" ) @@ -8872,7 +9944,7 @@ type ListServiceIdsOptions struct { // Constants associated with the ListServiceIdsOptions.Order property. // Optional sort order, valid values are asc and desc. Default: asc. const ( - ListServiceIdsOptionsOrderAscConst = "asc" + ListServiceIdsOptionsOrderAscConst = "asc" ListServiceIdsOptionsOrderDescConst = "desc" ) @@ -8968,22 +10040,22 @@ type ListTrustedProfileAssignmentsOptions struct { // Constants associated with the ListTrustedProfileAssignmentsOptions.TargetType property. // Filter results by the assignment's target type. const ( - ListTrustedProfileAssignmentsOptionsTargetTypeAccountConst = "Account" + ListTrustedProfileAssignmentsOptionsTargetTypeAccountConst = "Account" ListTrustedProfileAssignmentsOptionsTargetTypeAccountgroupConst = "AccountGroup" ) // Constants associated with the ListTrustedProfileAssignmentsOptions.Sort property. // If specified, the items are sorted by the value of this property. const ( - ListTrustedProfileAssignmentsOptionsSortCreatedAtConst = "created_at" + ListTrustedProfileAssignmentsOptionsSortCreatedAtConst = "created_at" ListTrustedProfileAssignmentsOptionsSortLastModifiedAtConst = "last_modified_at" - ListTrustedProfileAssignmentsOptionsSortTemplateIDConst = "template_id" + ListTrustedProfileAssignmentsOptionsSortTemplateIDConst = "template_id" ) // Constants associated with the ListTrustedProfileAssignmentsOptions.Order property. // Sort order. const ( - ListTrustedProfileAssignmentsOptionsOrderAscConst = "asc" + ListTrustedProfileAssignmentsOptionsOrderAscConst = "asc" ListTrustedProfileAssignmentsOptionsOrderDescConst = "desc" ) @@ -9085,15 +10157,15 @@ type ListVersionsOfAccountSettingsTemplateOptions struct { // Constants associated with the ListVersionsOfAccountSettingsTemplateOptions.Sort property. // Optional sort property. If specified, the returned templated are sorted according to this property. const ( - ListVersionsOfAccountSettingsTemplateOptionsSortCreatedAtConst = "created_at" + ListVersionsOfAccountSettingsTemplateOptionsSortCreatedAtConst = "created_at" ListVersionsOfAccountSettingsTemplateOptionsSortLastModifiedAtConst = "last_modified_at" - ListVersionsOfAccountSettingsTemplateOptionsSortNameConst = "name" + ListVersionsOfAccountSettingsTemplateOptionsSortNameConst = "name" ) // Constants associated with the ListVersionsOfAccountSettingsTemplateOptions.Order property. // Optional sort order. const ( - ListVersionsOfAccountSettingsTemplateOptionsOrderAscConst = "asc" + ListVersionsOfAccountSettingsTemplateOptionsOrderAscConst = "asc" ListVersionsOfAccountSettingsTemplateOptionsOrderDescConst = "desc" ) @@ -9173,15 +10245,15 @@ type ListVersionsOfProfileTemplateOptions struct { // Constants associated with the ListVersionsOfProfileTemplateOptions.Sort property. // Optional sort property. If specified, the returned templated are sorted according to this property. const ( - ListVersionsOfProfileTemplateOptionsSortCreatedAtConst = "created_at" + ListVersionsOfProfileTemplateOptionsSortCreatedAtConst = "created_at" ListVersionsOfProfileTemplateOptionsSortLastModifiedAtConst = "last_modified_at" - ListVersionsOfProfileTemplateOptionsSortNameConst = "name" + ListVersionsOfProfileTemplateOptionsSortNameConst = "name" ) // Constants associated with the ListVersionsOfProfileTemplateOptions.Order property. // Optional sort order. const ( - ListVersionsOfProfileTemplateOptionsOrderAscConst = "asc" + ListVersionsOfProfileTemplateOptionsOrderAscConst = "asc" ListVersionsOfProfileTemplateOptionsOrderDescConst = "desc" ) @@ -9304,10 +10376,12 @@ func UnmarshalMfaEnrollmentTypeStatus(m map[string]json.RawMessage, result inter obj := new(MfaEnrollmentTypeStatus) err = core.UnmarshalPrimitive(m, "required", &obj.Required) if err != nil { + err = core.SDKErrorf(err, "", "required-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enrolled", &obj.Enrolled) if err != nil { + err = core.SDKErrorf(err, "", "enrolled-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9329,14 +10403,17 @@ func UnmarshalMfaEnrollments(m map[string]json.RawMessage, result interface{}) ( obj := new(MfaEnrollments) err = core.UnmarshalPrimitive(m, "effective_mfa_type", &obj.EffectiveMfaType) if err != nil { + err = core.SDKErrorf(err, "", "effective_mfa_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "id_based_mfa", &obj.IDBasedMfa, UnmarshalIDBasedMfaEnrollment) if err != nil { + err = core.SDKErrorf(err, "", "id_based_mfa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "account_based_mfa", &obj.AccountBasedMfa, UnmarshalAccountBasedMfaEnrollment) if err != nil { + err = core.SDKErrorf(err, "", "account_based_mfa-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9355,10 +10432,13 @@ type PolicyTemplateReference struct { // NewPolicyTemplateReference : Instantiate PolicyTemplateReference (Generic Model Constructor) func (*IamIdentityV1) NewPolicyTemplateReference(id string, version string) (_model *PolicyTemplateReference, err error) { _model = &PolicyTemplateReference{ - ID: core.StringPtr(id), + ID: core.StringPtr(id), Version: core.StringPtr(version), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -9367,10 +10447,12 @@ func UnmarshalPolicyTemplateReference(m map[string]json.RawMessage, result inter obj := new(PolicyTemplateReference) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9415,42 +10497,52 @@ func UnmarshalProfileClaimRule(m map[string]json.RawMessage, result interface{}) obj := new(ProfileClaimRule) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "realm_name", &obj.RealmName) if err != nil { + err = core.SDKErrorf(err, "", "realm_name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "expiration", &obj.Expiration) if err != nil { + err = core.SDKErrorf(err, "", "expiration-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cr_type", &obj.CrType) if err != nil { + err = core.SDKErrorf(err, "", "cr_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalProfileClaimRuleConditions) if err != nil { + err = core.SDKErrorf(err, "", "conditions-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9474,11 +10566,14 @@ type ProfileClaimRuleConditions struct { // NewProfileClaimRuleConditions : Instantiate ProfileClaimRuleConditions (Generic Model Constructor) func (*IamIdentityV1) NewProfileClaimRuleConditions(claim string, operator string, value string) (_model *ProfileClaimRuleConditions, err error) { _model = &ProfileClaimRuleConditions{ - Claim: core.StringPtr(claim), + Claim: core.StringPtr(claim), Operator: core.StringPtr(operator), - Value: core.StringPtr(value), + Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -9487,14 +10582,17 @@ func UnmarshalProfileClaimRuleConditions(m map[string]json.RawMessage, result in obj := new(ProfileClaimRuleConditions) err = core.UnmarshalPrimitive(m, "claim", &obj.Claim) if err != nil { + err = core.SDKErrorf(err, "", "claim-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) if err != nil { + err = core.SDKErrorf(err, "", "operator-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9515,10 +10613,12 @@ func UnmarshalProfileClaimRuleList(m map[string]json.RawMessage, result interfac obj := new(ProfileClaimRuleList) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalProfileClaimRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9539,10 +10639,12 @@ func UnmarshalProfileIdentitiesResponse(m map[string]json.RawMessage, result int obj := new(ProfileIdentitiesResponse) err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identities", &obj.Identities, UnmarshalProfileIdentityResponse) if err != nil { + err = core.SDKErrorf(err, "", "identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9571,18 +10673,21 @@ type ProfileIdentityRequest struct { // Constants associated with the ProfileIdentityRequest.Type property. // Type of the identity. const ( - ProfileIdentityRequestTypeCRNConst = "crn" + ProfileIdentityRequestTypeCRNConst = "crn" ProfileIdentityRequestTypeServiceidConst = "serviceid" - ProfileIdentityRequestTypeUserConst = "user" + ProfileIdentityRequestTypeUserConst = "user" ) // NewProfileIdentityRequest : Instantiate ProfileIdentityRequest (Generic Model Constructor) func (*IamIdentityV1) NewProfileIdentityRequest(identifier string, typeVar string) (_model *ProfileIdentityRequest, err error) { _model = &ProfileIdentityRequest{ Identifier: core.StringPtr(identifier), - Type: core.StringPtr(typeVar), + Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -9591,18 +10696,22 @@ func UnmarshalProfileIdentityRequest(m map[string]json.RawMessage, result interf obj := new(ProfileIdentityRequest) err = core.UnmarshalPrimitive(m, "identifier", &obj.Identifier) if err != nil { + err = core.SDKErrorf(err, "", "identifier-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "accounts", &obj.Accounts) if err != nil { + err = core.SDKErrorf(err, "", "accounts-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9634,9 +10743,9 @@ type ProfileIdentityResponse struct { // Constants associated with the ProfileIdentityResponse.Type property. // Type of the identity. const ( - ProfileIdentityResponseTypeCRNConst = "crn" + ProfileIdentityResponseTypeCRNConst = "crn" ProfileIdentityResponseTypeServiceidConst = "serviceid" - ProfileIdentityResponseTypeUserConst = "user" + ProfileIdentityResponseTypeUserConst = "user" ) // UnmarshalProfileIdentityResponse unmarshals an instance of ProfileIdentityResponse from the specified map of raw messages. @@ -9644,22 +10753,27 @@ func UnmarshalProfileIdentityResponse(m map[string]json.RawMessage, result inter obj := new(ProfileIdentityResponse) err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "identifier", &obj.Identifier) if err != nil { + err = core.SDKErrorf(err, "", "identifier-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "accounts", &obj.Accounts) if err != nil { + err = core.SDKErrorf(err, "", "accounts-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9694,30 +10808,37 @@ func UnmarshalProfileLink(m map[string]json.RawMessage, result interface{}) (err obj := new(ProfileLink) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cr_type", &obj.CrType) if err != nil { + err = core.SDKErrorf(err, "", "cr_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "link", &obj.Link, UnmarshalProfileLinkLink) if err != nil { + err = core.SDKErrorf(err, "", "link-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9741,14 +10862,17 @@ func UnmarshalProfileLinkLink(m map[string]json.RawMessage, result interface{}) obj := new(ProfileLinkLink) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) if err != nil { + err = core.SDKErrorf(err, "", "namespace-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9766,6 +10890,7 @@ func UnmarshalProfileLinkList(m map[string]json.RawMessage, result interface{}) obj := new(ProfileLinkList) err = core.UnmarshalModel(m, "links", &obj.Links, UnmarshalProfileLink) if err != nil { + err = core.SDKErrorf(err, "", "links-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9807,38 +10932,47 @@ func UnmarshalReport(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Report) err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "reference", &obj.Reference) if err != nil { + err = core.SDKErrorf(err, "", "reference-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "report_duration", &obj.ReportDuration) if err != nil { + err = core.SDKErrorf(err, "", "report_duration-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "report_start_time", &obj.ReportStartTime) if err != nil { + err = core.SDKErrorf(err, "", "report_start_time-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "report_end_time", &obj.ReportEndTime) if err != nil { + err = core.SDKErrorf(err, "", "report_end_time-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "users", &obj.Users, UnmarshalUserActivity) if err != nil { + err = core.SDKErrorf(err, "", "users-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "apikeys", &obj.Apikeys, UnmarshalApikeyActivity) if err != nil { + err = core.SDKErrorf(err, "", "apikeys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "serviceids", &obj.Serviceids, UnmarshalEntityActivity) if err != nil { + err = core.SDKErrorf(err, "", "serviceids-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalEntityActivity) if err != nil { + err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9871,26 +11005,32 @@ func UnmarshalReportMfaEnrollmentStatus(m map[string]json.RawMessage, result int obj := new(ReportMfaEnrollmentStatus) err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "reference", &obj.Reference) if err != nil { + err = core.SDKErrorf(err, "", "reference-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "report_time", &obj.ReportTime) if err != nil { + err = core.SDKErrorf(err, "", "report_time-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ims_account_id", &obj.ImsAccountID) if err != nil { + err = core.SDKErrorf(err, "", "ims_account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "users", &obj.Users, UnmarshalUserReportMfaEnrollmentStatus) if err != nil { + err = core.SDKErrorf(err, "", "users-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9908,6 +11048,7 @@ func UnmarshalReportReference(m map[string]json.RawMessage, result interface{}) obj := new(ReportReference) err = core.UnmarshalPrimitive(m, "reference", &obj.Reference) if err != nil { + err = core.SDKErrorf(err, "", "reference-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -9955,46 +11096,57 @@ func UnmarshalResponseContext(m map[string]json.RawMessage, result interface{}) obj := new(ResponseContext) err = core.UnmarshalPrimitive(m, "transaction_id", &obj.TransactionID) if err != nil { + err = core.SDKErrorf(err, "", "transaction_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) if err != nil { + err = core.SDKErrorf(err, "", "operation-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_agent", &obj.UserAgent) if err != nil { + err = core.SDKErrorf(err, "", "user_agent-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) if err != nil { + err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "thread_id", &obj.ThreadID) if err != nil { + err = core.SDKErrorf(err, "", "thread_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "host", &obj.Host) if err != nil { + err = core.SDKErrorf(err, "", "host-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) if err != nil { + err = core.SDKErrorf(err, "", "start_time-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "end_time", &obj.EndTime) if err != nil { + err = core.SDKErrorf(err, "", "end_time-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "elapsed_time", &obj.ElapsedTime) if err != nil { + err = core.SDKErrorf(err, "", "elapsed_time-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cluster_name", &obj.ClusterName) if err != nil { + err = core.SDKErrorf(err, "", "cluster_name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10057,62 +11209,77 @@ func UnmarshalServiceID(m map[string]json.RawMessage, result interface{}) (err e obj := new(ServiceID) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "locked", &obj.Locked) if err != nil { + err = core.SDKErrorf(err, "", "locked-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "unique_instance_crns", &obj.UniqueInstanceCrns) if err != nil { + err = core.SDKErrorf(err, "", "unique_instance_crns-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "apikey", &obj.Apikey, UnmarshalAPIKey) if err != nil { + err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "activity", &obj.Activity, UnmarshalActivity) if err != nil { + err = core.SDKErrorf(err, "", "activity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10150,30 +11317,37 @@ func UnmarshalServiceIDList(m map[string]json.RawMessage, result interface{}) (e obj := new(ServiceIDList) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "first", &obj.First) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) if err != nil { + err = core.SDKErrorf(err, "", "previous-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next", &obj.Next) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "serviceids", &obj.Serviceids, UnmarshalServiceID) if err != nil { + err = core.SDKErrorf(err, "", "serviceids-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10201,7 +11375,7 @@ type SetProfileIdentitiesOptions struct { func (*IamIdentityV1) NewSetProfileIdentitiesOptions(profileID string, ifMatch string) *SetProfileIdentitiesOptions { return &SetProfileIdentitiesOptions{ ProfileID: core.StringPtr(profileID), - IfMatch: core.StringPtr(ifMatch), + IfMatch: core.StringPtr(ifMatch), } } @@ -10260,26 +11434,26 @@ type SetProfileIdentityOptions struct { // Constants associated with the SetProfileIdentityOptions.IdentityType property. // Type of the identity. const ( - SetProfileIdentityOptionsIdentityTypeCRNConst = "crn" + SetProfileIdentityOptionsIdentityTypeCRNConst = "crn" SetProfileIdentityOptionsIdentityTypeServiceidConst = "serviceid" - SetProfileIdentityOptionsIdentityTypeUserConst = "user" + SetProfileIdentityOptionsIdentityTypeUserConst = "user" ) // Constants associated with the SetProfileIdentityOptions.Type property. // Type of the identity. const ( - SetProfileIdentityOptionsTypeCRNConst = "crn" + SetProfileIdentityOptionsTypeCRNConst = "crn" SetProfileIdentityOptionsTypeServiceidConst = "serviceid" - SetProfileIdentityOptionsTypeUserConst = "user" + SetProfileIdentityOptionsTypeUserConst = "user" ) // NewSetProfileIdentityOptions : Instantiate SetProfileIdentityOptions func (*IamIdentityV1) NewSetProfileIdentityOptions(profileID string, identityType string, identifier string, typeVar string) *SetProfileIdentityOptions { return &SetProfileIdentityOptions{ - ProfileID: core.StringPtr(profileID), + ProfileID: core.StringPtr(profileID), IdentityType: core.StringPtr(identityType), - Identifier: core.StringPtr(identifier), - Type: core.StringPtr(typeVar), + Identifier: core.StringPtr(identifier), + Type: core.StringPtr(typeVar), } } @@ -10356,30 +11530,37 @@ func UnmarshalTemplateAssignmentListResponse(m map[string]json.RawMessage, resul obj := new(TemplateAssignmentListResponse) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "first", &obj.First) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) if err != nil { + err = core.SDKErrorf(err, "", "previous-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next", &obj.Next) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "assignments", &obj.Assignments, UnmarshalTemplateAssignmentResponse) if err != nil { + err = core.SDKErrorf(err, "", "assignments-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10397,6 +11578,7 @@ func UnmarshalTemplateAssignmentResource(m map[string]json.RawMessage, result in obj := new(TemplateAssignmentResource) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10423,18 +11605,22 @@ func UnmarshalTemplateAssignmentResourceError(m map[string]json.RawMessage, resu obj := new(TemplateAssignmentResourceError) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "errorCode", &obj.ErrorCode) if err != nil { + err = core.SDKErrorf(err, "", "errorCode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "statusCode", &obj.StatusCode) if err != nil { + err = core.SDKErrorf(err, "", "statusCode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10499,66 +11685,82 @@ func UnmarshalTemplateAssignmentResponse(m map[string]json.RawMessage, result in obj := new(TemplateAssignmentResponse) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) if err != nil { + err = core.SDKErrorf(err, "", "template_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "template_version", &obj.TemplateVersion) if err != nil { + err = core.SDKErrorf(err, "", "template_version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "target_type", &obj.TargetType) if err != nil { + err = core.SDKErrorf(err, "", "target_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "target", &obj.Target) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalTemplateAssignmentResponseResource) if err != nil { + err = core.SDKErrorf(err, "", "resources-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_by_id", &obj.CreatedByID) if err != nil { + err = core.SDKErrorf(err, "", "created_by_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_modified_at", &obj.LastModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_modified_by_id", &obj.LastModifiedByID) if err != nil { + err = core.SDKErrorf(err, "", "last_modified_by_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10583,18 +11785,22 @@ func UnmarshalTemplateAssignmentResponseResource(m map[string]json.RawMessage, r obj := new(TemplateAssignmentResponseResource) err = core.UnmarshalPrimitive(m, "target", &obj.Target) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalTemplateAssignmentResponseResourceDetail) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "account_settings", &obj.AccountSettings, UnmarshalTemplateAssignmentResponseResourceDetail) if err != nil { + err = core.SDKErrorf(err, "", "account_settings-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policy_template_refs", &obj.PolicyTemplateRefs, UnmarshalTemplateAssignmentResponseResourceDetail) if err != nil { + err = core.SDKErrorf(err, "", "policy_template_refs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10624,22 +11830,27 @@ func UnmarshalTemplateAssignmentResponseResourceDetail(m map[string]json.RawMess obj := new(TemplateAssignmentResponseResourceDetail) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resource_created", &obj.ResourceCreated, UnmarshalTemplateAssignmentResource) if err != nil { + err = core.SDKErrorf(err, "", "resource_created-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "error_message", &obj.ErrorMessage, UnmarshalTemplateAssignmentResourceError) if err != nil { + err = core.SDKErrorf(err, "", "error_message-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10667,6 +11878,9 @@ func (*IamIdentityV1) NewTemplateProfileComponentRequest(name string) (_model *T Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -10675,18 +11889,22 @@ func UnmarshalTemplateProfileComponentRequest(m map[string]json.RawMessage, resu obj := new(TemplateProfileComponentRequest) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalTrustedProfileTemplateClaimRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identities", &obj.Identities, UnmarshalProfileIdentityRequest) if err != nil { + err = core.SDKErrorf(err, "", "identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10713,18 +11931,22 @@ func UnmarshalTemplateProfileComponentResponse(m map[string]json.RawMessage, res obj := new(TemplateProfileComponentResponse) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalTrustedProfileTemplateClaimRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identities", &obj.Identities, UnmarshalProfileIdentityResponse) if err != nil { + err = core.SDKErrorf(err, "", "identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10792,66 +12014,82 @@ func UnmarshalTrustedProfile(m map[string]json.RawMessage, result interface{}) ( obj := new(TrustedProfile) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) if err != nil { + err = core.SDKErrorf(err, "", "template_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "assignment_id", &obj.AssignmentID) if err != nil { + err = core.SDKErrorf(err, "", "assignment_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ims_account_id", &obj.ImsAccountID) if err != nil { + err = core.SDKErrorf(err, "", "ims_account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ims_user_id", &obj.ImsUserID) if err != nil { + err = core.SDKErrorf(err, "", "ims_user_id-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "activity", &obj.Activity, UnmarshalActivity) if err != nil { + err = core.SDKErrorf(err, "", "activity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10886,10 +12124,13 @@ const ( // NewTrustedProfileTemplateClaimRule : Instantiate TrustedProfileTemplateClaimRule (Generic Model Constructor) func (*IamIdentityV1) NewTrustedProfileTemplateClaimRule(typeVar string, conditions []ProfileClaimRuleConditions) (_model *TrustedProfileTemplateClaimRule, err error) { _model = &TrustedProfileTemplateClaimRule{ - Type: core.StringPtr(typeVar), + Type: core.StringPtr(typeVar), Conditions: conditions, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -10898,22 +12139,27 @@ func UnmarshalTrustedProfileTemplateClaimRule(m map[string]json.RawMessage, resu obj := new(TrustedProfileTemplateClaimRule) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "realm_name", &obj.RealmName) if err != nil { + err = core.SDKErrorf(err, "", "realm_name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "expiration", &obj.Expiration) if err != nil { + err = core.SDKErrorf(err, "", "expiration-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalProfileClaimRuleConditions) if err != nil { + err = core.SDKErrorf(err, "", "conditions-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -10951,30 +12197,37 @@ func UnmarshalTrustedProfileTemplateList(m map[string]json.RawMessage, result in obj := new(TrustedProfileTemplateList) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "first", &obj.First) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) if err != nil { + err = core.SDKErrorf(err, "", "previous-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next", &obj.Next) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile_templates", &obj.ProfileTemplates, UnmarshalTrustedProfileTemplateResponse) if err != nil { + err = core.SDKErrorf(err, "", "profile_templates-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -11034,62 +12287,77 @@ func UnmarshalTrustedProfileTemplateResponse(m map[string]json.RawMessage, resul obj := new(TrustedProfileTemplateResponse) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "committed", &obj.Committed) if err != nil { + err = core.SDKErrorf(err, "", "committed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalTemplateProfileComponentResponse) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policy_template_references", &obj.PolicyTemplateReferences, UnmarshalPolicyTemplateReference) if err != nil { + err = core.SDKErrorf(err, "", "policy_template_references-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) if err != nil { + err = core.SDKErrorf(err, "", "history-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) if err != nil { + err = core.SDKErrorf(err, "", "entity_tag-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_by_id", &obj.CreatedByID) if err != nil { + err = core.SDKErrorf(err, "", "created_by_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_modified_at", &obj.LastModifiedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_modified_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_modified_by_id", &obj.LastModifiedByID) if err != nil { + err = core.SDKErrorf(err, "", "last_modified_by_id-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -11126,30 +12394,37 @@ func UnmarshalTrustedProfilesList(m map[string]json.RawMessage, result interface obj := new(TrustedProfilesList) err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) if err != nil { + err = core.SDKErrorf(err, "", "context-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "first", &obj.First) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) if err != nil { + err = core.SDKErrorf(err, "", "previous-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next", &obj.Next) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalTrustedProfile) if err != nil { + err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -11222,7 +12497,7 @@ type UpdateAccountSettingsAssignmentOptions struct { // result in stale updates. IfMatch *string `json:"If-Match" validate:"required"` - // Template version to be applied to the assignment. To retry all failed assignemtns, provide the existing version. To + // Template version to be applied to the assignment. To retry all failed assignments, provide the existing version. To // migrate to a different version, provide the new version number. TemplateVersion *int64 `json:"template_version" validate:"required"` @@ -11233,8 +12508,8 @@ type UpdateAccountSettingsAssignmentOptions struct { // NewUpdateAccountSettingsAssignmentOptions : Instantiate UpdateAccountSettingsAssignmentOptions func (*IamIdentityV1) NewUpdateAccountSettingsAssignmentOptions(assignmentID string, ifMatch string, templateVersion int64) *UpdateAccountSettingsAssignmentOptions { return &UpdateAccountSettingsAssignmentOptions{ - AssignmentID: core.StringPtr(assignmentID), - IfMatch: core.StringPtr(ifMatch), + AssignmentID: core.StringPtr(assignmentID), + IfMatch: core.StringPtr(ifMatch), TemplateVersion: core.Int64Ptr(templateVersion), } } @@ -11334,51 +12609,53 @@ type UpdateAccountSettingsOptions struct { // Constants associated with the UpdateAccountSettingsOptions.RestrictCreateServiceID property. // Defines whether or not creating a service ID is access controlled. Valid values: -// * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service +// - RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service +// // IDs, including the account owner -// * NOT_RESTRICTED - all members of an account can create service IDs -// * NOT_SET - to 'unset' a previous set value. +// - NOT_RESTRICTED - all members of an account can create service IDs +// - NOT_SET - to 'unset' a previous set value. const ( UpdateAccountSettingsOptionsRestrictCreateServiceIDNotRestrictedConst = "NOT_RESTRICTED" - UpdateAccountSettingsOptionsRestrictCreateServiceIDNotSetConst = "NOT_SET" - UpdateAccountSettingsOptionsRestrictCreateServiceIDRestrictedConst = "RESTRICTED" + UpdateAccountSettingsOptionsRestrictCreateServiceIDNotSetConst = "NOT_SET" + UpdateAccountSettingsOptionsRestrictCreateServiceIDRestrictedConst = "RESTRICTED" ) // Constants associated with the UpdateAccountSettingsOptions.RestrictCreatePlatformApikey property. // Defines whether or not creating platform API keys is access controlled. Valid values: -// * RESTRICTED - only users assigned the 'User API key creator' role on the IAM Identity Service can create API keys, +// - RESTRICTED - only users assigned the 'User API key creator' role on the IAM Identity Service can create API keys, +// // including the account owner -// * NOT_RESTRICTED - all members of an account can create platform API keys -// * NOT_SET - to 'unset' a previous set value. +// - NOT_RESTRICTED - all members of an account can create platform API keys +// - NOT_SET - to 'unset' a previous set value. const ( UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyNotRestrictedConst = "NOT_RESTRICTED" - UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" - UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" + UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" + UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" ) // Constants associated with the UpdateAccountSettingsOptions.Mfa property. // Defines the MFA trait for the account. Valid values: -// * NONE - No MFA trait set -// * NONE_NO_ROPC- No MFA, disable CLI logins with only a password -// * TOTP - For all non-federated IBMId users -// * TOTP4ALL - For all users -// * LEVEL1 - Email-based MFA for all users -// * LEVEL2 - TOTP-based MFA for all users -// * LEVEL3 - U2F MFA for all users. +// - NONE - No MFA trait set +// - NONE_NO_ROPC- No MFA, disable CLI logins with only a password +// - TOTP - For all non-federated IBMId users +// - TOTP4ALL - For all users +// - LEVEL1 - Email-based MFA for all users +// - LEVEL2 - TOTP-based MFA for all users +// - LEVEL3 - U2F MFA for all users. const ( - UpdateAccountSettingsOptionsMfaLevel1Const = "LEVEL1" - UpdateAccountSettingsOptionsMfaLevel2Const = "LEVEL2" - UpdateAccountSettingsOptionsMfaLevel3Const = "LEVEL3" - UpdateAccountSettingsOptionsMfaNoneConst = "NONE" + UpdateAccountSettingsOptionsMfaLevel1Const = "LEVEL1" + UpdateAccountSettingsOptionsMfaLevel2Const = "LEVEL2" + UpdateAccountSettingsOptionsMfaLevel3Const = "LEVEL3" + UpdateAccountSettingsOptionsMfaNoneConst = "NONE" UpdateAccountSettingsOptionsMfaNoneNoRopcConst = "NONE_NO_ROPC" - UpdateAccountSettingsOptionsMfaTotpConst = "TOTP" - UpdateAccountSettingsOptionsMfaTotp4allConst = "TOTP4ALL" + UpdateAccountSettingsOptionsMfaTotpConst = "TOTP" + UpdateAccountSettingsOptionsMfaTotp4allConst = "TOTP4ALL" ) // NewUpdateAccountSettingsOptions : Instantiate UpdateAccountSettingsOptions func (*IamIdentityV1) NewUpdateAccountSettingsOptions(ifMatch string, accountID string) *UpdateAccountSettingsOptions { return &UpdateAccountSettingsOptions{ - IfMatch: core.StringPtr(ifMatch), + IfMatch: core.StringPtr(ifMatch), AccountID: core.StringPtr(accountID), } } @@ -11492,9 +12769,9 @@ type UpdateAccountSettingsTemplateVersionOptions struct { // NewUpdateAccountSettingsTemplateVersionOptions : Instantiate UpdateAccountSettingsTemplateVersionOptions func (*IamIdentityV1) NewUpdateAccountSettingsTemplateVersionOptions(ifMatch string, templateID string, version string) *UpdateAccountSettingsTemplateVersionOptions { return &UpdateAccountSettingsTemplateVersionOptions{ - IfMatch: core.StringPtr(ifMatch), + IfMatch: core.StringPtr(ifMatch), TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -11564,6 +12841,12 @@ type UpdateAPIKeyOptions struct { // key. If a non empty value is provided the API key will be updated. Description *string `json:"description,omitempty"` + // Defines if the API key supports sessions. Sessions are only supported for user apikeys. + SupportSessions *bool `json:"support_sessions,omitempty"` + + // Defines the action to take when API key is leaked, valid values are 'none', 'disable' and 'delete'. + ActionWhenLeaked *string `json:"action_when_leaked,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -11571,7 +12854,7 @@ type UpdateAPIKeyOptions struct { // NewUpdateAPIKeyOptions : Instantiate UpdateAPIKeyOptions func (*IamIdentityV1) NewUpdateAPIKeyOptions(id string, ifMatch string) *UpdateAPIKeyOptions { return &UpdateAPIKeyOptions{ - ID: core.StringPtr(id), + ID: core.StringPtr(id), IfMatch: core.StringPtr(ifMatch), } } @@ -11600,6 +12883,18 @@ func (_options *UpdateAPIKeyOptions) SetDescription(description string) *UpdateA return _options } +// SetSupportSessions : Allow user to set SupportSessions +func (_options *UpdateAPIKeyOptions) SetSupportSessions(supportSessions bool) *UpdateAPIKeyOptions { + _options.SupportSessions = core.BoolPtr(supportSessions) + return _options +} + +// SetActionWhenLeaked : Allow user to set ActionWhenLeaked +func (_options *UpdateAPIKeyOptions) SetActionWhenLeaked(actionWhenLeaked string) *UpdateAPIKeyOptions { + _options.ActionWhenLeaked = core.StringPtr(actionWhenLeaked) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateAPIKeyOptions) SetHeaders(param map[string]string) *UpdateAPIKeyOptions { options.Headers = param @@ -11649,10 +12944,10 @@ type UpdateClaimRuleOptions struct { // NewUpdateClaimRuleOptions : Instantiate UpdateClaimRuleOptions func (*IamIdentityV1) NewUpdateClaimRuleOptions(profileID string, ruleID string, ifMatch string, typeVar string, conditions []ProfileClaimRuleConditions) *UpdateClaimRuleOptions { return &UpdateClaimRuleOptions{ - ProfileID: core.StringPtr(profileID), - RuleID: core.StringPtr(ruleID), - IfMatch: core.StringPtr(ifMatch), - Type: core.StringPtr(typeVar), + ProfileID: core.StringPtr(profileID), + RuleID: core.StringPtr(ruleID), + IfMatch: core.StringPtr(ifMatch), + Type: core.StringPtr(typeVar), Conditions: conditions, } } @@ -11749,7 +13044,7 @@ type UpdateProfileOptions struct { func (*IamIdentityV1) NewUpdateProfileOptions(profileID string, ifMatch string) *UpdateProfileOptions { return &UpdateProfileOptions{ ProfileID: core.StringPtr(profileID), - IfMatch: core.StringPtr(ifMatch), + IfMatch: core.StringPtr(ifMatch), } } @@ -11820,9 +13115,9 @@ type UpdateProfileTemplateVersionOptions struct { // NewUpdateProfileTemplateVersionOptions : Instantiate UpdateProfileTemplateVersionOptions func (*IamIdentityV1) NewUpdateProfileTemplateVersionOptions(ifMatch string, templateID string, version string) *UpdateProfileTemplateVersionOptions { return &UpdateProfileTemplateVersionOptions{ - IfMatch: core.StringPtr(ifMatch), + IfMatch: core.StringPtr(ifMatch), TemplateID: core.StringPtr(templateID), - Version: core.StringPtr(version), + Version: core.StringPtr(version), } } @@ -11909,7 +13204,7 @@ type UpdateServiceIDOptions struct { // NewUpdateServiceIDOptions : Instantiate UpdateServiceIDOptions func (*IamIdentityV1) NewUpdateServiceIDOptions(id string, ifMatch string) *UpdateServiceIDOptions { return &UpdateServiceIDOptions{ - ID: core.StringPtr(id), + ID: core.StringPtr(id), IfMatch: core.StringPtr(ifMatch), } } @@ -11960,7 +13255,7 @@ type UpdateTrustedProfileAssignmentOptions struct { // result in stale updates. IfMatch *string `json:"If-Match" validate:"required"` - // Template version to be applied to the assignment. To retry all failed assignemtns, provide the existing version. To + // Template version to be applied to the assignment. To retry all failed assignments, provide the existing version. To // migrate to a different version, provide the new version number. TemplateVersion *int64 `json:"template_version" validate:"required"` @@ -11971,8 +13266,8 @@ type UpdateTrustedProfileAssignmentOptions struct { // NewUpdateTrustedProfileAssignmentOptions : Instantiate UpdateTrustedProfileAssignmentOptions func (*IamIdentityV1) NewUpdateTrustedProfileAssignmentOptions(assignmentID string, ifMatch string, templateVersion int64) *UpdateTrustedProfileAssignmentOptions { return &UpdateTrustedProfileAssignmentOptions{ - AssignmentID: core.StringPtr(assignmentID), - IfMatch: core.StringPtr(ifMatch), + AssignmentID: core.StringPtr(assignmentID), + IfMatch: core.StringPtr(ifMatch), TemplateVersion: core.Int64Ptr(templateVersion), } } @@ -12024,22 +13319,27 @@ func UnmarshalUserActivity(m map[string]json.RawMessage, result interface{}) (er obj := new(UserActivity) err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "email", &obj.Email) if err != nil { + err = core.SDKErrorf(err, "", "email-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "last_authn", &obj.LastAuthn) if err != nil { + err = core.SDKErrorf(err, "", "last_authn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -12064,18 +13364,22 @@ func UnmarshalUserMfaEnrollments(m map[string]json.RawMessage, result interface{ obj := new(UserMfaEnrollments) err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "effective_mfa_type", &obj.EffectiveMfaType) if err != nil { + err = core.SDKErrorf(err, "", "effective_mfa_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "id_based_mfa", &obj.IDBasedMfa, UnmarshalIDBasedMfaEnrollment) if err != nil { + err = core.SDKErrorf(err, "", "id_based_mfa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "account_based_mfa", &obj.AccountBasedMfa, UnmarshalAccountBasedMfaEnrollment) if err != nil { + err = core.SDKErrorf(err, "", "account_based_mfa-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -12104,22 +13408,27 @@ func UnmarshalUserReportMfaEnrollmentStatus(m map[string]json.RawMessage, result obj := new(UserReportMfaEnrollmentStatus) err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) if err != nil { + err = core.SDKErrorf(err, "", "iam_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "email", &obj.Email) if err != nil { + err = core.SDKErrorf(err, "", "email-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "enrollments", &obj.Enrollments, UnmarshalMfaEnrollments) if err != nil { + err = core.SDKErrorf(err, "", "enrollments-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) diff --git a/iamidentityv1/iam_identity_v1_examples_test.go b/iamidentityv1/iam_identity_v1_examples_test.go index 86cf84a3..a0f19328 100644 --- a/iamidentityv1/iam_identity_v1_examples_test.go +++ b/iamidentityv1/iam_identity_v1_examples_test.go @@ -318,6 +318,38 @@ var _ = Describe(`IamIdentityV1 Examples Tests`, func() { Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) + It(`DisableAPIKey request example`, func() { + // begin-disable_api_key + + disableAPIKeyOptions := iamIdentityService.NewDisableAPIKeyOptions(apikeyID) + + response, err := iamIdentityService.DisableAPIKey(disableAPIKeyOptions) + if err != nil { + panic(err) + } + + // end-disable_api_key + fmt.Printf("\nDisableAPIKey() response status code: %d\n", response.StatusCode) + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + }) + It(`EnableAPIKey request example`, func() { + // begin-enable_api_key + + enableAPIKeyOptions := iamIdentityService.NewEnableAPIKeyOptions(apikeyID) + + response, err := iamIdentityService.EnableAPIKey(enableAPIKeyOptions) + if err != nil { + panic(err) + } + + // end-enable_api_key + fmt.Printf("\nEnableAPIKey() response status code: %d\n", response.StatusCode) + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + }) It(`DeleteAPIKey request example`, func() { // begin-delete_api_key diff --git a/iamidentityv1/iam_identity_v1_integration_test.go b/iamidentityv1/iam_identity_v1_integration_test.go index 67b9e3f1..5dab15a5 100644 --- a/iamidentityv1/iam_identity_v1_integration_test.go +++ b/iamidentityv1/iam_identity_v1_integration_test.go @@ -396,6 +396,50 @@ var _ = Describe(`IamIdentityV1 Integration Tests`, func() { }) }) + Describe(`DisableAPIKey - Enable the API key`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DisableAPIKey(disableAPIKeyOptions *DisableAPIKeyOptions)`, func() { + Expect(apikeyId2).ToNot(BeEmpty()) + + disableAPIKeyOptions := &iamidentityv1.DisableAPIKeyOptions{ + ID: &apikeyId2, + } + + response, err := iamIdentityService.DisableAPIKey(disableAPIKeyOptions) + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + + apiKey := getAPIkey(iamIdentityService, apikeyId2) + Expect(apiKey).ToNot(BeNil()) + Expect(*apiKey.Disabled).To(BeTrue()) + }) + }) + + Describe(`EnableAPIKey - Enable the API key`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`EnableAPIKey(enableAPIKeyOptions *EnableAPIKeyOptions)`, func() { + Expect(apikeyId2).ToNot(BeEmpty()) + + enableAPIKeyOptions := &iamidentityv1.EnableAPIKeyOptions{ + ID: &apikeyId2, + } + + response, err := iamIdentityService.EnableAPIKey(enableAPIKeyOptions) + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + + apiKey := getAPIkey(iamIdentityService, apikeyId2) + Expect(apiKey).ToNot(BeNil()) + Expect(*apiKey.Disabled).To(BeFalse()) + }) + }) + Describe(`DeleteAPIKey1 - Deletes an API key1`, func() { BeforeEach(func() { shouldSkipTest() diff --git a/iamidentityv1/iam_identity_v1_suite_test.go b/iamidentityv1/iam_identity_v1_suite_test.go index a9b46b3f..9c1ddeb7 100644 --- a/iamidentityv1/iam_identity_v1_suite_test.go +++ b/iamidentityv1/iam_identity_v1_suite_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/iamidentityv1/iam_identity_v1_test.go b/iamidentityv1/iam_identity_v1_test.go index 49d597d0..a9bcbc7b 100644 --- a/iamidentityv1/iam_identity_v1_test.go +++ b/iamidentityv1/iam_identity_v1_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package iamidentityv1_test import ( "bytes" "context" + "encoding/json" "fmt" "io" "net/http" @@ -251,7 +252,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "apikeys": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "apikeys": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) })) }) It(`Invoke ListAPIKeys successfully with retries`, func() { @@ -322,7 +323,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "apikeys": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "apikeys": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) })) }) It(`Invoke ListAPIKeys successfully`, func() { @@ -447,6 +448,8 @@ var _ = Describe(`IamIdentityV1`, func() { Expect(req.Method).To(Equal("POST")) Expect(req.Header["Entity-Lock"]).ToNot(BeNil()) Expect(req.Header["Entity-Lock"][0]).To(Equal(fmt.Sprintf("%v", "false"))) + Expect(req.Header["Entity-Disable"]).ToNot(BeNil()) + Expect(req.Header["Entity-Disable"][0]).To(Equal(fmt.Sprintf("%v", "false"))) res.Header().Set("Content-type", "application/json") res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) @@ -468,7 +471,10 @@ var _ = Describe(`IamIdentityV1`, func() { createAPIKeyOptionsModel.AccountID = core.StringPtr("testString") createAPIKeyOptionsModel.Apikey = core.StringPtr("testString") createAPIKeyOptionsModel.StoreValue = core.BoolPtr(true) + createAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + createAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") createAPIKeyOptionsModel.EntityLock = core.StringPtr("false") + createAPIKeyOptionsModel.EntityDisable = core.StringPtr("false") createAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := iamIdentityService.CreateAPIKey(createAPIKeyOptionsModel) @@ -517,13 +523,15 @@ var _ = Describe(`IamIdentityV1`, func() { Expect(req.Header["Entity-Lock"]).ToNot(BeNil()) Expect(req.Header["Entity-Lock"][0]).To(Equal(fmt.Sprintf("%v", "false"))) + Expect(req.Header["Entity-Disable"]).ToNot(BeNil()) + Expect(req.Header["Entity-Disable"][0]).To(Equal(fmt.Sprintf("%v", "false"))) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke CreateAPIKey successfully with retries`, func() { @@ -543,7 +551,10 @@ var _ = Describe(`IamIdentityV1`, func() { createAPIKeyOptionsModel.AccountID = core.StringPtr("testString") createAPIKeyOptionsModel.Apikey = core.StringPtr("testString") createAPIKeyOptionsModel.StoreValue = core.BoolPtr(true) + createAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + createAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") createAPIKeyOptionsModel.EntityLock = core.StringPtr("false") + createAPIKeyOptionsModel.EntityDisable = core.StringPtr("false") createAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -598,10 +609,12 @@ var _ = Describe(`IamIdentityV1`, func() { Expect(req.Header["Entity-Lock"]).ToNot(BeNil()) Expect(req.Header["Entity-Lock"][0]).To(Equal(fmt.Sprintf("%v", "false"))) + Expect(req.Header["Entity-Disable"]).ToNot(BeNil()) + Expect(req.Header["Entity-Disable"][0]).To(Equal(fmt.Sprintf("%v", "false"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke CreateAPIKey successfully`, func() { @@ -626,7 +639,10 @@ var _ = Describe(`IamIdentityV1`, func() { createAPIKeyOptionsModel.AccountID = core.StringPtr("testString") createAPIKeyOptionsModel.Apikey = core.StringPtr("testString") createAPIKeyOptionsModel.StoreValue = core.BoolPtr(true) + createAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + createAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") createAPIKeyOptionsModel.EntityLock = core.StringPtr("false") + createAPIKeyOptionsModel.EntityDisable = core.StringPtr("false") createAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -652,7 +668,10 @@ var _ = Describe(`IamIdentityV1`, func() { createAPIKeyOptionsModel.AccountID = core.StringPtr("testString") createAPIKeyOptionsModel.Apikey = core.StringPtr("testString") createAPIKeyOptionsModel.StoreValue = core.BoolPtr(true) + createAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + createAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") createAPIKeyOptionsModel.EntityLock = core.StringPtr("false") + createAPIKeyOptionsModel.EntityDisable = core.StringPtr("false") createAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := iamIdentityService.SetServiceURL("") @@ -699,7 +718,10 @@ var _ = Describe(`IamIdentityV1`, func() { createAPIKeyOptionsModel.AccountID = core.StringPtr("testString") createAPIKeyOptionsModel.Apikey = core.StringPtr("testString") createAPIKeyOptionsModel.StoreValue = core.BoolPtr(true) + createAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + createAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") createAPIKeyOptionsModel.EntityLock = core.StringPtr("false") + createAPIKeyOptionsModel.EntityDisable = core.StringPtr("false") createAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -784,7 +806,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke GetAPIKeysDetails successfully with retries`, func() { @@ -842,7 +864,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke GetAPIKeysDetails successfully`, func() { @@ -1002,7 +1024,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke GetAPIKey successfully with retries`, func() { @@ -1060,7 +1082,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke GetAPIKey successfully`, func() { @@ -1193,6 +1215,8 @@ var _ = Describe(`IamIdentityV1`, func() { updateAPIKeyOptionsModel.IfMatch = core.StringPtr("testString") updateAPIKeyOptionsModel.Name = core.StringPtr("testString") updateAPIKeyOptionsModel.Description = core.StringPtr("testString") + updateAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + updateAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") updateAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := iamIdentityService.UpdateAPIKey(updateAPIKeyOptionsModel) @@ -1247,7 +1271,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke UpdateAPIKey successfully with retries`, func() { @@ -1265,6 +1289,8 @@ var _ = Describe(`IamIdentityV1`, func() { updateAPIKeyOptionsModel.IfMatch = core.StringPtr("testString") updateAPIKeyOptionsModel.Name = core.StringPtr("testString") updateAPIKeyOptionsModel.Description = core.StringPtr("testString") + updateAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + updateAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") updateAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -1322,7 +1348,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke UpdateAPIKey successfully`, func() { @@ -1345,6 +1371,8 @@ var _ = Describe(`IamIdentityV1`, func() { updateAPIKeyOptionsModel.IfMatch = core.StringPtr("testString") updateAPIKeyOptionsModel.Name = core.StringPtr("testString") updateAPIKeyOptionsModel.Description = core.StringPtr("testString") + updateAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + updateAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") updateAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -1368,6 +1396,8 @@ var _ = Describe(`IamIdentityV1`, func() { updateAPIKeyOptionsModel.IfMatch = core.StringPtr("testString") updateAPIKeyOptionsModel.Name = core.StringPtr("testString") updateAPIKeyOptionsModel.Description = core.StringPtr("testString") + updateAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + updateAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") updateAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := iamIdentityService.SetServiceURL("") @@ -1412,6 +1442,8 @@ var _ = Describe(`IamIdentityV1`, func() { updateAPIKeyOptionsModel.IfMatch = core.StringPtr("testString") updateAPIKeyOptionsModel.Name = core.StringPtr("testString") updateAPIKeyOptionsModel.Description = core.StringPtr("testString") + updateAPIKeyOptionsModel.SupportSessions = core.BoolPtr(true) + updateAPIKeyOptionsModel.ActionWhenLeaked = core.StringPtr("testString") updateAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -1631,6 +1663,142 @@ var _ = Describe(`IamIdentityV1`, func() { }) }) }) + Describe(`DisableAPIKey(disableAPIKeyOptions *DisableAPIKeyOptions)`, func() { + disableAPIKeyPath := "/v1/apikeys/testString/disable" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(disableAPIKeyPath)) + Expect(req.Method).To(Equal("POST")) + + res.WriteHeader(204) + })) + }) + It(`Invoke DisableAPIKey successfully`, func() { + iamIdentityService, serviceErr := iamidentityv1.NewIamIdentityV1(&iamidentityv1.IamIdentityV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(iamIdentityService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := iamIdentityService.DisableAPIKey(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DisableAPIKeyOptions model + disableAPIKeyOptionsModel := new(iamidentityv1.DisableAPIKeyOptions) + disableAPIKeyOptionsModel.ID = core.StringPtr("testString") + disableAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = iamIdentityService.DisableAPIKey(disableAPIKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DisableAPIKey with error: Operation validation and request error`, func() { + iamIdentityService, serviceErr := iamidentityv1.NewIamIdentityV1(&iamidentityv1.IamIdentityV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(iamIdentityService).ToNot(BeNil()) + + // Construct an instance of the DisableAPIKeyOptions model + disableAPIKeyOptionsModel := new(iamidentityv1.DisableAPIKeyOptions) + disableAPIKeyOptionsModel.ID = core.StringPtr("testString") + disableAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := iamIdentityService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := iamIdentityService.DisableAPIKey(disableAPIKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DisableAPIKeyOptions model with no property values + disableAPIKeyOptionsModelNew := new(iamidentityv1.DisableAPIKeyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = iamIdentityService.DisableAPIKey(disableAPIKeyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`EnableAPIKey(enableAPIKeyOptions *EnableAPIKeyOptions)`, func() { + enableAPIKeyPath := "/v1/apikeys/testString/disable" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(enableAPIKeyPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(204) + })) + }) + It(`Invoke EnableAPIKey successfully`, func() { + iamIdentityService, serviceErr := iamidentityv1.NewIamIdentityV1(&iamidentityv1.IamIdentityV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(iamIdentityService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := iamIdentityService.EnableAPIKey(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the EnableAPIKeyOptions model + enableAPIKeyOptionsModel := new(iamidentityv1.EnableAPIKeyOptions) + enableAPIKeyOptionsModel.ID = core.StringPtr("testString") + enableAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = iamIdentityService.EnableAPIKey(enableAPIKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke EnableAPIKey with error: Operation validation and request error`, func() { + iamIdentityService, serviceErr := iamidentityv1.NewIamIdentityV1(&iamidentityv1.IamIdentityV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(iamIdentityService).ToNot(BeNil()) + + // Construct an instance of the EnableAPIKeyOptions model + enableAPIKeyOptionsModel := new(iamidentityv1.EnableAPIKeyOptions) + enableAPIKeyOptionsModel.ID = core.StringPtr("testString") + enableAPIKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := iamIdentityService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := iamIdentityService.EnableAPIKey(enableAPIKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the EnableAPIKeyOptions model with no property values + enableAPIKeyOptionsModelNew := new(iamidentityv1.EnableAPIKeyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = iamIdentityService.EnableAPIKey(enableAPIKeyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) Describe(`ListServiceIds(listServiceIdsOptions *ListServiceIdsOptions) - Operation response error`, func() { listServiceIdsPath := "/v1/serviceids/" Context(`Using mock server endpoint with invalid JSON response`, func() { @@ -1713,7 +1881,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "serviceids": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "serviceids": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) })) }) It(`Invoke ListServiceIds successfully with retries`, func() { @@ -1780,7 +1948,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "serviceids": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "offset": 6, "limit": 5, "first": "First", "previous": "Previous", "next": "Next", "serviceids": [{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}]}`) })) }) It(`Invoke ListServiceIds successfully`, func() { @@ -1981,7 +2149,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke CreateServiceID successfully with retries`, func() { @@ -2065,7 +2233,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke CreateServiceID successfully`, func() { @@ -2265,7 +2433,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke GetServiceID successfully with retries`, func() { @@ -2323,7 +2491,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke GetServiceID successfully`, func() { @@ -2511,7 +2679,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke UpdateServiceID successfully with retries`, func() { @@ -2587,7 +2755,7 @@ var _ = Describe(`IamIdentityV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) + fmt.Fprintf(res, "%s", `{"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "iam_id": "IamID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "account_id": "AccountID", "name": "Name", "description": "Description", "unique_instance_crns": ["UniqueInstanceCrns"], "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "apikey": {"context": {"transaction_id": "TransactionID", "operation": "Operation", "user_agent": "UserAgent", "url": "URL", "instance_id": "InstanceID", "thread_id": "ThreadID", "host": "Host", "start_time": "StartTime", "end_time": "EndTime", "elapsed_time": "ElapsedTime", "cluster_name": "ClusterName"}, "id": "ID", "entity_tag": "EntityTag", "crn": "CRN", "locked": true, "disabled": true, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "modified_at": "2019-01-01T12:00:00.000Z", "name": "Name", "support_sessions": false, "action_when_leaked": "ActionWhenLeaked", "description": "Description", "iam_id": "IamID", "account_id": "AccountID", "apikey": "Apikey", "history": [{"timestamp": "Timestamp", "iam_id": "IamID", "iam_id_account": "IamIDAccount", "action": "Action", "params": ["Params"], "message": "Message"}], "activity": {"last_authn": "LastAuthn", "authn_count": 10}}, "activity": {"last_authn": "LastAuthn", "authn_count": 10}}`) })) }) It(`Invoke UpdateServiceID successfully`, func() { @@ -16064,7 +16232,10 @@ var _ = Describe(`IamIdentityV1`, func() { createAPIKeyOptionsModel.SetAccountID("testString") createAPIKeyOptionsModel.SetApikey("testString") createAPIKeyOptionsModel.SetStoreValue(true) + createAPIKeyOptionsModel.SetSupportSessions(true) + createAPIKeyOptionsModel.SetActionWhenLeaked("testString") createAPIKeyOptionsModel.SetEntityLock("false") + createAPIKeyOptionsModel.SetEntityDisable("false") createAPIKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createAPIKeyOptionsModel).ToNot(BeNil()) Expect(createAPIKeyOptionsModel.Name).To(Equal(core.StringPtr("testString"))) @@ -16073,7 +16244,10 @@ var _ = Describe(`IamIdentityV1`, func() { Expect(createAPIKeyOptionsModel.AccountID).To(Equal(core.StringPtr("testString"))) Expect(createAPIKeyOptionsModel.Apikey).To(Equal(core.StringPtr("testString"))) Expect(createAPIKeyOptionsModel.StoreValue).To(Equal(core.BoolPtr(true))) + Expect(createAPIKeyOptionsModel.SupportSessions).To(Equal(core.BoolPtr(true))) + Expect(createAPIKeyOptionsModel.ActionWhenLeaked).To(Equal(core.StringPtr("testString"))) Expect(createAPIKeyOptionsModel.EntityLock).To(Equal(core.StringPtr("false"))) + Expect(createAPIKeyOptionsModel.EntityDisable).To(Equal(core.StringPtr("false"))) Expect(createAPIKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateClaimRuleOptions successfully`, func() { @@ -16553,6 +16727,26 @@ var _ = Describe(`IamIdentityV1`, func() { Expect(deleteTrustedProfileAssignmentOptionsModel.AssignmentID).To(Equal(core.StringPtr("testString"))) Expect(deleteTrustedProfileAssignmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDisableAPIKeyOptions successfully`, func() { + // Construct an instance of the DisableAPIKeyOptions model + id := "testString" + disableAPIKeyOptionsModel := iamIdentityService.NewDisableAPIKeyOptions(id) + disableAPIKeyOptionsModel.SetID("testString") + disableAPIKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(disableAPIKeyOptionsModel).ToNot(BeNil()) + Expect(disableAPIKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(disableAPIKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewEnableAPIKeyOptions successfully`, func() { + // Construct an instance of the EnableAPIKeyOptions model + id := "testString" + enableAPIKeyOptionsModel := iamIdentityService.NewEnableAPIKeyOptions(id) + enableAPIKeyOptionsModel.SetID("testString") + enableAPIKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(enableAPIKeyOptionsModel).ToNot(BeNil()) + Expect(enableAPIKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(enableAPIKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetAccountSettingsAssignmentOptions successfully`, func() { // Construct an instance of the GetAccountSettingsAssignmentOptions model assignmentID := "testString" @@ -17252,12 +17446,16 @@ var _ = Describe(`IamIdentityV1`, func() { updateAPIKeyOptionsModel.SetIfMatch("testString") updateAPIKeyOptionsModel.SetName("testString") updateAPIKeyOptionsModel.SetDescription("testString") + updateAPIKeyOptionsModel.SetSupportSessions(true) + updateAPIKeyOptionsModel.SetActionWhenLeaked("testString") updateAPIKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateAPIKeyOptionsModel).ToNot(BeNil()) Expect(updateAPIKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateAPIKeyOptionsModel.IfMatch).To(Equal(core.StringPtr("testString"))) Expect(updateAPIKeyOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(updateAPIKeyOptionsModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(updateAPIKeyOptionsModel.SupportSessions).To(Equal(core.BoolPtr(true))) + Expect(updateAPIKeyOptionsModel.ActionWhenLeaked).To(Equal(core.StringPtr("testString"))) Expect(updateAPIKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateClaimRuleOptions successfully`, func() { @@ -17464,6 +17662,227 @@ var _ = Describe(`IamIdentityV1`, func() { }) }) }) + Describe(`Model unmarshaling tests`, func() { + It(`Invoke UnmarshalAccountSettingsComponent successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.AccountSettingsComponent) + model.RestrictCreateServiceID = core.StringPtr("NOT_SET") + model.RestrictCreatePlatformApikey = core.StringPtr("NOT_SET") + model.AllowedIPAddresses = core.StringPtr("testString") + model.Mfa = core.StringPtr("NONE") + model.UserMfa = nil + model.SessionExpirationInSeconds = core.StringPtr("86400") + model.SessionInvalidationInSeconds = core.StringPtr("7200") + model.MaxSessionsPerIdentity = core.StringPtr("testString") + model.SystemAccessTokenExpirationInSeconds = core.StringPtr("3600") + model.SystemRefreshTokenExpirationInSeconds = core.StringPtr("259200") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.AccountSettingsComponent + err = iamidentityv1.UnmarshalAccountSettingsComponent(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalAccountSettingsUserMfa successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.AccountSettingsUserMfa) + model.IamID = core.StringPtr("testString") + model.Mfa = core.StringPtr("NONE") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.AccountSettingsUserMfa + err = iamidentityv1.UnmarshalAccountSettingsUserMfa(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalAPIKeyInsideCreateServiceIDRequest successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.APIKeyInsideCreateServiceIDRequest) + model.Name = core.StringPtr("testString") + model.Description = core.StringPtr("testString") + model.Apikey = core.StringPtr("testString") + model.StoreValue = core.BoolPtr(true) + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.APIKeyInsideCreateServiceIDRequest + err = iamidentityv1.UnmarshalAPIKeyInsideCreateServiceIDRequest(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalCreateProfileLinkRequestLink successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.CreateProfileLinkRequestLink) + model.CRN = core.StringPtr("testString") + model.Namespace = core.StringPtr("testString") + model.Name = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.CreateProfileLinkRequestLink + err = iamidentityv1.UnmarshalCreateProfileLinkRequestLink(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalPolicyTemplateReference successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.PolicyTemplateReference) + model.ID = core.StringPtr("testString") + model.Version = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.PolicyTemplateReference + err = iamidentityv1.UnmarshalPolicyTemplateReference(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalProfileClaimRuleConditions successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.ProfileClaimRuleConditions) + model.Claim = core.StringPtr("testString") + model.Operator = core.StringPtr("testString") + model.Value = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.ProfileClaimRuleConditions + err = iamidentityv1.UnmarshalProfileClaimRuleConditions(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalProfileIdentityRequest successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.ProfileIdentityRequest) + model.Identifier = core.StringPtr("testString") + model.Type = core.StringPtr("user") + model.Accounts = []string{"testString"} + model.Description = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.ProfileIdentityRequest + err = iamidentityv1.UnmarshalProfileIdentityRequest(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalResponseContext successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.ResponseContext) + model.TransactionID = core.StringPtr("testString") + model.Operation = core.StringPtr("testString") + model.UserAgent = core.StringPtr("testString") + model.URL = core.StringPtr("testString") + model.InstanceID = core.StringPtr("testString") + model.ThreadID = core.StringPtr("testString") + model.Host = core.StringPtr("testString") + model.StartTime = core.StringPtr("testString") + model.EndTime = core.StringPtr("testString") + model.ElapsedTime = core.StringPtr("testString") + model.ClusterName = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.ResponseContext + err = iamidentityv1.UnmarshalResponseContext(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalTemplateProfileComponentRequest successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.TemplateProfileComponentRequest) + model.Name = core.StringPtr("testString") + model.Description = core.StringPtr("testString") + model.Rules = nil + model.Identities = nil + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.TemplateProfileComponentRequest + err = iamidentityv1.UnmarshalTemplateProfileComponentRequest(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalTrustedProfileTemplateClaimRule successfully`, func() { + // Construct an instance of the model. + model := new(iamidentityv1.TrustedProfileTemplateClaimRule) + model.Name = core.StringPtr("testString") + model.Type = core.StringPtr("Profile-SAML") + model.RealmName = core.StringPtr("testString") + model.Expiration = core.Int64Ptr(int64(38)) + model.Conditions = nil + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *iamidentityv1.TrustedProfileTemplateClaimRule + err = iamidentityv1.UnmarshalTrustedProfileTemplateClaimRule(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + }) + Describe(`Utility function tests`, func() { It(`Invoke CreateMockByteArray() successfully`, func() { mockByteArray := CreateMockByteArray("This is a test") @@ -17493,8 +17912,7 @@ var _ = Describe(`IamIdentityV1`, func() { // func CreateMockByteArray(mockData string) *[]byte { - ba := make([]byte, 0) - ba = append(ba, mockData...) + ba := []byte(mockData) return &ba }