1// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. 2// Code generated. DO NOT EDIT. 3 4// Identity and Access Management Service API 5// 6// APIs for managing users, groups, compartments, and policies. 7// 8 9package identity 10 11import ( 12 "context" 13 "fmt" 14 "github.com/oracle/oci-go-sdk/common" 15 "net/http" 16) 17 18//IdentityClient a client for Identity 19type IdentityClient struct { 20 common.BaseClient 21 config *common.ConfigurationProvider 22} 23 24// NewIdentityClientWithConfigurationProvider Creates a new default Identity client with the given configuration provider. 25// the configuration provider will be used for the default signer as well as reading the region 26func NewIdentityClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client IdentityClient, err error) { 27 baseClient, err := common.NewClientWithConfig(configProvider) 28 if err != nil { 29 return 30 } 31 32 client = IdentityClient{BaseClient: baseClient} 33 client.BasePath = "20160918" 34 err = client.setConfigurationProvider(configProvider) 35 return 36} 37 38// SetRegion overrides the region of this client. 39func (client *IdentityClient) SetRegion(region string) { 40 client.Host = common.StringToRegion(region).Endpoint("identity") 41} 42 43// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid 44func (client *IdentityClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { 45 if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { 46 return err 47 } 48 49 // Error has been checked already 50 region, _ := configProvider.Region() 51 client.SetRegion(region) 52 client.config = &configProvider 53 return nil 54} 55 56// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set 57func (client *IdentityClient) ConfigurationProvider() *common.ConfigurationProvider { 58 return client.config 59} 60 61// ActivateMfaTotpDevice Activates the specified MFA TOTP device for the user. Activation requires manual interaction with the Console. 62func (client IdentityClient) ActivateMfaTotpDevice(ctx context.Context, request ActivateMfaTotpDeviceRequest) (response ActivateMfaTotpDeviceResponse, err error) { 63 var ociResponse common.OCIResponse 64 policy := common.NoRetryPolicy() 65 if request.RetryPolicy() != nil { 66 policy = *request.RetryPolicy() 67 } 68 69 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 70 request.OpcRetryToken = common.String(common.RetryToken()) 71 } 72 73 ociResponse, err = common.Retry(ctx, request, client.activateMfaTotpDevice, policy) 74 if err != nil { 75 if ociResponse != nil { 76 response = ActivateMfaTotpDeviceResponse{RawResponse: ociResponse.HTTPResponse()} 77 } 78 return 79 } 80 if convertedResponse, ok := ociResponse.(ActivateMfaTotpDeviceResponse); ok { 81 response = convertedResponse 82 } else { 83 err = fmt.Errorf("failed to convert OCIResponse into ActivateMfaTotpDeviceResponse") 84 } 85 return 86} 87 88// activateMfaTotpDevice implements the OCIOperation interface (enables retrying operations) 89func (client IdentityClient) activateMfaTotpDevice(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 90 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}/actions/activate") 91 if err != nil { 92 return nil, err 93 } 94 95 var response ActivateMfaTotpDeviceResponse 96 var httpResponse *http.Response 97 httpResponse, err = client.Call(ctx, &httpRequest) 98 defer common.CloseBodyIfValid(httpResponse) 99 response.RawResponse = httpResponse 100 if err != nil { 101 return response, err 102 } 103 104 err = common.UnmarshalResponse(httpResponse, &response) 105 return response, err 106} 107 108// AddUserToGroup Adds the specified user to the specified group and returns a `UserGroupMembership` object with its own OCID. 109// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the 110// object, first make sure its `lifecycleState` has changed to ACTIVE. 111func (client IdentityClient) AddUserToGroup(ctx context.Context, request AddUserToGroupRequest) (response AddUserToGroupResponse, err error) { 112 var ociResponse common.OCIResponse 113 policy := common.NoRetryPolicy() 114 if request.RetryPolicy() != nil { 115 policy = *request.RetryPolicy() 116 } 117 118 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 119 request.OpcRetryToken = common.String(common.RetryToken()) 120 } 121 122 ociResponse, err = common.Retry(ctx, request, client.addUserToGroup, policy) 123 if err != nil { 124 if ociResponse != nil { 125 response = AddUserToGroupResponse{RawResponse: ociResponse.HTTPResponse()} 126 } 127 return 128 } 129 if convertedResponse, ok := ociResponse.(AddUserToGroupResponse); ok { 130 response = convertedResponse 131 } else { 132 err = fmt.Errorf("failed to convert OCIResponse into AddUserToGroupResponse") 133 } 134 return 135} 136 137// addUserToGroup implements the OCIOperation interface (enables retrying operations) 138func (client IdentityClient) addUserToGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 139 httpRequest, err := request.HTTPRequest(http.MethodPost, "/userGroupMemberships") 140 if err != nil { 141 return nil, err 142 } 143 144 var response AddUserToGroupResponse 145 var httpResponse *http.Response 146 httpResponse, err = client.Call(ctx, &httpRequest) 147 defer common.CloseBodyIfValid(httpResponse) 148 response.RawResponse = httpResponse 149 if err != nil { 150 return response, err 151 } 152 153 err = common.UnmarshalResponse(httpResponse, &response) 154 return response, err 155} 156 157// AssembleEffectiveTagSet Assembles tag defaults in the specified compartment and any parent compartments to determine 158// the tags to apply. Tag defaults from parent compartments do not override tag defaults 159// referencing the same tag in a compartment lower down the hierarchy. This set of tag defaults 160// includes all tag defaults from the current compartment back to the root compartment. 161func (client IdentityClient) AssembleEffectiveTagSet(ctx context.Context, request AssembleEffectiveTagSetRequest) (response AssembleEffectiveTagSetResponse, err error) { 162 var ociResponse common.OCIResponse 163 policy := common.NoRetryPolicy() 164 if request.RetryPolicy() != nil { 165 policy = *request.RetryPolicy() 166 } 167 ociResponse, err = common.Retry(ctx, request, client.assembleEffectiveTagSet, policy) 168 if err != nil { 169 if ociResponse != nil { 170 response = AssembleEffectiveTagSetResponse{RawResponse: ociResponse.HTTPResponse()} 171 } 172 return 173 } 174 if convertedResponse, ok := ociResponse.(AssembleEffectiveTagSetResponse); ok { 175 response = convertedResponse 176 } else { 177 err = fmt.Errorf("failed to convert OCIResponse into AssembleEffectiveTagSetResponse") 178 } 179 return 180} 181 182// assembleEffectiveTagSet implements the OCIOperation interface (enables retrying operations) 183func (client IdentityClient) assembleEffectiveTagSet(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 184 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagDefaults/actions/assembleEffectiveTagSet") 185 if err != nil { 186 return nil, err 187 } 188 189 var response AssembleEffectiveTagSetResponse 190 var httpResponse *http.Response 191 httpResponse, err = client.Call(ctx, &httpRequest) 192 defer common.CloseBodyIfValid(httpResponse) 193 response.RawResponse = httpResponse 194 if err != nil { 195 return response, err 196 } 197 198 err = common.UnmarshalResponse(httpResponse, &response) 199 return response, err 200} 201 202// ChangeTagNamespaceCompartment Moves the specified tag namespace to the specified compartment within the same tenancy. 203// To move the tag namespace, you must have the manage tag-namespaces permission on both compartments. 204// For more information about IAM policies, see Details for IAM (https://docs.cloud.oracle.com/Content/Identity/Reference/iampolicyreference.htm). 205// Moving a tag namespace moves all the tag key definitions contained in the tag namespace. 206func (client IdentityClient) ChangeTagNamespaceCompartment(ctx context.Context, request ChangeTagNamespaceCompartmentRequest) (response ChangeTagNamespaceCompartmentResponse, err error) { 207 var ociResponse common.OCIResponse 208 policy := common.NoRetryPolicy() 209 if request.RetryPolicy() != nil { 210 policy = *request.RetryPolicy() 211 } 212 213 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 214 request.OpcRetryToken = common.String(common.RetryToken()) 215 } 216 217 ociResponse, err = common.Retry(ctx, request, client.changeTagNamespaceCompartment, policy) 218 if err != nil { 219 if ociResponse != nil { 220 response = ChangeTagNamespaceCompartmentResponse{RawResponse: ociResponse.HTTPResponse()} 221 } 222 return 223 } 224 if convertedResponse, ok := ociResponse.(ChangeTagNamespaceCompartmentResponse); ok { 225 response = convertedResponse 226 } else { 227 err = fmt.Errorf("failed to convert OCIResponse into ChangeTagNamespaceCompartmentResponse") 228 } 229 return 230} 231 232// changeTagNamespaceCompartment implements the OCIOperation interface (enables retrying operations) 233func (client IdentityClient) changeTagNamespaceCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 234 httpRequest, err := request.HTTPRequest(http.MethodPost, "/tagNamespaces/{tagNamespaceId}/actions/changeCompartment") 235 if err != nil { 236 return nil, err 237 } 238 239 var response ChangeTagNamespaceCompartmentResponse 240 var httpResponse *http.Response 241 httpResponse, err = client.Call(ctx, &httpRequest) 242 defer common.CloseBodyIfValid(httpResponse) 243 response.RawResponse = httpResponse 244 if err != nil { 245 return response, err 246 } 247 248 err = common.UnmarshalResponse(httpResponse, &response) 249 return response, err 250} 251 252// CreateAuthToken Creates a new auth token for the specified user. For information about what auth tokens are for, see 253// Managing User Credentials (https://docs.cloud.oracle.com/Content/Identity/Tasks/managingcredentials.htm). 254// You must specify a *description* for the auth token (although it can be an empty string). It does not 255// have to be unique, and you can change it anytime with 256// UpdateAuthToken. 257// Every user has permission to create an auth token for *their own user ID*. An administrator in your organization 258// does not need to write a policy to give users this ability. To compare, administrators who have permission to the 259// tenancy can use this operation to create an auth token for any user, including themselves. 260func (client IdentityClient) CreateAuthToken(ctx context.Context, request CreateAuthTokenRequest) (response CreateAuthTokenResponse, err error) { 261 var ociResponse common.OCIResponse 262 policy := common.NoRetryPolicy() 263 if request.RetryPolicy() != nil { 264 policy = *request.RetryPolicy() 265 } 266 267 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 268 request.OpcRetryToken = common.String(common.RetryToken()) 269 } 270 271 ociResponse, err = common.Retry(ctx, request, client.createAuthToken, policy) 272 if err != nil { 273 if ociResponse != nil { 274 response = CreateAuthTokenResponse{RawResponse: ociResponse.HTTPResponse()} 275 } 276 return 277 } 278 if convertedResponse, ok := ociResponse.(CreateAuthTokenResponse); ok { 279 response = convertedResponse 280 } else { 281 err = fmt.Errorf("failed to convert OCIResponse into CreateAuthTokenResponse") 282 } 283 return 284} 285 286// createAuthToken implements the OCIOperation interface (enables retrying operations) 287func (client IdentityClient) createAuthToken(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 288 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/authTokens") 289 if err != nil { 290 return nil, err 291 } 292 293 var response CreateAuthTokenResponse 294 var httpResponse *http.Response 295 httpResponse, err = client.Call(ctx, &httpRequest) 296 defer common.CloseBodyIfValid(httpResponse) 297 response.RawResponse = httpResponse 298 if err != nil { 299 return response, err 300 } 301 302 err = common.UnmarshalResponse(httpResponse, &response) 303 return response, err 304} 305 306// CreateCompartment Creates a new compartment in the specified compartment. 307// **Important:** Compartments cannot be deleted. 308// Specify the parent compartment's OCID as the compartment ID in the request object. Remember that the tenancy 309// is simply the root compartment. For information about OCIDs, see 310// Resource Identifiers (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm). 311// You must also specify a *name* for the compartment, which must be unique across all compartments in 312// your tenancy. You can use this name or the OCID when writing policies that apply 313// to the compartment. For more information about policies, see 314// How Policies Work (https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm). 315// You must also specify a *description* for the compartment (although it can be an empty string). It does 316// not have to be unique, and you can change it anytime with 317// UpdateCompartment. 318// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the 319// object, first make sure its `lifecycleState` has changed to ACTIVE. 320func (client IdentityClient) CreateCompartment(ctx context.Context, request CreateCompartmentRequest) (response CreateCompartmentResponse, err error) { 321 var ociResponse common.OCIResponse 322 policy := common.NoRetryPolicy() 323 if request.RetryPolicy() != nil { 324 policy = *request.RetryPolicy() 325 } 326 327 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 328 request.OpcRetryToken = common.String(common.RetryToken()) 329 } 330 331 ociResponse, err = common.Retry(ctx, request, client.createCompartment, policy) 332 if err != nil { 333 if ociResponse != nil { 334 response = CreateCompartmentResponse{RawResponse: ociResponse.HTTPResponse()} 335 } 336 return 337 } 338 if convertedResponse, ok := ociResponse.(CreateCompartmentResponse); ok { 339 response = convertedResponse 340 } else { 341 err = fmt.Errorf("failed to convert OCIResponse into CreateCompartmentResponse") 342 } 343 return 344} 345 346// createCompartment implements the OCIOperation interface (enables retrying operations) 347func (client IdentityClient) createCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 348 httpRequest, err := request.HTTPRequest(http.MethodPost, "/compartments") 349 if err != nil { 350 return nil, err 351 } 352 353 var response CreateCompartmentResponse 354 var httpResponse *http.Response 355 httpResponse, err = client.Call(ctx, &httpRequest) 356 defer common.CloseBodyIfValid(httpResponse) 357 response.RawResponse = httpResponse 358 if err != nil { 359 return response, err 360 } 361 362 err = common.UnmarshalResponse(httpResponse, &response) 363 return response, err 364} 365 366// CreateCustomerSecretKey Creates a new secret key for the specified user. Secret keys are used for authentication with the Object Storage Service's Amazon S3 367// compatible API. For information, see 368// Managing User Credentials (https://docs.cloud.oracle.com/Content/Identity/Tasks/managingcredentials.htm). 369// You must specify a *description* for the secret key (although it can be an empty string). It does not 370// have to be unique, and you can change it anytime with 371// UpdateCustomerSecretKey. 372// Every user has permission to create a secret key for *their own user ID*. An administrator in your organization 373// does not need to write a policy to give users this ability. To compare, administrators who have permission to the 374// tenancy can use this operation to create a secret key for any user, including themselves. 375func (client IdentityClient) CreateCustomerSecretKey(ctx context.Context, request CreateCustomerSecretKeyRequest) (response CreateCustomerSecretKeyResponse, err error) { 376 var ociResponse common.OCIResponse 377 policy := common.NoRetryPolicy() 378 if request.RetryPolicy() != nil { 379 policy = *request.RetryPolicy() 380 } 381 382 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 383 request.OpcRetryToken = common.String(common.RetryToken()) 384 } 385 386 ociResponse, err = common.Retry(ctx, request, client.createCustomerSecretKey, policy) 387 if err != nil { 388 if ociResponse != nil { 389 response = CreateCustomerSecretKeyResponse{RawResponse: ociResponse.HTTPResponse()} 390 } 391 return 392 } 393 if convertedResponse, ok := ociResponse.(CreateCustomerSecretKeyResponse); ok { 394 response = convertedResponse 395 } else { 396 err = fmt.Errorf("failed to convert OCIResponse into CreateCustomerSecretKeyResponse") 397 } 398 return 399} 400 401// createCustomerSecretKey implements the OCIOperation interface (enables retrying operations) 402func (client IdentityClient) createCustomerSecretKey(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 403 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/customerSecretKeys") 404 if err != nil { 405 return nil, err 406 } 407 408 var response CreateCustomerSecretKeyResponse 409 var httpResponse *http.Response 410 httpResponse, err = client.Call(ctx, &httpRequest) 411 defer common.CloseBodyIfValid(httpResponse) 412 response.RawResponse = httpResponse 413 if err != nil { 414 return response, err 415 } 416 417 err = common.UnmarshalResponse(httpResponse, &response) 418 return response, err 419} 420 421// CreateDynamicGroup Creates a new dynamic group in your tenancy. 422// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy 423// is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies) 424// reside within the tenancy itself, unlike cloud resources such as compute instances, which typically 425// reside within compartments inside the tenancy. For information about OCIDs, see 426// Resource Identifiers (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm). 427// You must also specify a *name* for the dynamic group, which must be unique across all dynamic groups in your 428// tenancy, and cannot be changed. Note that this name has to be also unique across all groups in your tenancy. 429// You can use this name or the OCID when writing policies that apply to the dynamic group. For more information 430// about policies, see How Policies Work (https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm). 431// You must also specify a *description* for the dynamic group (although it can be an empty string). It does not 432// have to be unique, and you can change it anytime with UpdateDynamicGroup. 433// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the 434// object, first make sure its `lifecycleState` has changed to ACTIVE. 435func (client IdentityClient) CreateDynamicGroup(ctx context.Context, request CreateDynamicGroupRequest) (response CreateDynamicGroupResponse, err error) { 436 var ociResponse common.OCIResponse 437 policy := common.NoRetryPolicy() 438 if request.RetryPolicy() != nil { 439 policy = *request.RetryPolicy() 440 } 441 442 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 443 request.OpcRetryToken = common.String(common.RetryToken()) 444 } 445 446 ociResponse, err = common.Retry(ctx, request, client.createDynamicGroup, policy) 447 if err != nil { 448 if ociResponse != nil { 449 response = CreateDynamicGroupResponse{RawResponse: ociResponse.HTTPResponse()} 450 } 451 return 452 } 453 if convertedResponse, ok := ociResponse.(CreateDynamicGroupResponse); ok { 454 response = convertedResponse 455 } else { 456 err = fmt.Errorf("failed to convert OCIResponse into CreateDynamicGroupResponse") 457 } 458 return 459} 460 461// createDynamicGroup implements the OCIOperation interface (enables retrying operations) 462func (client IdentityClient) createDynamicGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 463 httpRequest, err := request.HTTPRequest(http.MethodPost, "/dynamicGroups") 464 if err != nil { 465 return nil, err 466 } 467 468 var response CreateDynamicGroupResponse 469 var httpResponse *http.Response 470 httpResponse, err = client.Call(ctx, &httpRequest) 471 defer common.CloseBodyIfValid(httpResponse) 472 response.RawResponse = httpResponse 473 if err != nil { 474 return response, err 475 } 476 477 err = common.UnmarshalResponse(httpResponse, &response) 478 return response, err 479} 480 481// CreateGroup Creates a new group in your tenancy. 482// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy 483// is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies) 484// reside within the tenancy itself, unlike cloud resources such as compute instances, which typically 485// reside within compartments inside the tenancy. For information about OCIDs, see 486// Resource Identifiers (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm). 487// You must also specify a *name* for the group, which must be unique across all groups in your tenancy and 488// cannot be changed. You can use this name or the OCID when writing policies that apply to the group. For more 489// information about policies, see How Policies Work (https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm). 490// You must also specify a *description* for the group (although it can be an empty string). It does not 491// have to be unique, and you can change it anytime with UpdateGroup. 492// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the 493// object, first make sure its `lifecycleState` has changed to ACTIVE. 494// After creating the group, you need to put users in it and write policies for it. 495// See AddUserToGroup and 496// CreatePolicy. 497func (client IdentityClient) CreateGroup(ctx context.Context, request CreateGroupRequest) (response CreateGroupResponse, err error) { 498 var ociResponse common.OCIResponse 499 policy := common.NoRetryPolicy() 500 if request.RetryPolicy() != nil { 501 policy = *request.RetryPolicy() 502 } 503 504 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 505 request.OpcRetryToken = common.String(common.RetryToken()) 506 } 507 508 ociResponse, err = common.Retry(ctx, request, client.createGroup, policy) 509 if err != nil { 510 if ociResponse != nil { 511 response = CreateGroupResponse{RawResponse: ociResponse.HTTPResponse()} 512 } 513 return 514 } 515 if convertedResponse, ok := ociResponse.(CreateGroupResponse); ok { 516 response = convertedResponse 517 } else { 518 err = fmt.Errorf("failed to convert OCIResponse into CreateGroupResponse") 519 } 520 return 521} 522 523// createGroup implements the OCIOperation interface (enables retrying operations) 524func (client IdentityClient) createGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 525 httpRequest, err := request.HTTPRequest(http.MethodPost, "/groups") 526 if err != nil { 527 return nil, err 528 } 529 530 var response CreateGroupResponse 531 var httpResponse *http.Response 532 httpResponse, err = client.Call(ctx, &httpRequest) 533 defer common.CloseBodyIfValid(httpResponse) 534 response.RawResponse = httpResponse 535 if err != nil { 536 return response, err 537 } 538 539 err = common.UnmarshalResponse(httpResponse, &response) 540 return response, err 541} 542 543// CreateIdentityProvider Creates a new identity provider in your tenancy. For more information, see 544// Identity Providers and Federation (https://docs.cloud.oracle.com/Content/Identity/Concepts/federation.htm). 545// You must specify your tenancy's OCID as the compartment ID in the request object. 546// Remember that the tenancy is simply the root compartment. For information about 547// OCIDs, see Resource Identifiers (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm). 548// You must also specify a *name* for the `IdentityProvider`, which must be unique 549// across all `IdentityProvider` objects in your tenancy and cannot be changed. 550// You must also specify a *description* for the `IdentityProvider` (although 551// it can be an empty string). It does not have to be unique, and you can change 552// it anytime with 553// UpdateIdentityProvider. 554// After you send your request, the new object's `lifecycleState` will temporarily 555// be CREATING. Before using the object, first make sure its `lifecycleState` has 556// changed to ACTIVE. 557func (client IdentityClient) CreateIdentityProvider(ctx context.Context, request CreateIdentityProviderRequest) (response CreateIdentityProviderResponse, err error) { 558 var ociResponse common.OCIResponse 559 policy := common.NoRetryPolicy() 560 if request.RetryPolicy() != nil { 561 policy = *request.RetryPolicy() 562 } 563 564 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 565 request.OpcRetryToken = common.String(common.RetryToken()) 566 } 567 568 ociResponse, err = common.Retry(ctx, request, client.createIdentityProvider, policy) 569 if err != nil { 570 if ociResponse != nil { 571 response = CreateIdentityProviderResponse{RawResponse: ociResponse.HTTPResponse()} 572 } 573 return 574 } 575 if convertedResponse, ok := ociResponse.(CreateIdentityProviderResponse); ok { 576 response = convertedResponse 577 } else { 578 err = fmt.Errorf("failed to convert OCIResponse into CreateIdentityProviderResponse") 579 } 580 return 581} 582 583// createIdentityProvider implements the OCIOperation interface (enables retrying operations) 584func (client IdentityClient) createIdentityProvider(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 585 httpRequest, err := request.HTTPRequest(http.MethodPost, "/identityProviders") 586 if err != nil { 587 return nil, err 588 } 589 590 var response CreateIdentityProviderResponse 591 var httpResponse *http.Response 592 httpResponse, err = client.Call(ctx, &httpRequest) 593 defer common.CloseBodyIfValid(httpResponse) 594 response.RawResponse = httpResponse 595 if err != nil { 596 return response, err 597 } 598 599 err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &identityprovider{}) 600 return response, err 601} 602 603// CreateIdpGroupMapping Creates a single mapping between an IdP group and an IAM Service 604// Group. 605func (client IdentityClient) CreateIdpGroupMapping(ctx context.Context, request CreateIdpGroupMappingRequest) (response CreateIdpGroupMappingResponse, err error) { 606 var ociResponse common.OCIResponse 607 policy := common.NoRetryPolicy() 608 if request.RetryPolicy() != nil { 609 policy = *request.RetryPolicy() 610 } 611 612 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 613 request.OpcRetryToken = common.String(common.RetryToken()) 614 } 615 616 ociResponse, err = common.Retry(ctx, request, client.createIdpGroupMapping, policy) 617 if err != nil { 618 if ociResponse != nil { 619 response = CreateIdpGroupMappingResponse{RawResponse: ociResponse.HTTPResponse()} 620 } 621 return 622 } 623 if convertedResponse, ok := ociResponse.(CreateIdpGroupMappingResponse); ok { 624 response = convertedResponse 625 } else { 626 err = fmt.Errorf("failed to convert OCIResponse into CreateIdpGroupMappingResponse") 627 } 628 return 629} 630 631// createIdpGroupMapping implements the OCIOperation interface (enables retrying operations) 632func (client IdentityClient) createIdpGroupMapping(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 633 httpRequest, err := request.HTTPRequest(http.MethodPost, "/identityProviders/{identityProviderId}/groupMappings") 634 if err != nil { 635 return nil, err 636 } 637 638 var response CreateIdpGroupMappingResponse 639 var httpResponse *http.Response 640 httpResponse, err = client.Call(ctx, &httpRequest) 641 defer common.CloseBodyIfValid(httpResponse) 642 response.RawResponse = httpResponse 643 if err != nil { 644 return response, err 645 } 646 647 err = common.UnmarshalResponse(httpResponse, &response) 648 return response, err 649} 650 651// CreateMfaTotpDevice Creates a new MFA TOTP device for the user. A user can have one MFA TOTP device. 652func (client IdentityClient) CreateMfaTotpDevice(ctx context.Context, request CreateMfaTotpDeviceRequest) (response CreateMfaTotpDeviceResponse, err error) { 653 var ociResponse common.OCIResponse 654 policy := common.NoRetryPolicy() 655 if request.RetryPolicy() != nil { 656 policy = *request.RetryPolicy() 657 } 658 659 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 660 request.OpcRetryToken = common.String(common.RetryToken()) 661 } 662 663 ociResponse, err = common.Retry(ctx, request, client.createMfaTotpDevice, policy) 664 if err != nil { 665 if ociResponse != nil { 666 response = CreateMfaTotpDeviceResponse{RawResponse: ociResponse.HTTPResponse()} 667 } 668 return 669 } 670 if convertedResponse, ok := ociResponse.(CreateMfaTotpDeviceResponse); ok { 671 response = convertedResponse 672 } else { 673 err = fmt.Errorf("failed to convert OCIResponse into CreateMfaTotpDeviceResponse") 674 } 675 return 676} 677 678// createMfaTotpDevice implements the OCIOperation interface (enables retrying operations) 679func (client IdentityClient) createMfaTotpDevice(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 680 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/mfaTotpDevices") 681 if err != nil { 682 return nil, err 683 } 684 685 var response CreateMfaTotpDeviceResponse 686 var httpResponse *http.Response 687 httpResponse, err = client.Call(ctx, &httpRequest) 688 defer common.CloseBodyIfValid(httpResponse) 689 response.RawResponse = httpResponse 690 if err != nil { 691 return response, err 692 } 693 694 err = common.UnmarshalResponse(httpResponse, &response) 695 return response, err 696} 697 698// CreateOrResetUIPassword Creates a new Console one-time password for the specified user. For more information about user 699// credentials, see User Credentials (https://docs.cloud.oracle.com/Content/Identity/Concepts/usercredentials.htm). 700// Use this operation after creating a new user, or if a user forgets their password. The new one-time 701// password is returned to you in the response, and you must securely deliver it to the user. They'll 702// be prompted to change this password the next time they sign in to the Console. If they don't change 703// it within 7 days, the password will expire and you'll need to create a new one-time password for the 704// user. 705// **Note:** The user's Console login is the unique name you specified when you created the user 706// (see CreateUser). 707func (client IdentityClient) CreateOrResetUIPassword(ctx context.Context, request CreateOrResetUIPasswordRequest) (response CreateOrResetUIPasswordResponse, err error) { 708 var ociResponse common.OCIResponse 709 policy := common.NoRetryPolicy() 710 if request.RetryPolicy() != nil { 711 policy = *request.RetryPolicy() 712 } 713 714 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 715 request.OpcRetryToken = common.String(common.RetryToken()) 716 } 717 718 ociResponse, err = common.Retry(ctx, request, client.createOrResetUIPassword, policy) 719 if err != nil { 720 if ociResponse != nil { 721 response = CreateOrResetUIPasswordResponse{RawResponse: ociResponse.HTTPResponse()} 722 } 723 return 724 } 725 if convertedResponse, ok := ociResponse.(CreateOrResetUIPasswordResponse); ok { 726 response = convertedResponse 727 } else { 728 err = fmt.Errorf("failed to convert OCIResponse into CreateOrResetUIPasswordResponse") 729 } 730 return 731} 732 733// createOrResetUIPassword implements the OCIOperation interface (enables retrying operations) 734func (client IdentityClient) createOrResetUIPassword(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 735 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/uiPassword") 736 if err != nil { 737 return nil, err 738 } 739 740 var response CreateOrResetUIPasswordResponse 741 var httpResponse *http.Response 742 httpResponse, err = client.Call(ctx, &httpRequest) 743 defer common.CloseBodyIfValid(httpResponse) 744 response.RawResponse = httpResponse 745 if err != nil { 746 return response, err 747 } 748 749 err = common.UnmarshalResponse(httpResponse, &response) 750 return response, err 751} 752 753// CreatePolicy Creates a new policy in the specified compartment (either the tenancy or another of your compartments). 754// If you're new to policies, see Getting Started with Policies (https://docs.cloud.oracle.com/Content/Identity/Concepts/policygetstarted.htm). 755// You must specify a *name* for the policy, which must be unique across all policies in your tenancy 756// and cannot be changed. 757// You must also specify a *description* for the policy (although it can be an empty string). It does not 758// have to be unique, and you can change it anytime with UpdatePolicy. 759// You must specify one or more policy statements in the statements array. For information about writing 760// policies, see How Policies Work (https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm) and 761// Common Policies (https://docs.cloud.oracle.com/Content/Identity/Concepts/commonpolicies.htm). 762// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the 763// object, first make sure its `lifecycleState` has changed to ACTIVE. 764// New policies take effect typically within 10 seconds. 765func (client IdentityClient) CreatePolicy(ctx context.Context, request CreatePolicyRequest) (response CreatePolicyResponse, err error) { 766 var ociResponse common.OCIResponse 767 policy := common.NoRetryPolicy() 768 if request.RetryPolicy() != nil { 769 policy = *request.RetryPolicy() 770 } 771 772 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 773 request.OpcRetryToken = common.String(common.RetryToken()) 774 } 775 776 ociResponse, err = common.Retry(ctx, request, client.createPolicy, policy) 777 if err != nil { 778 if ociResponse != nil { 779 response = CreatePolicyResponse{RawResponse: ociResponse.HTTPResponse()} 780 } 781 return 782 } 783 if convertedResponse, ok := ociResponse.(CreatePolicyResponse); ok { 784 response = convertedResponse 785 } else { 786 err = fmt.Errorf("failed to convert OCIResponse into CreatePolicyResponse") 787 } 788 return 789} 790 791// createPolicy implements the OCIOperation interface (enables retrying operations) 792func (client IdentityClient) createPolicy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 793 httpRequest, err := request.HTTPRequest(http.MethodPost, "/policies") 794 if err != nil { 795 return nil, err 796 } 797 798 var response CreatePolicyResponse 799 var httpResponse *http.Response 800 httpResponse, err = client.Call(ctx, &httpRequest) 801 defer common.CloseBodyIfValid(httpResponse) 802 response.RawResponse = httpResponse 803 if err != nil { 804 return response, err 805 } 806 807 err = common.UnmarshalResponse(httpResponse, &response) 808 return response, err 809} 810 811// CreateRegionSubscription Creates a subscription to a region for a tenancy. 812func (client IdentityClient) CreateRegionSubscription(ctx context.Context, request CreateRegionSubscriptionRequest) (response CreateRegionSubscriptionResponse, err error) { 813 var ociResponse common.OCIResponse 814 policy := common.NoRetryPolicy() 815 if request.RetryPolicy() != nil { 816 policy = *request.RetryPolicy() 817 } 818 819 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 820 request.OpcRetryToken = common.String(common.RetryToken()) 821 } 822 823 ociResponse, err = common.Retry(ctx, request, client.createRegionSubscription, policy) 824 if err != nil { 825 if ociResponse != nil { 826 response = CreateRegionSubscriptionResponse{RawResponse: ociResponse.HTTPResponse()} 827 } 828 return 829 } 830 if convertedResponse, ok := ociResponse.(CreateRegionSubscriptionResponse); ok { 831 response = convertedResponse 832 } else { 833 err = fmt.Errorf("failed to convert OCIResponse into CreateRegionSubscriptionResponse") 834 } 835 return 836} 837 838// createRegionSubscription implements the OCIOperation interface (enables retrying operations) 839func (client IdentityClient) createRegionSubscription(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 840 httpRequest, err := request.HTTPRequest(http.MethodPost, "/tenancies/{tenancyId}/regionSubscriptions") 841 if err != nil { 842 return nil, err 843 } 844 845 var response CreateRegionSubscriptionResponse 846 var httpResponse *http.Response 847 httpResponse, err = client.Call(ctx, &httpRequest) 848 defer common.CloseBodyIfValid(httpResponse) 849 response.RawResponse = httpResponse 850 if err != nil { 851 return response, err 852 } 853 854 err = common.UnmarshalResponse(httpResponse, &response) 855 return response, err 856} 857 858// CreateSmtpCredential Creates a new SMTP credential for the specified user. An SMTP credential has an SMTP user name and an SMTP password. 859// You must specify a *description* for the SMTP credential (although it can be an empty string). It does not 860// have to be unique, and you can change it anytime with 861// UpdateSmtpCredential. 862func (client IdentityClient) CreateSmtpCredential(ctx context.Context, request CreateSmtpCredentialRequest) (response CreateSmtpCredentialResponse, err error) { 863 var ociResponse common.OCIResponse 864 policy := common.NoRetryPolicy() 865 if request.RetryPolicy() != nil { 866 policy = *request.RetryPolicy() 867 } 868 869 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 870 request.OpcRetryToken = common.String(common.RetryToken()) 871 } 872 873 ociResponse, err = common.Retry(ctx, request, client.createSmtpCredential, policy) 874 if err != nil { 875 if ociResponse != nil { 876 response = CreateSmtpCredentialResponse{RawResponse: ociResponse.HTTPResponse()} 877 } 878 return 879 } 880 if convertedResponse, ok := ociResponse.(CreateSmtpCredentialResponse); ok { 881 response = convertedResponse 882 } else { 883 err = fmt.Errorf("failed to convert OCIResponse into CreateSmtpCredentialResponse") 884 } 885 return 886} 887 888// createSmtpCredential implements the OCIOperation interface (enables retrying operations) 889func (client IdentityClient) createSmtpCredential(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 890 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/smtpCredentials") 891 if err != nil { 892 return nil, err 893 } 894 895 var response CreateSmtpCredentialResponse 896 var httpResponse *http.Response 897 httpResponse, err = client.Call(ctx, &httpRequest) 898 defer common.CloseBodyIfValid(httpResponse) 899 response.RawResponse = httpResponse 900 if err != nil { 901 return response, err 902 } 903 904 err = common.UnmarshalResponse(httpResponse, &response) 905 return response, err 906} 907 908// CreateSwiftPassword **Deprecated. Use CreateAuthToken instead.** 909// Creates a new Swift password for the specified user. For information about what Swift passwords are for, see 910// Managing User Credentials (https://docs.cloud.oracle.com/Content/Identity/Tasks/managingcredentials.htm). 911// You must specify a *description* for the Swift password (although it can be an empty string). It does not 912// have to be unique, and you can change it anytime with 913// UpdateSwiftPassword. 914// Every user has permission to create a Swift password for *their own user ID*. An administrator in your organization 915// does not need to write a policy to give users this ability. To compare, administrators who have permission to the 916// tenancy can use this operation to create a Swift password for any user, including themselves. 917func (client IdentityClient) CreateSwiftPassword(ctx context.Context, request CreateSwiftPasswordRequest) (response CreateSwiftPasswordResponse, err error) { 918 var ociResponse common.OCIResponse 919 policy := common.NoRetryPolicy() 920 if request.RetryPolicy() != nil { 921 policy = *request.RetryPolicy() 922 } 923 924 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 925 request.OpcRetryToken = common.String(common.RetryToken()) 926 } 927 928 ociResponse, err = common.Retry(ctx, request, client.createSwiftPassword, policy) 929 if err != nil { 930 if ociResponse != nil { 931 response = CreateSwiftPasswordResponse{RawResponse: ociResponse.HTTPResponse()} 932 } 933 return 934 } 935 if convertedResponse, ok := ociResponse.(CreateSwiftPasswordResponse); ok { 936 response = convertedResponse 937 } else { 938 err = fmt.Errorf("failed to convert OCIResponse into CreateSwiftPasswordResponse") 939 } 940 return 941} 942 943// createSwiftPassword implements the OCIOperation interface (enables retrying operations) 944func (client IdentityClient) createSwiftPassword(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 945 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/swiftPasswords") 946 if err != nil { 947 return nil, err 948 } 949 950 var response CreateSwiftPasswordResponse 951 var httpResponse *http.Response 952 httpResponse, err = client.Call(ctx, &httpRequest) 953 defer common.CloseBodyIfValid(httpResponse) 954 response.RawResponse = httpResponse 955 if err != nil { 956 return response, err 957 } 958 959 err = common.UnmarshalResponse(httpResponse, &response) 960 return response, err 961} 962 963// CreateTag Creates a new tag in the specified tag namespace. 964// You must specify either the OCID or the name of the tag namespace that will contain this tag definition. 965// You must also specify a *name* for the tag, which must be unique across all tags in the tag namespace 966// and cannot be changed. The name can contain any ASCII character except the space (_) or period (.) characters. 967// Names are case insensitive. That means, for example, "myTag" and "mytag" are not allowed in the same namespace. 968// If you specify a name that's already in use in the tag namespace, a 409 error is returned. 969// You must also specify a *description* for the tag. 970// It does not have to be unique, and you can change it with 971// UpdateTag. 972// If no 'validator' is set on this tag definition, then any (valid) value can be set for this definedTag. 973// If a 'validator' is set on this tag definition, then the only valid values that can be set for this 974// definedTag those that pass the additional validation imposed by the set 'validator'. 975func (client IdentityClient) CreateTag(ctx context.Context, request CreateTagRequest) (response CreateTagResponse, err error) { 976 var ociResponse common.OCIResponse 977 policy := common.NoRetryPolicy() 978 if request.RetryPolicy() != nil { 979 policy = *request.RetryPolicy() 980 } 981 982 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 983 request.OpcRetryToken = common.String(common.RetryToken()) 984 } 985 986 ociResponse, err = common.Retry(ctx, request, client.createTag, policy) 987 if err != nil { 988 if ociResponse != nil { 989 response = CreateTagResponse{RawResponse: ociResponse.HTTPResponse()} 990 } 991 return 992 } 993 if convertedResponse, ok := ociResponse.(CreateTagResponse); ok { 994 response = convertedResponse 995 } else { 996 err = fmt.Errorf("failed to convert OCIResponse into CreateTagResponse") 997 } 998 return 999} 1000 1001// createTag implements the OCIOperation interface (enables retrying operations) 1002func (client IdentityClient) createTag(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1003 httpRequest, err := request.HTTPRequest(http.MethodPost, "/tagNamespaces/{tagNamespaceId}/tags") 1004 if err != nil { 1005 return nil, err 1006 } 1007 1008 var response CreateTagResponse 1009 var httpResponse *http.Response 1010 httpResponse, err = client.Call(ctx, &httpRequest) 1011 defer common.CloseBodyIfValid(httpResponse) 1012 response.RawResponse = httpResponse 1013 if err != nil { 1014 return response, err 1015 } 1016 1017 err = common.UnmarshalResponse(httpResponse, &response) 1018 return response, err 1019} 1020 1021// CreateTagDefault Creates a new tag default in the specified compartment for the specified tag definition. 1022// If you specify that a value is required, a value is set during resource creation (either by 1023// the user creating the resource or another tag defualt). If no value is set, resource creation 1024// is blocked. 1025// * If the `isRequired` flag is set to "true", the value is set during resource creation. 1026// * If the `isRequired` flag is set to "false", the value you enter is set during resource creation. 1027func (client IdentityClient) CreateTagDefault(ctx context.Context, request CreateTagDefaultRequest) (response CreateTagDefaultResponse, err error) { 1028 var ociResponse common.OCIResponse 1029 policy := common.NoRetryPolicy() 1030 if request.RetryPolicy() != nil { 1031 policy = *request.RetryPolicy() 1032 } 1033 1034 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 1035 request.OpcRetryToken = common.String(common.RetryToken()) 1036 } 1037 1038 ociResponse, err = common.Retry(ctx, request, client.createTagDefault, policy) 1039 if err != nil { 1040 if ociResponse != nil { 1041 response = CreateTagDefaultResponse{RawResponse: ociResponse.HTTPResponse()} 1042 } 1043 return 1044 } 1045 if convertedResponse, ok := ociResponse.(CreateTagDefaultResponse); ok { 1046 response = convertedResponse 1047 } else { 1048 err = fmt.Errorf("failed to convert OCIResponse into CreateTagDefaultResponse") 1049 } 1050 return 1051} 1052 1053// createTagDefault implements the OCIOperation interface (enables retrying operations) 1054func (client IdentityClient) createTagDefault(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1055 httpRequest, err := request.HTTPRequest(http.MethodPost, "/tagDefaults") 1056 if err != nil { 1057 return nil, err 1058 } 1059 1060 var response CreateTagDefaultResponse 1061 var httpResponse *http.Response 1062 httpResponse, err = client.Call(ctx, &httpRequest) 1063 defer common.CloseBodyIfValid(httpResponse) 1064 response.RawResponse = httpResponse 1065 if err != nil { 1066 return response, err 1067 } 1068 1069 err = common.UnmarshalResponse(httpResponse, &response) 1070 return response, err 1071} 1072 1073// CreateTagNamespace Creates a new tag namespace in the specified compartment. 1074// You must specify the compartment ID in the request object (remember that the tenancy is simply the root 1075// compartment). 1076// You must also specify a *name* for the namespace, which must be unique across all namespaces in your tenancy 1077// and cannot be changed. The name can contain any ASCII character except the space (_) or period (.). 1078// Names are case insensitive. That means, for example, "myNamespace" and "mynamespace" are not allowed 1079// in the same tenancy. Once you created a namespace, you cannot change the name. 1080// If you specify a name that's already in use in the tenancy, a 409 error is returned. 1081// You must also specify a *description* for the namespace. 1082// It does not have to be unique, and you can change it with 1083// UpdateTagNamespace. 1084func (client IdentityClient) CreateTagNamespace(ctx context.Context, request CreateTagNamespaceRequest) (response CreateTagNamespaceResponse, err error) { 1085 var ociResponse common.OCIResponse 1086 policy := common.NoRetryPolicy() 1087 if request.RetryPolicy() != nil { 1088 policy = *request.RetryPolicy() 1089 } 1090 1091 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 1092 request.OpcRetryToken = common.String(common.RetryToken()) 1093 } 1094 1095 ociResponse, err = common.Retry(ctx, request, client.createTagNamespace, policy) 1096 if err != nil { 1097 if ociResponse != nil { 1098 response = CreateTagNamespaceResponse{RawResponse: ociResponse.HTTPResponse()} 1099 } 1100 return 1101 } 1102 if convertedResponse, ok := ociResponse.(CreateTagNamespaceResponse); ok { 1103 response = convertedResponse 1104 } else { 1105 err = fmt.Errorf("failed to convert OCIResponse into CreateTagNamespaceResponse") 1106 } 1107 return 1108} 1109 1110// createTagNamespace implements the OCIOperation interface (enables retrying operations) 1111func (client IdentityClient) createTagNamespace(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1112 httpRequest, err := request.HTTPRequest(http.MethodPost, "/tagNamespaces") 1113 if err != nil { 1114 return nil, err 1115 } 1116 1117 var response CreateTagNamespaceResponse 1118 var httpResponse *http.Response 1119 httpResponse, err = client.Call(ctx, &httpRequest) 1120 defer common.CloseBodyIfValid(httpResponse) 1121 response.RawResponse = httpResponse 1122 if err != nil { 1123 return response, err 1124 } 1125 1126 err = common.UnmarshalResponse(httpResponse, &response) 1127 return response, err 1128} 1129 1130// CreateUser Creates a new user in your tenancy. For conceptual information about users, your tenancy, and other 1131// IAM Service components, see Overview of the IAM Service (https://docs.cloud.oracle.com/Content/Identity/Concepts/overview.htm). 1132// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the 1133// tenancy is simply the root compartment). Notice that IAM resources (users, groups, compartments, and 1134// some policies) reside within the tenancy itself, unlike cloud resources such as compute instances, 1135// which typically reside within compartments inside the tenancy. For information about OCIDs, see 1136// Resource Identifiers (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm). 1137// You must also specify a *name* for the user, which must be unique across all users in your tenancy 1138// and cannot be changed. Allowed characters: No spaces. Only letters, numerals, hyphens, periods, 1139// underscores, +, and @. If you specify a name that's already in use, you'll get a 409 error. 1140// This name will be the user's login to the Console. You might want to pick a 1141// name that your company's own identity system (e.g., Active Directory, LDAP, etc.) already uses. 1142// If you delete a user and then create a new user with the same name, they'll be considered different 1143// users because they have different OCIDs. 1144// You must also specify a *description* for the user (although it can be an empty string). 1145// It does not have to be unique, and you can change it anytime with 1146// UpdateUser. You can use the field to provide the user's 1147// full name, a description, a nickname, or other information to generally identify the user. 1148// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before 1149// using the object, first make sure its `lifecycleState` has changed to ACTIVE. 1150// A new user has no permissions until you place the user in one or more groups (see 1151// AddUserToGroup). If the user needs to 1152// access the Console, you need to provide the user a password (see 1153// CreateOrResetUIPassword). 1154// If the user needs to access the Oracle Cloud Infrastructure REST API, you need to upload a 1155// public API signing key for that user (see 1156// Required Keys and OCIDs (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm) and also 1157// UploadApiKey). 1158// **Important:** Make sure to inform the new user which compartment(s) they have access to. 1159func (client IdentityClient) CreateUser(ctx context.Context, request CreateUserRequest) (response CreateUserResponse, err error) { 1160 var ociResponse common.OCIResponse 1161 policy := common.NoRetryPolicy() 1162 if request.RetryPolicy() != nil { 1163 policy = *request.RetryPolicy() 1164 } 1165 1166 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 1167 request.OpcRetryToken = common.String(common.RetryToken()) 1168 } 1169 1170 ociResponse, err = common.Retry(ctx, request, client.createUser, policy) 1171 if err != nil { 1172 if ociResponse != nil { 1173 response = CreateUserResponse{RawResponse: ociResponse.HTTPResponse()} 1174 } 1175 return 1176 } 1177 if convertedResponse, ok := ociResponse.(CreateUserResponse); ok { 1178 response = convertedResponse 1179 } else { 1180 err = fmt.Errorf("failed to convert OCIResponse into CreateUserResponse") 1181 } 1182 return 1183} 1184 1185// createUser implements the OCIOperation interface (enables retrying operations) 1186func (client IdentityClient) createUser(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1187 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users") 1188 if err != nil { 1189 return nil, err 1190 } 1191 1192 var response CreateUserResponse 1193 var httpResponse *http.Response 1194 httpResponse, err = client.Call(ctx, &httpRequest) 1195 defer common.CloseBodyIfValid(httpResponse) 1196 response.RawResponse = httpResponse 1197 if err != nil { 1198 return response, err 1199 } 1200 1201 err = common.UnmarshalResponse(httpResponse, &response) 1202 return response, err 1203} 1204 1205// DeleteApiKey Deletes the specified API signing key for the specified user. 1206// Every user has permission to use this operation to delete a key for *their own user ID*. An 1207// administrator in your organization does not need to write a policy to give users this ability. 1208// To compare, administrators who have permission to the tenancy can use this operation to delete 1209// a key for any user, including themselves. 1210func (client IdentityClient) DeleteApiKey(ctx context.Context, request DeleteApiKeyRequest) (response DeleteApiKeyResponse, err error) { 1211 var ociResponse common.OCIResponse 1212 policy := common.NoRetryPolicy() 1213 if request.RetryPolicy() != nil { 1214 policy = *request.RetryPolicy() 1215 } 1216 ociResponse, err = common.Retry(ctx, request, client.deleteApiKey, policy) 1217 if err != nil { 1218 if ociResponse != nil { 1219 response = DeleteApiKeyResponse{RawResponse: ociResponse.HTTPResponse()} 1220 } 1221 return 1222 } 1223 if convertedResponse, ok := ociResponse.(DeleteApiKeyResponse); ok { 1224 response = convertedResponse 1225 } else { 1226 err = fmt.Errorf("failed to convert OCIResponse into DeleteApiKeyResponse") 1227 } 1228 return 1229} 1230 1231// deleteApiKey implements the OCIOperation interface (enables retrying operations) 1232func (client IdentityClient) deleteApiKey(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1233 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}/apiKeys/{fingerprint}") 1234 if err != nil { 1235 return nil, err 1236 } 1237 1238 var response DeleteApiKeyResponse 1239 var httpResponse *http.Response 1240 httpResponse, err = client.Call(ctx, &httpRequest) 1241 defer common.CloseBodyIfValid(httpResponse) 1242 response.RawResponse = httpResponse 1243 if err != nil { 1244 return response, err 1245 } 1246 1247 err = common.UnmarshalResponse(httpResponse, &response) 1248 return response, err 1249} 1250 1251// DeleteAuthToken Deletes the specified auth token for the specified user. 1252func (client IdentityClient) DeleteAuthToken(ctx context.Context, request DeleteAuthTokenRequest) (response DeleteAuthTokenResponse, err error) { 1253 var ociResponse common.OCIResponse 1254 policy := common.NoRetryPolicy() 1255 if request.RetryPolicy() != nil { 1256 policy = *request.RetryPolicy() 1257 } 1258 ociResponse, err = common.Retry(ctx, request, client.deleteAuthToken, policy) 1259 if err != nil { 1260 if ociResponse != nil { 1261 response = DeleteAuthTokenResponse{RawResponse: ociResponse.HTTPResponse()} 1262 } 1263 return 1264 } 1265 if convertedResponse, ok := ociResponse.(DeleteAuthTokenResponse); ok { 1266 response = convertedResponse 1267 } else { 1268 err = fmt.Errorf("failed to convert OCIResponse into DeleteAuthTokenResponse") 1269 } 1270 return 1271} 1272 1273// deleteAuthToken implements the OCIOperation interface (enables retrying operations) 1274func (client IdentityClient) deleteAuthToken(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1275 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}/authTokens/{authTokenId}") 1276 if err != nil { 1277 return nil, err 1278 } 1279 1280 var response DeleteAuthTokenResponse 1281 var httpResponse *http.Response 1282 httpResponse, err = client.Call(ctx, &httpRequest) 1283 defer common.CloseBodyIfValid(httpResponse) 1284 response.RawResponse = httpResponse 1285 if err != nil { 1286 return response, err 1287 } 1288 1289 err = common.UnmarshalResponse(httpResponse, &response) 1290 return response, err 1291} 1292 1293// DeleteCompartment Deletes the specified compartment. The compartment must be empty. 1294func (client IdentityClient) DeleteCompartment(ctx context.Context, request DeleteCompartmentRequest) (response DeleteCompartmentResponse, err error) { 1295 var ociResponse common.OCIResponse 1296 policy := common.NoRetryPolicy() 1297 if request.RetryPolicy() != nil { 1298 policy = *request.RetryPolicy() 1299 } 1300 ociResponse, err = common.Retry(ctx, request, client.deleteCompartment, policy) 1301 if err != nil { 1302 if ociResponse != nil { 1303 response = DeleteCompartmentResponse{RawResponse: ociResponse.HTTPResponse()} 1304 } 1305 return 1306 } 1307 if convertedResponse, ok := ociResponse.(DeleteCompartmentResponse); ok { 1308 response = convertedResponse 1309 } else { 1310 err = fmt.Errorf("failed to convert OCIResponse into DeleteCompartmentResponse") 1311 } 1312 return 1313} 1314 1315// deleteCompartment implements the OCIOperation interface (enables retrying operations) 1316func (client IdentityClient) deleteCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1317 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/compartments/{compartmentId}") 1318 if err != nil { 1319 return nil, err 1320 } 1321 1322 var response DeleteCompartmentResponse 1323 var httpResponse *http.Response 1324 httpResponse, err = client.Call(ctx, &httpRequest) 1325 defer common.CloseBodyIfValid(httpResponse) 1326 response.RawResponse = httpResponse 1327 if err != nil { 1328 return response, err 1329 } 1330 1331 err = common.UnmarshalResponse(httpResponse, &response) 1332 return response, err 1333} 1334 1335// DeleteCustomerSecretKey Deletes the specified secret key for the specified user. 1336func (client IdentityClient) DeleteCustomerSecretKey(ctx context.Context, request DeleteCustomerSecretKeyRequest) (response DeleteCustomerSecretKeyResponse, err error) { 1337 var ociResponse common.OCIResponse 1338 policy := common.NoRetryPolicy() 1339 if request.RetryPolicy() != nil { 1340 policy = *request.RetryPolicy() 1341 } 1342 ociResponse, err = common.Retry(ctx, request, client.deleteCustomerSecretKey, policy) 1343 if err != nil { 1344 if ociResponse != nil { 1345 response = DeleteCustomerSecretKeyResponse{RawResponse: ociResponse.HTTPResponse()} 1346 } 1347 return 1348 } 1349 if convertedResponse, ok := ociResponse.(DeleteCustomerSecretKeyResponse); ok { 1350 response = convertedResponse 1351 } else { 1352 err = fmt.Errorf("failed to convert OCIResponse into DeleteCustomerSecretKeyResponse") 1353 } 1354 return 1355} 1356 1357// deleteCustomerSecretKey implements the OCIOperation interface (enables retrying operations) 1358func (client IdentityClient) deleteCustomerSecretKey(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1359 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}/customerSecretKeys/{customerSecretKeyId}") 1360 if err != nil { 1361 return nil, err 1362 } 1363 1364 var response DeleteCustomerSecretKeyResponse 1365 var httpResponse *http.Response 1366 httpResponse, err = client.Call(ctx, &httpRequest) 1367 defer common.CloseBodyIfValid(httpResponse) 1368 response.RawResponse = httpResponse 1369 if err != nil { 1370 return response, err 1371 } 1372 1373 err = common.UnmarshalResponse(httpResponse, &response) 1374 return response, err 1375} 1376 1377// DeleteDynamicGroup Deletes the specified dynamic group. 1378func (client IdentityClient) DeleteDynamicGroup(ctx context.Context, request DeleteDynamicGroupRequest) (response DeleteDynamicGroupResponse, err error) { 1379 var ociResponse common.OCIResponse 1380 policy := common.NoRetryPolicy() 1381 if request.RetryPolicy() != nil { 1382 policy = *request.RetryPolicy() 1383 } 1384 ociResponse, err = common.Retry(ctx, request, client.deleteDynamicGroup, policy) 1385 if err != nil { 1386 if ociResponse != nil { 1387 response = DeleteDynamicGroupResponse{RawResponse: ociResponse.HTTPResponse()} 1388 } 1389 return 1390 } 1391 if convertedResponse, ok := ociResponse.(DeleteDynamicGroupResponse); ok { 1392 response = convertedResponse 1393 } else { 1394 err = fmt.Errorf("failed to convert OCIResponse into DeleteDynamicGroupResponse") 1395 } 1396 return 1397} 1398 1399// deleteDynamicGroup implements the OCIOperation interface (enables retrying operations) 1400func (client IdentityClient) deleteDynamicGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1401 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/dynamicGroups/{dynamicGroupId}") 1402 if err != nil { 1403 return nil, err 1404 } 1405 1406 var response DeleteDynamicGroupResponse 1407 var httpResponse *http.Response 1408 httpResponse, err = client.Call(ctx, &httpRequest) 1409 defer common.CloseBodyIfValid(httpResponse) 1410 response.RawResponse = httpResponse 1411 if err != nil { 1412 return response, err 1413 } 1414 1415 err = common.UnmarshalResponse(httpResponse, &response) 1416 return response, err 1417} 1418 1419// DeleteGroup Deletes the specified group. The group must be empty. 1420func (client IdentityClient) DeleteGroup(ctx context.Context, request DeleteGroupRequest) (response DeleteGroupResponse, err error) { 1421 var ociResponse common.OCIResponse 1422 policy := common.NoRetryPolicy() 1423 if request.RetryPolicy() != nil { 1424 policy = *request.RetryPolicy() 1425 } 1426 ociResponse, err = common.Retry(ctx, request, client.deleteGroup, policy) 1427 if err != nil { 1428 if ociResponse != nil { 1429 response = DeleteGroupResponse{RawResponse: ociResponse.HTTPResponse()} 1430 } 1431 return 1432 } 1433 if convertedResponse, ok := ociResponse.(DeleteGroupResponse); ok { 1434 response = convertedResponse 1435 } else { 1436 err = fmt.Errorf("failed to convert OCIResponse into DeleteGroupResponse") 1437 } 1438 return 1439} 1440 1441// deleteGroup implements the OCIOperation interface (enables retrying operations) 1442func (client IdentityClient) deleteGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1443 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/groups/{groupId}") 1444 if err != nil { 1445 return nil, err 1446 } 1447 1448 var response DeleteGroupResponse 1449 var httpResponse *http.Response 1450 httpResponse, err = client.Call(ctx, &httpRequest) 1451 defer common.CloseBodyIfValid(httpResponse) 1452 response.RawResponse = httpResponse 1453 if err != nil { 1454 return response, err 1455 } 1456 1457 err = common.UnmarshalResponse(httpResponse, &response) 1458 return response, err 1459} 1460 1461// DeleteIdentityProvider Deletes the specified identity provider. The identity provider must not have 1462// any group mappings (see IdpGroupMapping). 1463func (client IdentityClient) DeleteIdentityProvider(ctx context.Context, request DeleteIdentityProviderRequest) (response DeleteIdentityProviderResponse, err error) { 1464 var ociResponse common.OCIResponse 1465 policy := common.NoRetryPolicy() 1466 if request.RetryPolicy() != nil { 1467 policy = *request.RetryPolicy() 1468 } 1469 ociResponse, err = common.Retry(ctx, request, client.deleteIdentityProvider, policy) 1470 if err != nil { 1471 if ociResponse != nil { 1472 response = DeleteIdentityProviderResponse{RawResponse: ociResponse.HTTPResponse()} 1473 } 1474 return 1475 } 1476 if convertedResponse, ok := ociResponse.(DeleteIdentityProviderResponse); ok { 1477 response = convertedResponse 1478 } else { 1479 err = fmt.Errorf("failed to convert OCIResponse into DeleteIdentityProviderResponse") 1480 } 1481 return 1482} 1483 1484// deleteIdentityProvider implements the OCIOperation interface (enables retrying operations) 1485func (client IdentityClient) deleteIdentityProvider(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1486 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/identityProviders/{identityProviderId}") 1487 if err != nil { 1488 return nil, err 1489 } 1490 1491 var response DeleteIdentityProviderResponse 1492 var httpResponse *http.Response 1493 httpResponse, err = client.Call(ctx, &httpRequest) 1494 defer common.CloseBodyIfValid(httpResponse) 1495 response.RawResponse = httpResponse 1496 if err != nil { 1497 return response, err 1498 } 1499 1500 err = common.UnmarshalResponse(httpResponse, &response) 1501 return response, err 1502} 1503 1504// DeleteIdpGroupMapping Deletes the specified group mapping. 1505func (client IdentityClient) DeleteIdpGroupMapping(ctx context.Context, request DeleteIdpGroupMappingRequest) (response DeleteIdpGroupMappingResponse, err error) { 1506 var ociResponse common.OCIResponse 1507 policy := common.NoRetryPolicy() 1508 if request.RetryPolicy() != nil { 1509 policy = *request.RetryPolicy() 1510 } 1511 ociResponse, err = common.Retry(ctx, request, client.deleteIdpGroupMapping, policy) 1512 if err != nil { 1513 if ociResponse != nil { 1514 response = DeleteIdpGroupMappingResponse{RawResponse: ociResponse.HTTPResponse()} 1515 } 1516 return 1517 } 1518 if convertedResponse, ok := ociResponse.(DeleteIdpGroupMappingResponse); ok { 1519 response = convertedResponse 1520 } else { 1521 err = fmt.Errorf("failed to convert OCIResponse into DeleteIdpGroupMappingResponse") 1522 } 1523 return 1524} 1525 1526// deleteIdpGroupMapping implements the OCIOperation interface (enables retrying operations) 1527func (client IdentityClient) deleteIdpGroupMapping(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1528 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/identityProviders/{identityProviderId}/groupMappings/{mappingId}") 1529 if err != nil { 1530 return nil, err 1531 } 1532 1533 var response DeleteIdpGroupMappingResponse 1534 var httpResponse *http.Response 1535 httpResponse, err = client.Call(ctx, &httpRequest) 1536 defer common.CloseBodyIfValid(httpResponse) 1537 response.RawResponse = httpResponse 1538 if err != nil { 1539 return response, err 1540 } 1541 1542 err = common.UnmarshalResponse(httpResponse, &response) 1543 return response, err 1544} 1545 1546// DeleteMfaTotpDevice Deletes the specified MFA TOTP device for the specified user. 1547func (client IdentityClient) DeleteMfaTotpDevice(ctx context.Context, request DeleteMfaTotpDeviceRequest) (response DeleteMfaTotpDeviceResponse, err error) { 1548 var ociResponse common.OCIResponse 1549 policy := common.NoRetryPolicy() 1550 if request.RetryPolicy() != nil { 1551 policy = *request.RetryPolicy() 1552 } 1553 ociResponse, err = common.Retry(ctx, request, client.deleteMfaTotpDevice, policy) 1554 if err != nil { 1555 if ociResponse != nil { 1556 response = DeleteMfaTotpDeviceResponse{RawResponse: ociResponse.HTTPResponse()} 1557 } 1558 return 1559 } 1560 if convertedResponse, ok := ociResponse.(DeleteMfaTotpDeviceResponse); ok { 1561 response = convertedResponse 1562 } else { 1563 err = fmt.Errorf("failed to convert OCIResponse into DeleteMfaTotpDeviceResponse") 1564 } 1565 return 1566} 1567 1568// deleteMfaTotpDevice implements the OCIOperation interface (enables retrying operations) 1569func (client IdentityClient) deleteMfaTotpDevice(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1570 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}") 1571 if err != nil { 1572 return nil, err 1573 } 1574 1575 var response DeleteMfaTotpDeviceResponse 1576 var httpResponse *http.Response 1577 httpResponse, err = client.Call(ctx, &httpRequest) 1578 defer common.CloseBodyIfValid(httpResponse) 1579 response.RawResponse = httpResponse 1580 if err != nil { 1581 return response, err 1582 } 1583 1584 err = common.UnmarshalResponse(httpResponse, &response) 1585 return response, err 1586} 1587 1588// DeletePolicy Deletes the specified policy. The deletion takes effect typically within 10 seconds. 1589func (client IdentityClient) DeletePolicy(ctx context.Context, request DeletePolicyRequest) (response DeletePolicyResponse, err error) { 1590 var ociResponse common.OCIResponse 1591 policy := common.NoRetryPolicy() 1592 if request.RetryPolicy() != nil { 1593 policy = *request.RetryPolicy() 1594 } 1595 ociResponse, err = common.Retry(ctx, request, client.deletePolicy, policy) 1596 if err != nil { 1597 if ociResponse != nil { 1598 response = DeletePolicyResponse{RawResponse: ociResponse.HTTPResponse()} 1599 } 1600 return 1601 } 1602 if convertedResponse, ok := ociResponse.(DeletePolicyResponse); ok { 1603 response = convertedResponse 1604 } else { 1605 err = fmt.Errorf("failed to convert OCIResponse into DeletePolicyResponse") 1606 } 1607 return 1608} 1609 1610// deletePolicy implements the OCIOperation interface (enables retrying operations) 1611func (client IdentityClient) deletePolicy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1612 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/policies/{policyId}") 1613 if err != nil { 1614 return nil, err 1615 } 1616 1617 var response DeletePolicyResponse 1618 var httpResponse *http.Response 1619 httpResponse, err = client.Call(ctx, &httpRequest) 1620 defer common.CloseBodyIfValid(httpResponse) 1621 response.RawResponse = httpResponse 1622 if err != nil { 1623 return response, err 1624 } 1625 1626 err = common.UnmarshalResponse(httpResponse, &response) 1627 return response, err 1628} 1629 1630// DeleteSmtpCredential Deletes the specified SMTP credential for the specified user. 1631func (client IdentityClient) DeleteSmtpCredential(ctx context.Context, request DeleteSmtpCredentialRequest) (response DeleteSmtpCredentialResponse, err error) { 1632 var ociResponse common.OCIResponse 1633 policy := common.NoRetryPolicy() 1634 if request.RetryPolicy() != nil { 1635 policy = *request.RetryPolicy() 1636 } 1637 ociResponse, err = common.Retry(ctx, request, client.deleteSmtpCredential, policy) 1638 if err != nil { 1639 if ociResponse != nil { 1640 response = DeleteSmtpCredentialResponse{RawResponse: ociResponse.HTTPResponse()} 1641 } 1642 return 1643 } 1644 if convertedResponse, ok := ociResponse.(DeleteSmtpCredentialResponse); ok { 1645 response = convertedResponse 1646 } else { 1647 err = fmt.Errorf("failed to convert OCIResponse into DeleteSmtpCredentialResponse") 1648 } 1649 return 1650} 1651 1652// deleteSmtpCredential implements the OCIOperation interface (enables retrying operations) 1653func (client IdentityClient) deleteSmtpCredential(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1654 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}/smtpCredentials/{smtpCredentialId}") 1655 if err != nil { 1656 return nil, err 1657 } 1658 1659 var response DeleteSmtpCredentialResponse 1660 var httpResponse *http.Response 1661 httpResponse, err = client.Call(ctx, &httpRequest) 1662 defer common.CloseBodyIfValid(httpResponse) 1663 response.RawResponse = httpResponse 1664 if err != nil { 1665 return response, err 1666 } 1667 1668 err = common.UnmarshalResponse(httpResponse, &response) 1669 return response, err 1670} 1671 1672// DeleteSwiftPassword **Deprecated. Use DeleteAuthToken instead.** 1673// Deletes the specified Swift password for the specified user. 1674func (client IdentityClient) DeleteSwiftPassword(ctx context.Context, request DeleteSwiftPasswordRequest) (response DeleteSwiftPasswordResponse, err error) { 1675 var ociResponse common.OCIResponse 1676 policy := common.NoRetryPolicy() 1677 if request.RetryPolicy() != nil { 1678 policy = *request.RetryPolicy() 1679 } 1680 ociResponse, err = common.Retry(ctx, request, client.deleteSwiftPassword, policy) 1681 if err != nil { 1682 if ociResponse != nil { 1683 response = DeleteSwiftPasswordResponse{RawResponse: ociResponse.HTTPResponse()} 1684 } 1685 return 1686 } 1687 if convertedResponse, ok := ociResponse.(DeleteSwiftPasswordResponse); ok { 1688 response = convertedResponse 1689 } else { 1690 err = fmt.Errorf("failed to convert OCIResponse into DeleteSwiftPasswordResponse") 1691 } 1692 return 1693} 1694 1695// deleteSwiftPassword implements the OCIOperation interface (enables retrying operations) 1696func (client IdentityClient) deleteSwiftPassword(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1697 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}/swiftPasswords/{swiftPasswordId}") 1698 if err != nil { 1699 return nil, err 1700 } 1701 1702 var response DeleteSwiftPasswordResponse 1703 var httpResponse *http.Response 1704 httpResponse, err = client.Call(ctx, &httpRequest) 1705 defer common.CloseBodyIfValid(httpResponse) 1706 response.RawResponse = httpResponse 1707 if err != nil { 1708 return response, err 1709 } 1710 1711 err = common.UnmarshalResponse(httpResponse, &response) 1712 return response, err 1713} 1714 1715// DeleteTag Deletes the specified tag definition. This operation triggers a process that removes the 1716// tag from all resources in your tenancy. 1717// These things happen immediately: 1718// 1719// * If the tag was a cost-tracking tag, it no longer counts against your 10 cost-tracking 1720// tags limit, whether you first disabled it or not. 1721// * If the tag was used with dynamic groups, none of the rules that contain the tag will 1722// be evaluated against the tag. 1723// Once you start the delete operation, the state of the tag changes to DELETING and tag removal 1724// from resources begins. This can take up to 48 hours depending on the number of resources that 1725// were tagged as well as the regions in which those resources reside. When all tags have been 1726// removed, the state changes to DELETED. You cannot restore a deleted tag. Once the deleted tag 1727// changes its state to DELETED, you can use the same tag name again. 1728// To delete a tag, you must first retire it. Use UpdateTag 1729// to retire a tag. 1730func (client IdentityClient) DeleteTag(ctx context.Context, request DeleteTagRequest) (response DeleteTagResponse, err error) { 1731 var ociResponse common.OCIResponse 1732 policy := common.NoRetryPolicy() 1733 if request.RetryPolicy() != nil { 1734 policy = *request.RetryPolicy() 1735 } 1736 ociResponse, err = common.Retry(ctx, request, client.deleteTag, policy) 1737 if err != nil { 1738 if ociResponse != nil { 1739 response = DeleteTagResponse{RawResponse: ociResponse.HTTPResponse()} 1740 } 1741 return 1742 } 1743 if convertedResponse, ok := ociResponse.(DeleteTagResponse); ok { 1744 response = convertedResponse 1745 } else { 1746 err = fmt.Errorf("failed to convert OCIResponse into DeleteTagResponse") 1747 } 1748 return 1749} 1750 1751// deleteTag implements the OCIOperation interface (enables retrying operations) 1752func (client IdentityClient) deleteTag(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1753 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/tagNamespaces/{tagNamespaceId}/tags/{tagName}") 1754 if err != nil { 1755 return nil, err 1756 } 1757 1758 var response DeleteTagResponse 1759 var httpResponse *http.Response 1760 httpResponse, err = client.Call(ctx, &httpRequest) 1761 defer common.CloseBodyIfValid(httpResponse) 1762 response.RawResponse = httpResponse 1763 if err != nil { 1764 return response, err 1765 } 1766 1767 err = common.UnmarshalResponse(httpResponse, &response) 1768 return response, err 1769} 1770 1771// DeleteTagDefault Deletes the the specified tag default. 1772func (client IdentityClient) DeleteTagDefault(ctx context.Context, request DeleteTagDefaultRequest) (response DeleteTagDefaultResponse, err error) { 1773 var ociResponse common.OCIResponse 1774 policy := common.NoRetryPolicy() 1775 if request.RetryPolicy() != nil { 1776 policy = *request.RetryPolicy() 1777 } 1778 ociResponse, err = common.Retry(ctx, request, client.deleteTagDefault, policy) 1779 if err != nil { 1780 if ociResponse != nil { 1781 response = DeleteTagDefaultResponse{RawResponse: ociResponse.HTTPResponse()} 1782 } 1783 return 1784 } 1785 if convertedResponse, ok := ociResponse.(DeleteTagDefaultResponse); ok { 1786 response = convertedResponse 1787 } else { 1788 err = fmt.Errorf("failed to convert OCIResponse into DeleteTagDefaultResponse") 1789 } 1790 return 1791} 1792 1793// deleteTagDefault implements the OCIOperation interface (enables retrying operations) 1794func (client IdentityClient) deleteTagDefault(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1795 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/tagDefaults/{tagDefaultId}") 1796 if err != nil { 1797 return nil, err 1798 } 1799 1800 var response DeleteTagDefaultResponse 1801 var httpResponse *http.Response 1802 httpResponse, err = client.Call(ctx, &httpRequest) 1803 defer common.CloseBodyIfValid(httpResponse) 1804 response.RawResponse = httpResponse 1805 if err != nil { 1806 return response, err 1807 } 1808 1809 err = common.UnmarshalResponse(httpResponse, &response) 1810 return response, err 1811} 1812 1813// DeleteTagNamespace Deletes the specified tag namespace. Only an empty tag namespace can be deleted. To delete 1814// a tag namespace, first delete all its tag definitions. 1815// Use DeleteTag to delete a tag definition. 1816func (client IdentityClient) DeleteTagNamespace(ctx context.Context, request DeleteTagNamespaceRequest) (response DeleteTagNamespaceResponse, err error) { 1817 var ociResponse common.OCIResponse 1818 policy := common.NoRetryPolicy() 1819 if request.RetryPolicy() != nil { 1820 policy = *request.RetryPolicy() 1821 } 1822 ociResponse, err = common.Retry(ctx, request, client.deleteTagNamespace, policy) 1823 if err != nil { 1824 if ociResponse != nil { 1825 response = DeleteTagNamespaceResponse{RawResponse: ociResponse.HTTPResponse()} 1826 } 1827 return 1828 } 1829 if convertedResponse, ok := ociResponse.(DeleteTagNamespaceResponse); ok { 1830 response = convertedResponse 1831 } else { 1832 err = fmt.Errorf("failed to convert OCIResponse into DeleteTagNamespaceResponse") 1833 } 1834 return 1835} 1836 1837// deleteTagNamespace implements the OCIOperation interface (enables retrying operations) 1838func (client IdentityClient) deleteTagNamespace(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1839 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/tagNamespaces/{tagNamespaceId}") 1840 if err != nil { 1841 return nil, err 1842 } 1843 1844 var response DeleteTagNamespaceResponse 1845 var httpResponse *http.Response 1846 httpResponse, err = client.Call(ctx, &httpRequest) 1847 defer common.CloseBodyIfValid(httpResponse) 1848 response.RawResponse = httpResponse 1849 if err != nil { 1850 return response, err 1851 } 1852 1853 err = common.UnmarshalResponse(httpResponse, &response) 1854 return response, err 1855} 1856 1857// DeleteUser Deletes the specified user. The user must not be in any groups. 1858func (client IdentityClient) DeleteUser(ctx context.Context, request DeleteUserRequest) (response DeleteUserResponse, err error) { 1859 var ociResponse common.OCIResponse 1860 policy := common.NoRetryPolicy() 1861 if request.RetryPolicy() != nil { 1862 policy = *request.RetryPolicy() 1863 } 1864 ociResponse, err = common.Retry(ctx, request, client.deleteUser, policy) 1865 if err != nil { 1866 if ociResponse != nil { 1867 response = DeleteUserResponse{RawResponse: ociResponse.HTTPResponse()} 1868 } 1869 return 1870 } 1871 if convertedResponse, ok := ociResponse.(DeleteUserResponse); ok { 1872 response = convertedResponse 1873 } else { 1874 err = fmt.Errorf("failed to convert OCIResponse into DeleteUserResponse") 1875 } 1876 return 1877} 1878 1879// deleteUser implements the OCIOperation interface (enables retrying operations) 1880func (client IdentityClient) deleteUser(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1881 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/users/{userId}") 1882 if err != nil { 1883 return nil, err 1884 } 1885 1886 var response DeleteUserResponse 1887 var httpResponse *http.Response 1888 httpResponse, err = client.Call(ctx, &httpRequest) 1889 defer common.CloseBodyIfValid(httpResponse) 1890 response.RawResponse = httpResponse 1891 if err != nil { 1892 return response, err 1893 } 1894 1895 err = common.UnmarshalResponse(httpResponse, &response) 1896 return response, err 1897} 1898 1899// GenerateTotpSeed Generate seed for the MFA TOTP device. 1900func (client IdentityClient) GenerateTotpSeed(ctx context.Context, request GenerateTotpSeedRequest) (response GenerateTotpSeedResponse, err error) { 1901 var ociResponse common.OCIResponse 1902 policy := common.NoRetryPolicy() 1903 if request.RetryPolicy() != nil { 1904 policy = *request.RetryPolicy() 1905 } 1906 ociResponse, err = common.Retry(ctx, request, client.generateTotpSeed, policy) 1907 if err != nil { 1908 if ociResponse != nil { 1909 response = GenerateTotpSeedResponse{RawResponse: ociResponse.HTTPResponse()} 1910 } 1911 return 1912 } 1913 if convertedResponse, ok := ociResponse.(GenerateTotpSeedResponse); ok { 1914 response = convertedResponse 1915 } else { 1916 err = fmt.Errorf("failed to convert OCIResponse into GenerateTotpSeedResponse") 1917 } 1918 return 1919} 1920 1921// generateTotpSeed implements the OCIOperation interface (enables retrying operations) 1922func (client IdentityClient) generateTotpSeed(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1923 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}/actions/generateSeed") 1924 if err != nil { 1925 return nil, err 1926 } 1927 1928 var response GenerateTotpSeedResponse 1929 var httpResponse *http.Response 1930 httpResponse, err = client.Call(ctx, &httpRequest) 1931 defer common.CloseBodyIfValid(httpResponse) 1932 response.RawResponse = httpResponse 1933 if err != nil { 1934 return response, err 1935 } 1936 1937 err = common.UnmarshalResponse(httpResponse, &response) 1938 return response, err 1939} 1940 1941// GetAuthenticationPolicy Gets the authentication policy for the given tenancy. You must specify your tenant’s OCID as the value for 1942// the compartment ID (remember that the tenancy is simply the root compartment). 1943func (client IdentityClient) GetAuthenticationPolicy(ctx context.Context, request GetAuthenticationPolicyRequest) (response GetAuthenticationPolicyResponse, err error) { 1944 var ociResponse common.OCIResponse 1945 policy := common.NoRetryPolicy() 1946 if request.RetryPolicy() != nil { 1947 policy = *request.RetryPolicy() 1948 } 1949 ociResponse, err = common.Retry(ctx, request, client.getAuthenticationPolicy, policy) 1950 if err != nil { 1951 if ociResponse != nil { 1952 response = GetAuthenticationPolicyResponse{RawResponse: ociResponse.HTTPResponse()} 1953 } 1954 return 1955 } 1956 if convertedResponse, ok := ociResponse.(GetAuthenticationPolicyResponse); ok { 1957 response = convertedResponse 1958 } else { 1959 err = fmt.Errorf("failed to convert OCIResponse into GetAuthenticationPolicyResponse") 1960 } 1961 return 1962} 1963 1964// getAuthenticationPolicy implements the OCIOperation interface (enables retrying operations) 1965func (client IdentityClient) getAuthenticationPolicy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 1966 httpRequest, err := request.HTTPRequest(http.MethodGet, "/authenticationPolicies/{compartmentId}") 1967 if err != nil { 1968 return nil, err 1969 } 1970 1971 var response GetAuthenticationPolicyResponse 1972 var httpResponse *http.Response 1973 httpResponse, err = client.Call(ctx, &httpRequest) 1974 defer common.CloseBodyIfValid(httpResponse) 1975 response.RawResponse = httpResponse 1976 if err != nil { 1977 return response, err 1978 } 1979 1980 err = common.UnmarshalResponse(httpResponse, &response) 1981 return response, err 1982} 1983 1984// GetCompartment Gets the specified compartment's information. 1985// This operation does not return a list of all the resources inside the compartment. There is no single 1986// API operation that does that. Compartments can contain multiple types of resources (instances, block 1987// storage volumes, etc.). To find out what's in a compartment, you must call the "List" operation for 1988// each resource type and specify the compartment's OCID as a query parameter in the request. For example, 1989// call the ListInstances operation in the Cloud Compute 1990// Service or the ListVolumes operation in Cloud Block Storage. 1991func (client IdentityClient) GetCompartment(ctx context.Context, request GetCompartmentRequest) (response GetCompartmentResponse, err error) { 1992 var ociResponse common.OCIResponse 1993 policy := common.NoRetryPolicy() 1994 if request.RetryPolicy() != nil { 1995 policy = *request.RetryPolicy() 1996 } 1997 ociResponse, err = common.Retry(ctx, request, client.getCompartment, policy) 1998 if err != nil { 1999 if ociResponse != nil { 2000 response = GetCompartmentResponse{RawResponse: ociResponse.HTTPResponse()} 2001 } 2002 return 2003 } 2004 if convertedResponse, ok := ociResponse.(GetCompartmentResponse); ok { 2005 response = convertedResponse 2006 } else { 2007 err = fmt.Errorf("failed to convert OCIResponse into GetCompartmentResponse") 2008 } 2009 return 2010} 2011 2012// getCompartment implements the OCIOperation interface (enables retrying operations) 2013func (client IdentityClient) getCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2014 httpRequest, err := request.HTTPRequest(http.MethodGet, "/compartments/{compartmentId}") 2015 if err != nil { 2016 return nil, err 2017 } 2018 2019 var response GetCompartmentResponse 2020 var httpResponse *http.Response 2021 httpResponse, err = client.Call(ctx, &httpRequest) 2022 defer common.CloseBodyIfValid(httpResponse) 2023 response.RawResponse = httpResponse 2024 if err != nil { 2025 return response, err 2026 } 2027 2028 err = common.UnmarshalResponse(httpResponse, &response) 2029 return response, err 2030} 2031 2032// GetDynamicGroup Gets the specified dynamic group's information. 2033func (client IdentityClient) GetDynamicGroup(ctx context.Context, request GetDynamicGroupRequest) (response GetDynamicGroupResponse, err error) { 2034 var ociResponse common.OCIResponse 2035 policy := common.NoRetryPolicy() 2036 if request.RetryPolicy() != nil { 2037 policy = *request.RetryPolicy() 2038 } 2039 ociResponse, err = common.Retry(ctx, request, client.getDynamicGroup, policy) 2040 if err != nil { 2041 if ociResponse != nil { 2042 response = GetDynamicGroupResponse{RawResponse: ociResponse.HTTPResponse()} 2043 } 2044 return 2045 } 2046 if convertedResponse, ok := ociResponse.(GetDynamicGroupResponse); ok { 2047 response = convertedResponse 2048 } else { 2049 err = fmt.Errorf("failed to convert OCIResponse into GetDynamicGroupResponse") 2050 } 2051 return 2052} 2053 2054// getDynamicGroup implements the OCIOperation interface (enables retrying operations) 2055func (client IdentityClient) getDynamicGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2056 httpRequest, err := request.HTTPRequest(http.MethodGet, "/dynamicGroups/{dynamicGroupId}") 2057 if err != nil { 2058 return nil, err 2059 } 2060 2061 var response GetDynamicGroupResponse 2062 var httpResponse *http.Response 2063 httpResponse, err = client.Call(ctx, &httpRequest) 2064 defer common.CloseBodyIfValid(httpResponse) 2065 response.RawResponse = httpResponse 2066 if err != nil { 2067 return response, err 2068 } 2069 2070 err = common.UnmarshalResponse(httpResponse, &response) 2071 return response, err 2072} 2073 2074// GetGroup Gets the specified group's information. 2075// This operation does not return a list of all the users in the group. To do that, use 2076// ListUserGroupMemberships and 2077// provide the group's OCID as a query parameter in the request. 2078func (client IdentityClient) GetGroup(ctx context.Context, request GetGroupRequest) (response GetGroupResponse, err error) { 2079 var ociResponse common.OCIResponse 2080 policy := common.NoRetryPolicy() 2081 if request.RetryPolicy() != nil { 2082 policy = *request.RetryPolicy() 2083 } 2084 ociResponse, err = common.Retry(ctx, request, client.getGroup, policy) 2085 if err != nil { 2086 if ociResponse != nil { 2087 response = GetGroupResponse{RawResponse: ociResponse.HTTPResponse()} 2088 } 2089 return 2090 } 2091 if convertedResponse, ok := ociResponse.(GetGroupResponse); ok { 2092 response = convertedResponse 2093 } else { 2094 err = fmt.Errorf("failed to convert OCIResponse into GetGroupResponse") 2095 } 2096 return 2097} 2098 2099// getGroup implements the OCIOperation interface (enables retrying operations) 2100func (client IdentityClient) getGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2101 httpRequest, err := request.HTTPRequest(http.MethodGet, "/groups/{groupId}") 2102 if err != nil { 2103 return nil, err 2104 } 2105 2106 var response GetGroupResponse 2107 var httpResponse *http.Response 2108 httpResponse, err = client.Call(ctx, &httpRequest) 2109 defer common.CloseBodyIfValid(httpResponse) 2110 response.RawResponse = httpResponse 2111 if err != nil { 2112 return response, err 2113 } 2114 2115 err = common.UnmarshalResponse(httpResponse, &response) 2116 return response, err 2117} 2118 2119// GetIdentityProvider Gets the specified identity provider's information. 2120func (client IdentityClient) GetIdentityProvider(ctx context.Context, request GetIdentityProviderRequest) (response GetIdentityProviderResponse, err error) { 2121 var ociResponse common.OCIResponse 2122 policy := common.NoRetryPolicy() 2123 if request.RetryPolicy() != nil { 2124 policy = *request.RetryPolicy() 2125 } 2126 ociResponse, err = common.Retry(ctx, request, client.getIdentityProvider, policy) 2127 if err != nil { 2128 if ociResponse != nil { 2129 response = GetIdentityProviderResponse{RawResponse: ociResponse.HTTPResponse()} 2130 } 2131 return 2132 } 2133 if convertedResponse, ok := ociResponse.(GetIdentityProviderResponse); ok { 2134 response = convertedResponse 2135 } else { 2136 err = fmt.Errorf("failed to convert OCIResponse into GetIdentityProviderResponse") 2137 } 2138 return 2139} 2140 2141// getIdentityProvider implements the OCIOperation interface (enables retrying operations) 2142func (client IdentityClient) getIdentityProvider(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2143 httpRequest, err := request.HTTPRequest(http.MethodGet, "/identityProviders/{identityProviderId}") 2144 if err != nil { 2145 return nil, err 2146 } 2147 2148 var response GetIdentityProviderResponse 2149 var httpResponse *http.Response 2150 httpResponse, err = client.Call(ctx, &httpRequest) 2151 defer common.CloseBodyIfValid(httpResponse) 2152 response.RawResponse = httpResponse 2153 if err != nil { 2154 return response, err 2155 } 2156 2157 err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &identityprovider{}) 2158 return response, err 2159} 2160 2161// GetIdpGroupMapping Gets the specified group mapping. 2162func (client IdentityClient) GetIdpGroupMapping(ctx context.Context, request GetIdpGroupMappingRequest) (response GetIdpGroupMappingResponse, err error) { 2163 var ociResponse common.OCIResponse 2164 policy := common.NoRetryPolicy() 2165 if request.RetryPolicy() != nil { 2166 policy = *request.RetryPolicy() 2167 } 2168 ociResponse, err = common.Retry(ctx, request, client.getIdpGroupMapping, policy) 2169 if err != nil { 2170 if ociResponse != nil { 2171 response = GetIdpGroupMappingResponse{RawResponse: ociResponse.HTTPResponse()} 2172 } 2173 return 2174 } 2175 if convertedResponse, ok := ociResponse.(GetIdpGroupMappingResponse); ok { 2176 response = convertedResponse 2177 } else { 2178 err = fmt.Errorf("failed to convert OCIResponse into GetIdpGroupMappingResponse") 2179 } 2180 return 2181} 2182 2183// getIdpGroupMapping implements the OCIOperation interface (enables retrying operations) 2184func (client IdentityClient) getIdpGroupMapping(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2185 httpRequest, err := request.HTTPRequest(http.MethodGet, "/identityProviders/{identityProviderId}/groupMappings/{mappingId}") 2186 if err != nil { 2187 return nil, err 2188 } 2189 2190 var response GetIdpGroupMappingResponse 2191 var httpResponse *http.Response 2192 httpResponse, err = client.Call(ctx, &httpRequest) 2193 defer common.CloseBodyIfValid(httpResponse) 2194 response.RawResponse = httpResponse 2195 if err != nil { 2196 return response, err 2197 } 2198 2199 err = common.UnmarshalResponse(httpResponse, &response) 2200 return response, err 2201} 2202 2203// GetMfaTotpDevice Get the specified MFA TOTP device for the specified user. 2204func (client IdentityClient) GetMfaTotpDevice(ctx context.Context, request GetMfaTotpDeviceRequest) (response GetMfaTotpDeviceResponse, err error) { 2205 var ociResponse common.OCIResponse 2206 policy := common.NoRetryPolicy() 2207 if request.RetryPolicy() != nil { 2208 policy = *request.RetryPolicy() 2209 } 2210 ociResponse, err = common.Retry(ctx, request, client.getMfaTotpDevice, policy) 2211 if err != nil { 2212 if ociResponse != nil { 2213 response = GetMfaTotpDeviceResponse{RawResponse: ociResponse.HTTPResponse()} 2214 } 2215 return 2216 } 2217 if convertedResponse, ok := ociResponse.(GetMfaTotpDeviceResponse); ok { 2218 response = convertedResponse 2219 } else { 2220 err = fmt.Errorf("failed to convert OCIResponse into GetMfaTotpDeviceResponse") 2221 } 2222 return 2223} 2224 2225// getMfaTotpDevice implements the OCIOperation interface (enables retrying operations) 2226func (client IdentityClient) getMfaTotpDevice(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2227 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}") 2228 if err != nil { 2229 return nil, err 2230 } 2231 2232 var response GetMfaTotpDeviceResponse 2233 var httpResponse *http.Response 2234 httpResponse, err = client.Call(ctx, &httpRequest) 2235 defer common.CloseBodyIfValid(httpResponse) 2236 response.RawResponse = httpResponse 2237 if err != nil { 2238 return response, err 2239 } 2240 2241 err = common.UnmarshalResponse(httpResponse, &response) 2242 return response, err 2243} 2244 2245// GetPolicy Gets the specified policy's information. 2246func (client IdentityClient) GetPolicy(ctx context.Context, request GetPolicyRequest) (response GetPolicyResponse, err error) { 2247 var ociResponse common.OCIResponse 2248 policy := common.NoRetryPolicy() 2249 if request.RetryPolicy() != nil { 2250 policy = *request.RetryPolicy() 2251 } 2252 ociResponse, err = common.Retry(ctx, request, client.getPolicy, policy) 2253 if err != nil { 2254 if ociResponse != nil { 2255 response = GetPolicyResponse{RawResponse: ociResponse.HTTPResponse()} 2256 } 2257 return 2258 } 2259 if convertedResponse, ok := ociResponse.(GetPolicyResponse); ok { 2260 response = convertedResponse 2261 } else { 2262 err = fmt.Errorf("failed to convert OCIResponse into GetPolicyResponse") 2263 } 2264 return 2265} 2266 2267// getPolicy implements the OCIOperation interface (enables retrying operations) 2268func (client IdentityClient) getPolicy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2269 httpRequest, err := request.HTTPRequest(http.MethodGet, "/policies/{policyId}") 2270 if err != nil { 2271 return nil, err 2272 } 2273 2274 var response GetPolicyResponse 2275 var httpResponse *http.Response 2276 httpResponse, err = client.Call(ctx, &httpRequest) 2277 defer common.CloseBodyIfValid(httpResponse) 2278 response.RawResponse = httpResponse 2279 if err != nil { 2280 return response, err 2281 } 2282 2283 err = common.UnmarshalResponse(httpResponse, &response) 2284 return response, err 2285} 2286 2287// GetTag Gets the specified tag's information. 2288func (client IdentityClient) GetTag(ctx context.Context, request GetTagRequest) (response GetTagResponse, err error) { 2289 var ociResponse common.OCIResponse 2290 policy := common.NoRetryPolicy() 2291 if request.RetryPolicy() != nil { 2292 policy = *request.RetryPolicy() 2293 } 2294 ociResponse, err = common.Retry(ctx, request, client.getTag, policy) 2295 if err != nil { 2296 if ociResponse != nil { 2297 response = GetTagResponse{RawResponse: ociResponse.HTTPResponse()} 2298 } 2299 return 2300 } 2301 if convertedResponse, ok := ociResponse.(GetTagResponse); ok { 2302 response = convertedResponse 2303 } else { 2304 err = fmt.Errorf("failed to convert OCIResponse into GetTagResponse") 2305 } 2306 return 2307} 2308 2309// getTag implements the OCIOperation interface (enables retrying operations) 2310func (client IdentityClient) getTag(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2311 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagNamespaces/{tagNamespaceId}/tags/{tagName}") 2312 if err != nil { 2313 return nil, err 2314 } 2315 2316 var response GetTagResponse 2317 var httpResponse *http.Response 2318 httpResponse, err = client.Call(ctx, &httpRequest) 2319 defer common.CloseBodyIfValid(httpResponse) 2320 response.RawResponse = httpResponse 2321 if err != nil { 2322 return response, err 2323 } 2324 2325 err = common.UnmarshalResponse(httpResponse, &response) 2326 return response, err 2327} 2328 2329// GetTagDefault Retrieves the specified tag default. 2330func (client IdentityClient) GetTagDefault(ctx context.Context, request GetTagDefaultRequest) (response GetTagDefaultResponse, err error) { 2331 var ociResponse common.OCIResponse 2332 policy := common.NoRetryPolicy() 2333 if request.RetryPolicy() != nil { 2334 policy = *request.RetryPolicy() 2335 } 2336 ociResponse, err = common.Retry(ctx, request, client.getTagDefault, policy) 2337 if err != nil { 2338 if ociResponse != nil { 2339 response = GetTagDefaultResponse{RawResponse: ociResponse.HTTPResponse()} 2340 } 2341 return 2342 } 2343 if convertedResponse, ok := ociResponse.(GetTagDefaultResponse); ok { 2344 response = convertedResponse 2345 } else { 2346 err = fmt.Errorf("failed to convert OCIResponse into GetTagDefaultResponse") 2347 } 2348 return 2349} 2350 2351// getTagDefault implements the OCIOperation interface (enables retrying operations) 2352func (client IdentityClient) getTagDefault(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2353 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagDefaults/{tagDefaultId}") 2354 if err != nil { 2355 return nil, err 2356 } 2357 2358 var response GetTagDefaultResponse 2359 var httpResponse *http.Response 2360 httpResponse, err = client.Call(ctx, &httpRequest) 2361 defer common.CloseBodyIfValid(httpResponse) 2362 response.RawResponse = httpResponse 2363 if err != nil { 2364 return response, err 2365 } 2366 2367 err = common.UnmarshalResponse(httpResponse, &response) 2368 return response, err 2369} 2370 2371// GetTagNamespace Gets the specified tag namespace's information. 2372func (client IdentityClient) GetTagNamespace(ctx context.Context, request GetTagNamespaceRequest) (response GetTagNamespaceResponse, err error) { 2373 var ociResponse common.OCIResponse 2374 policy := common.NoRetryPolicy() 2375 if request.RetryPolicy() != nil { 2376 policy = *request.RetryPolicy() 2377 } 2378 ociResponse, err = common.Retry(ctx, request, client.getTagNamespace, policy) 2379 if err != nil { 2380 if ociResponse != nil { 2381 response = GetTagNamespaceResponse{RawResponse: ociResponse.HTTPResponse()} 2382 } 2383 return 2384 } 2385 if convertedResponse, ok := ociResponse.(GetTagNamespaceResponse); ok { 2386 response = convertedResponse 2387 } else { 2388 err = fmt.Errorf("failed to convert OCIResponse into GetTagNamespaceResponse") 2389 } 2390 return 2391} 2392 2393// getTagNamespace implements the OCIOperation interface (enables retrying operations) 2394func (client IdentityClient) getTagNamespace(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2395 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagNamespaces/{tagNamespaceId}") 2396 if err != nil { 2397 return nil, err 2398 } 2399 2400 var response GetTagNamespaceResponse 2401 var httpResponse *http.Response 2402 httpResponse, err = client.Call(ctx, &httpRequest) 2403 defer common.CloseBodyIfValid(httpResponse) 2404 response.RawResponse = httpResponse 2405 if err != nil { 2406 return response, err 2407 } 2408 2409 err = common.UnmarshalResponse(httpResponse, &response) 2410 return response, err 2411} 2412 2413// GetTaggingWorkRequest Gets details on a specified work request. The workRequestID is returned in the opc-workrequest-id header 2414// for any asynchronous operation in the Identity and Access Management service. 2415func (client IdentityClient) GetTaggingWorkRequest(ctx context.Context, request GetTaggingWorkRequestRequest) (response GetTaggingWorkRequestResponse, err error) { 2416 var ociResponse common.OCIResponse 2417 policy := common.NoRetryPolicy() 2418 if request.RetryPolicy() != nil { 2419 policy = *request.RetryPolicy() 2420 } 2421 ociResponse, err = common.Retry(ctx, request, client.getTaggingWorkRequest, policy) 2422 if err != nil { 2423 if ociResponse != nil { 2424 response = GetTaggingWorkRequestResponse{RawResponse: ociResponse.HTTPResponse()} 2425 } 2426 return 2427 } 2428 if convertedResponse, ok := ociResponse.(GetTaggingWorkRequestResponse); ok { 2429 response = convertedResponse 2430 } else { 2431 err = fmt.Errorf("failed to convert OCIResponse into GetTaggingWorkRequestResponse") 2432 } 2433 return 2434} 2435 2436// getTaggingWorkRequest implements the OCIOperation interface (enables retrying operations) 2437func (client IdentityClient) getTaggingWorkRequest(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2438 httpRequest, err := request.HTTPRequest(http.MethodGet, "/taggingWorkRequests/{workRequestId}") 2439 if err != nil { 2440 return nil, err 2441 } 2442 2443 var response GetTaggingWorkRequestResponse 2444 var httpResponse *http.Response 2445 httpResponse, err = client.Call(ctx, &httpRequest) 2446 defer common.CloseBodyIfValid(httpResponse) 2447 response.RawResponse = httpResponse 2448 if err != nil { 2449 return response, err 2450 } 2451 2452 err = common.UnmarshalResponse(httpResponse, &response) 2453 return response, err 2454} 2455 2456// GetTenancy Get the specified tenancy's information. 2457func (client IdentityClient) GetTenancy(ctx context.Context, request GetTenancyRequest) (response GetTenancyResponse, err error) { 2458 var ociResponse common.OCIResponse 2459 policy := common.NoRetryPolicy() 2460 if request.RetryPolicy() != nil { 2461 policy = *request.RetryPolicy() 2462 } 2463 ociResponse, err = common.Retry(ctx, request, client.getTenancy, policy) 2464 if err != nil { 2465 if ociResponse != nil { 2466 response = GetTenancyResponse{RawResponse: ociResponse.HTTPResponse()} 2467 } 2468 return 2469 } 2470 if convertedResponse, ok := ociResponse.(GetTenancyResponse); ok { 2471 response = convertedResponse 2472 } else { 2473 err = fmt.Errorf("failed to convert OCIResponse into GetTenancyResponse") 2474 } 2475 return 2476} 2477 2478// getTenancy implements the OCIOperation interface (enables retrying operations) 2479func (client IdentityClient) getTenancy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2480 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tenancies/{tenancyId}") 2481 if err != nil { 2482 return nil, err 2483 } 2484 2485 var response GetTenancyResponse 2486 var httpResponse *http.Response 2487 httpResponse, err = client.Call(ctx, &httpRequest) 2488 defer common.CloseBodyIfValid(httpResponse) 2489 response.RawResponse = httpResponse 2490 if err != nil { 2491 return response, err 2492 } 2493 2494 err = common.UnmarshalResponse(httpResponse, &response) 2495 return response, err 2496} 2497 2498// GetUser Gets the specified user's information. 2499func (client IdentityClient) GetUser(ctx context.Context, request GetUserRequest) (response GetUserResponse, err error) { 2500 var ociResponse common.OCIResponse 2501 policy := common.NoRetryPolicy() 2502 if request.RetryPolicy() != nil { 2503 policy = *request.RetryPolicy() 2504 } 2505 ociResponse, err = common.Retry(ctx, request, client.getUser, policy) 2506 if err != nil { 2507 if ociResponse != nil { 2508 response = GetUserResponse{RawResponse: ociResponse.HTTPResponse()} 2509 } 2510 return 2511 } 2512 if convertedResponse, ok := ociResponse.(GetUserResponse); ok { 2513 response = convertedResponse 2514 } else { 2515 err = fmt.Errorf("failed to convert OCIResponse into GetUserResponse") 2516 } 2517 return 2518} 2519 2520// getUser implements the OCIOperation interface (enables retrying operations) 2521func (client IdentityClient) getUser(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2522 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}") 2523 if err != nil { 2524 return nil, err 2525 } 2526 2527 var response GetUserResponse 2528 var httpResponse *http.Response 2529 httpResponse, err = client.Call(ctx, &httpRequest) 2530 defer common.CloseBodyIfValid(httpResponse) 2531 response.RawResponse = httpResponse 2532 if err != nil { 2533 return response, err 2534 } 2535 2536 err = common.UnmarshalResponse(httpResponse, &response) 2537 return response, err 2538} 2539 2540// GetUserGroupMembership Gets the specified UserGroupMembership's information. 2541func (client IdentityClient) GetUserGroupMembership(ctx context.Context, request GetUserGroupMembershipRequest) (response GetUserGroupMembershipResponse, err error) { 2542 var ociResponse common.OCIResponse 2543 policy := common.NoRetryPolicy() 2544 if request.RetryPolicy() != nil { 2545 policy = *request.RetryPolicy() 2546 } 2547 ociResponse, err = common.Retry(ctx, request, client.getUserGroupMembership, policy) 2548 if err != nil { 2549 if ociResponse != nil { 2550 response = GetUserGroupMembershipResponse{RawResponse: ociResponse.HTTPResponse()} 2551 } 2552 return 2553 } 2554 if convertedResponse, ok := ociResponse.(GetUserGroupMembershipResponse); ok { 2555 response = convertedResponse 2556 } else { 2557 err = fmt.Errorf("failed to convert OCIResponse into GetUserGroupMembershipResponse") 2558 } 2559 return 2560} 2561 2562// getUserGroupMembership implements the OCIOperation interface (enables retrying operations) 2563func (client IdentityClient) getUserGroupMembership(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2564 httpRequest, err := request.HTTPRequest(http.MethodGet, "/userGroupMemberships/{userGroupMembershipId}") 2565 if err != nil { 2566 return nil, err 2567 } 2568 2569 var response GetUserGroupMembershipResponse 2570 var httpResponse *http.Response 2571 httpResponse, err = client.Call(ctx, &httpRequest) 2572 defer common.CloseBodyIfValid(httpResponse) 2573 response.RawResponse = httpResponse 2574 if err != nil { 2575 return response, err 2576 } 2577 2578 err = common.UnmarshalResponse(httpResponse, &response) 2579 return response, err 2580} 2581 2582// GetUserUIPasswordInformation Gets the specified user's console password information. The returned object contains the user's OCID, 2583// but not the password itself. The actual password is returned only when created or reset. 2584func (client IdentityClient) GetUserUIPasswordInformation(ctx context.Context, request GetUserUIPasswordInformationRequest) (response GetUserUIPasswordInformationResponse, err error) { 2585 var ociResponse common.OCIResponse 2586 policy := common.NoRetryPolicy() 2587 if request.RetryPolicy() != nil { 2588 policy = *request.RetryPolicy() 2589 } 2590 ociResponse, err = common.Retry(ctx, request, client.getUserUIPasswordInformation, policy) 2591 if err != nil { 2592 if ociResponse != nil { 2593 response = GetUserUIPasswordInformationResponse{RawResponse: ociResponse.HTTPResponse()} 2594 } 2595 return 2596 } 2597 if convertedResponse, ok := ociResponse.(GetUserUIPasswordInformationResponse); ok { 2598 response = convertedResponse 2599 } else { 2600 err = fmt.Errorf("failed to convert OCIResponse into GetUserUIPasswordInformationResponse") 2601 } 2602 return 2603} 2604 2605// getUserUIPasswordInformation implements the OCIOperation interface (enables retrying operations) 2606func (client IdentityClient) getUserUIPasswordInformation(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2607 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/uiPassword") 2608 if err != nil { 2609 return nil, err 2610 } 2611 2612 var response GetUserUIPasswordInformationResponse 2613 var httpResponse *http.Response 2614 httpResponse, err = client.Call(ctx, &httpRequest) 2615 defer common.CloseBodyIfValid(httpResponse) 2616 response.RawResponse = httpResponse 2617 if err != nil { 2618 return response, err 2619 } 2620 2621 err = common.UnmarshalResponse(httpResponse, &response) 2622 return response, err 2623} 2624 2625// GetWorkRequest Gets details on a specified work request. The workRequestID is returned in the opc-workrequest-id header 2626// for any asynchronous operation in the Identity and Access Management service. 2627func (client IdentityClient) GetWorkRequest(ctx context.Context, request GetWorkRequestRequest) (response GetWorkRequestResponse, err error) { 2628 var ociResponse common.OCIResponse 2629 policy := common.NoRetryPolicy() 2630 if request.RetryPolicy() != nil { 2631 policy = *request.RetryPolicy() 2632 } 2633 ociResponse, err = common.Retry(ctx, request, client.getWorkRequest, policy) 2634 if err != nil { 2635 if ociResponse != nil { 2636 response = GetWorkRequestResponse{RawResponse: ociResponse.HTTPResponse()} 2637 } 2638 return 2639 } 2640 if convertedResponse, ok := ociResponse.(GetWorkRequestResponse); ok { 2641 response = convertedResponse 2642 } else { 2643 err = fmt.Errorf("failed to convert OCIResponse into GetWorkRequestResponse") 2644 } 2645 return 2646} 2647 2648// getWorkRequest implements the OCIOperation interface (enables retrying operations) 2649func (client IdentityClient) getWorkRequest(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2650 httpRequest, err := request.HTTPRequest(http.MethodGet, "/workRequests/{workRequestId}") 2651 if err != nil { 2652 return nil, err 2653 } 2654 2655 var response GetWorkRequestResponse 2656 var httpResponse *http.Response 2657 httpResponse, err = client.Call(ctx, &httpRequest) 2658 defer common.CloseBodyIfValid(httpResponse) 2659 response.RawResponse = httpResponse 2660 if err != nil { 2661 return response, err 2662 } 2663 2664 err = common.UnmarshalResponse(httpResponse, &response) 2665 return response, err 2666} 2667 2668// ListApiKeys Lists the API signing keys for the specified user. A user can have a maximum of three keys. 2669// Every user has permission to use this API call for *their own user ID*. An administrator in your 2670// organization does not need to write a policy to give users this ability. 2671func (client IdentityClient) ListApiKeys(ctx context.Context, request ListApiKeysRequest) (response ListApiKeysResponse, err error) { 2672 var ociResponse common.OCIResponse 2673 policy := common.NoRetryPolicy() 2674 if request.RetryPolicy() != nil { 2675 policy = *request.RetryPolicy() 2676 } 2677 ociResponse, err = common.Retry(ctx, request, client.listApiKeys, policy) 2678 if err != nil { 2679 if ociResponse != nil { 2680 response = ListApiKeysResponse{RawResponse: ociResponse.HTTPResponse()} 2681 } 2682 return 2683 } 2684 if convertedResponse, ok := ociResponse.(ListApiKeysResponse); ok { 2685 response = convertedResponse 2686 } else { 2687 err = fmt.Errorf("failed to convert OCIResponse into ListApiKeysResponse") 2688 } 2689 return 2690} 2691 2692// listApiKeys implements the OCIOperation interface (enables retrying operations) 2693func (client IdentityClient) listApiKeys(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2694 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/apiKeys") 2695 if err != nil { 2696 return nil, err 2697 } 2698 2699 var response ListApiKeysResponse 2700 var httpResponse *http.Response 2701 httpResponse, err = client.Call(ctx, &httpRequest) 2702 defer common.CloseBodyIfValid(httpResponse) 2703 response.RawResponse = httpResponse 2704 if err != nil { 2705 return response, err 2706 } 2707 2708 err = common.UnmarshalResponse(httpResponse, &response) 2709 return response, err 2710} 2711 2712// ListAuthTokens Lists the auth tokens for the specified user. The returned object contains the token's OCID, but not 2713// the token itself. The actual token is returned only upon creation. 2714func (client IdentityClient) ListAuthTokens(ctx context.Context, request ListAuthTokensRequest) (response ListAuthTokensResponse, err error) { 2715 var ociResponse common.OCIResponse 2716 policy := common.NoRetryPolicy() 2717 if request.RetryPolicy() != nil { 2718 policy = *request.RetryPolicy() 2719 } 2720 ociResponse, err = common.Retry(ctx, request, client.listAuthTokens, policy) 2721 if err != nil { 2722 if ociResponse != nil { 2723 response = ListAuthTokensResponse{RawResponse: ociResponse.HTTPResponse()} 2724 } 2725 return 2726 } 2727 if convertedResponse, ok := ociResponse.(ListAuthTokensResponse); ok { 2728 response = convertedResponse 2729 } else { 2730 err = fmt.Errorf("failed to convert OCIResponse into ListAuthTokensResponse") 2731 } 2732 return 2733} 2734 2735// listAuthTokens implements the OCIOperation interface (enables retrying operations) 2736func (client IdentityClient) listAuthTokens(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2737 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/authTokens") 2738 if err != nil { 2739 return nil, err 2740 } 2741 2742 var response ListAuthTokensResponse 2743 var httpResponse *http.Response 2744 httpResponse, err = client.Call(ctx, &httpRequest) 2745 defer common.CloseBodyIfValid(httpResponse) 2746 response.RawResponse = httpResponse 2747 if err != nil { 2748 return response, err 2749 } 2750 2751 err = common.UnmarshalResponse(httpResponse, &response) 2752 return response, err 2753} 2754 2755// ListAvailabilityDomains Lists the availability domains in your tenancy. Specify the OCID of either the tenancy or another 2756// of your compartments as the value for the compartment ID (remember that the tenancy is simply the root compartment). 2757// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 2758// Note that the order of the results returned can change if availability domains are added or removed; therefore, do not 2759// create a dependency on the list order. 2760func (client IdentityClient) ListAvailabilityDomains(ctx context.Context, request ListAvailabilityDomainsRequest) (response ListAvailabilityDomainsResponse, err error) { 2761 var ociResponse common.OCIResponse 2762 policy := common.NoRetryPolicy() 2763 if request.RetryPolicy() != nil { 2764 policy = *request.RetryPolicy() 2765 } 2766 ociResponse, err = common.Retry(ctx, request, client.listAvailabilityDomains, policy) 2767 if err != nil { 2768 if ociResponse != nil { 2769 response = ListAvailabilityDomainsResponse{RawResponse: ociResponse.HTTPResponse()} 2770 } 2771 return 2772 } 2773 if convertedResponse, ok := ociResponse.(ListAvailabilityDomainsResponse); ok { 2774 response = convertedResponse 2775 } else { 2776 err = fmt.Errorf("failed to convert OCIResponse into ListAvailabilityDomainsResponse") 2777 } 2778 return 2779} 2780 2781// listAvailabilityDomains implements the OCIOperation interface (enables retrying operations) 2782func (client IdentityClient) listAvailabilityDomains(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2783 httpRequest, err := request.HTTPRequest(http.MethodGet, "/availabilityDomains") 2784 if err != nil { 2785 return nil, err 2786 } 2787 2788 var response ListAvailabilityDomainsResponse 2789 var httpResponse *http.Response 2790 httpResponse, err = client.Call(ctx, &httpRequest) 2791 defer common.CloseBodyIfValid(httpResponse) 2792 response.RawResponse = httpResponse 2793 if err != nil { 2794 return response, err 2795 } 2796 2797 err = common.UnmarshalResponse(httpResponse, &response) 2798 return response, err 2799} 2800 2801// ListCompartments Lists the compartments in a specified compartment. The members of the list 2802// returned depends on the values set for several parameters. 2803// With the exception of the tenancy (root compartment), the ListCompartments operation 2804// returns only the first-level child compartments in the parent compartment specified in 2805// `compartmentId`. The list does not include any subcompartments of the child 2806// compartments (grandchildren). 2807// The parameter `accessLevel` specifies whether to return only those compartments for which the 2808// requestor has INSPECT permissions on at least one resource directly 2809// or indirectly (the resource can be in a subcompartment). 2810// The parameter `compartmentIdInSubtree` applies only when you perform ListCompartments on the 2811// tenancy (root compartment). When set to true, the entire hierarchy of compartments can be returned. 2812// To get a full list of all compartments and subcompartments in the tenancy (root compartment), 2813// set the parameter `compartmentIdInSubtree` to true and `accessLevel` to ANY. 2814// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 2815func (client IdentityClient) ListCompartments(ctx context.Context, request ListCompartmentsRequest) (response ListCompartmentsResponse, err error) { 2816 var ociResponse common.OCIResponse 2817 policy := common.NoRetryPolicy() 2818 if request.RetryPolicy() != nil { 2819 policy = *request.RetryPolicy() 2820 } 2821 ociResponse, err = common.Retry(ctx, request, client.listCompartments, policy) 2822 if err != nil { 2823 if ociResponse != nil { 2824 response = ListCompartmentsResponse{RawResponse: ociResponse.HTTPResponse()} 2825 } 2826 return 2827 } 2828 if convertedResponse, ok := ociResponse.(ListCompartmentsResponse); ok { 2829 response = convertedResponse 2830 } else { 2831 err = fmt.Errorf("failed to convert OCIResponse into ListCompartmentsResponse") 2832 } 2833 return 2834} 2835 2836// listCompartments implements the OCIOperation interface (enables retrying operations) 2837func (client IdentityClient) listCompartments(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2838 httpRequest, err := request.HTTPRequest(http.MethodGet, "/compartments") 2839 if err != nil { 2840 return nil, err 2841 } 2842 2843 var response ListCompartmentsResponse 2844 var httpResponse *http.Response 2845 httpResponse, err = client.Call(ctx, &httpRequest) 2846 defer common.CloseBodyIfValid(httpResponse) 2847 response.RawResponse = httpResponse 2848 if err != nil { 2849 return response, err 2850 } 2851 2852 err = common.UnmarshalResponse(httpResponse, &response) 2853 return response, err 2854} 2855 2856// ListCostTrackingTags Lists all the tags enabled for cost-tracking in the specified tenancy. For information about 2857// cost-tracking tags, see Using Cost-tracking Tags (https://docs.cloud.oracle.com/Content/Identity/Concepts/taggingoverview.htm#costs). 2858func (client IdentityClient) ListCostTrackingTags(ctx context.Context, request ListCostTrackingTagsRequest) (response ListCostTrackingTagsResponse, err error) { 2859 var ociResponse common.OCIResponse 2860 policy := common.NoRetryPolicy() 2861 if request.RetryPolicy() != nil { 2862 policy = *request.RetryPolicy() 2863 } 2864 ociResponse, err = common.Retry(ctx, request, client.listCostTrackingTags, policy) 2865 if err != nil { 2866 if ociResponse != nil { 2867 response = ListCostTrackingTagsResponse{RawResponse: ociResponse.HTTPResponse()} 2868 } 2869 return 2870 } 2871 if convertedResponse, ok := ociResponse.(ListCostTrackingTagsResponse); ok { 2872 response = convertedResponse 2873 } else { 2874 err = fmt.Errorf("failed to convert OCIResponse into ListCostTrackingTagsResponse") 2875 } 2876 return 2877} 2878 2879// listCostTrackingTags implements the OCIOperation interface (enables retrying operations) 2880func (client IdentityClient) listCostTrackingTags(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2881 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagNamespaces/actions/listCostTrackingTags") 2882 if err != nil { 2883 return nil, err 2884 } 2885 2886 var response ListCostTrackingTagsResponse 2887 var httpResponse *http.Response 2888 httpResponse, err = client.Call(ctx, &httpRequest) 2889 defer common.CloseBodyIfValid(httpResponse) 2890 response.RawResponse = httpResponse 2891 if err != nil { 2892 return response, err 2893 } 2894 2895 err = common.UnmarshalResponse(httpResponse, &response) 2896 return response, err 2897} 2898 2899// ListCustomerSecretKeys Lists the secret keys for the specified user. The returned object contains the secret key's OCID, but not 2900// the secret key itself. The actual secret key is returned only upon creation. 2901func (client IdentityClient) ListCustomerSecretKeys(ctx context.Context, request ListCustomerSecretKeysRequest) (response ListCustomerSecretKeysResponse, err error) { 2902 var ociResponse common.OCIResponse 2903 policy := common.NoRetryPolicy() 2904 if request.RetryPolicy() != nil { 2905 policy = *request.RetryPolicy() 2906 } 2907 ociResponse, err = common.Retry(ctx, request, client.listCustomerSecretKeys, policy) 2908 if err != nil { 2909 if ociResponse != nil { 2910 response = ListCustomerSecretKeysResponse{RawResponse: ociResponse.HTTPResponse()} 2911 } 2912 return 2913 } 2914 if convertedResponse, ok := ociResponse.(ListCustomerSecretKeysResponse); ok { 2915 response = convertedResponse 2916 } else { 2917 err = fmt.Errorf("failed to convert OCIResponse into ListCustomerSecretKeysResponse") 2918 } 2919 return 2920} 2921 2922// listCustomerSecretKeys implements the OCIOperation interface (enables retrying operations) 2923func (client IdentityClient) listCustomerSecretKeys(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2924 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/customerSecretKeys") 2925 if err != nil { 2926 return nil, err 2927 } 2928 2929 var response ListCustomerSecretKeysResponse 2930 var httpResponse *http.Response 2931 httpResponse, err = client.Call(ctx, &httpRequest) 2932 defer common.CloseBodyIfValid(httpResponse) 2933 response.RawResponse = httpResponse 2934 if err != nil { 2935 return response, err 2936 } 2937 2938 err = common.UnmarshalResponse(httpResponse, &response) 2939 return response, err 2940} 2941 2942// ListDynamicGroups Lists the dynamic groups in your tenancy. You must specify your tenancy's OCID as the value for 2943// the compartment ID (remember that the tenancy is simply the root compartment). 2944// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 2945func (client IdentityClient) ListDynamicGroups(ctx context.Context, request ListDynamicGroupsRequest) (response ListDynamicGroupsResponse, err error) { 2946 var ociResponse common.OCIResponse 2947 policy := common.NoRetryPolicy() 2948 if request.RetryPolicy() != nil { 2949 policy = *request.RetryPolicy() 2950 } 2951 ociResponse, err = common.Retry(ctx, request, client.listDynamicGroups, policy) 2952 if err != nil { 2953 if ociResponse != nil { 2954 response = ListDynamicGroupsResponse{RawResponse: ociResponse.HTTPResponse()} 2955 } 2956 return 2957 } 2958 if convertedResponse, ok := ociResponse.(ListDynamicGroupsResponse); ok { 2959 response = convertedResponse 2960 } else { 2961 err = fmt.Errorf("failed to convert OCIResponse into ListDynamicGroupsResponse") 2962 } 2963 return 2964} 2965 2966// listDynamicGroups implements the OCIOperation interface (enables retrying operations) 2967func (client IdentityClient) listDynamicGroups(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 2968 httpRequest, err := request.HTTPRequest(http.MethodGet, "/dynamicGroups") 2969 if err != nil { 2970 return nil, err 2971 } 2972 2973 var response ListDynamicGroupsResponse 2974 var httpResponse *http.Response 2975 httpResponse, err = client.Call(ctx, &httpRequest) 2976 defer common.CloseBodyIfValid(httpResponse) 2977 response.RawResponse = httpResponse 2978 if err != nil { 2979 return response, err 2980 } 2981 2982 err = common.UnmarshalResponse(httpResponse, &response) 2983 return response, err 2984} 2985 2986// ListFaultDomains Lists the Fault Domains in your tenancy. Specify the OCID of either the tenancy or another 2987// of your compartments as the value for the compartment ID (remember that the tenancy is simply the root compartment). 2988// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 2989func (client IdentityClient) ListFaultDomains(ctx context.Context, request ListFaultDomainsRequest) (response ListFaultDomainsResponse, err error) { 2990 var ociResponse common.OCIResponse 2991 policy := common.NoRetryPolicy() 2992 if request.RetryPolicy() != nil { 2993 policy = *request.RetryPolicy() 2994 } 2995 ociResponse, err = common.Retry(ctx, request, client.listFaultDomains, policy) 2996 if err != nil { 2997 if ociResponse != nil { 2998 response = ListFaultDomainsResponse{RawResponse: ociResponse.HTTPResponse()} 2999 } 3000 return 3001 } 3002 if convertedResponse, ok := ociResponse.(ListFaultDomainsResponse); ok { 3003 response = convertedResponse 3004 } else { 3005 err = fmt.Errorf("failed to convert OCIResponse into ListFaultDomainsResponse") 3006 } 3007 return 3008} 3009 3010// listFaultDomains implements the OCIOperation interface (enables retrying operations) 3011func (client IdentityClient) listFaultDomains(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3012 httpRequest, err := request.HTTPRequest(http.MethodGet, "/faultDomains") 3013 if err != nil { 3014 return nil, err 3015 } 3016 3017 var response ListFaultDomainsResponse 3018 var httpResponse *http.Response 3019 httpResponse, err = client.Call(ctx, &httpRequest) 3020 defer common.CloseBodyIfValid(httpResponse) 3021 response.RawResponse = httpResponse 3022 if err != nil { 3023 return response, err 3024 } 3025 3026 err = common.UnmarshalResponse(httpResponse, &response) 3027 return response, err 3028} 3029 3030// ListGroups Lists the groups in your tenancy. You must specify your tenancy's OCID as the value for 3031// the compartment ID (remember that the tenancy is simply the root compartment). 3032// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 3033func (client IdentityClient) ListGroups(ctx context.Context, request ListGroupsRequest) (response ListGroupsResponse, err error) { 3034 var ociResponse common.OCIResponse 3035 policy := common.NoRetryPolicy() 3036 if request.RetryPolicy() != nil { 3037 policy = *request.RetryPolicy() 3038 } 3039 ociResponse, err = common.Retry(ctx, request, client.listGroups, policy) 3040 if err != nil { 3041 if ociResponse != nil { 3042 response = ListGroupsResponse{RawResponse: ociResponse.HTTPResponse()} 3043 } 3044 return 3045 } 3046 if convertedResponse, ok := ociResponse.(ListGroupsResponse); ok { 3047 response = convertedResponse 3048 } else { 3049 err = fmt.Errorf("failed to convert OCIResponse into ListGroupsResponse") 3050 } 3051 return 3052} 3053 3054// listGroups implements the OCIOperation interface (enables retrying operations) 3055func (client IdentityClient) listGroups(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3056 httpRequest, err := request.HTTPRequest(http.MethodGet, "/groups") 3057 if err != nil { 3058 return nil, err 3059 } 3060 3061 var response ListGroupsResponse 3062 var httpResponse *http.Response 3063 httpResponse, err = client.Call(ctx, &httpRequest) 3064 defer common.CloseBodyIfValid(httpResponse) 3065 response.RawResponse = httpResponse 3066 if err != nil { 3067 return response, err 3068 } 3069 3070 err = common.UnmarshalResponse(httpResponse, &response) 3071 return response, err 3072} 3073 3074// ListIdentityProviderGroups Lists the identity provider groups. 3075func (client IdentityClient) ListIdentityProviderGroups(ctx context.Context, request ListIdentityProviderGroupsRequest) (response ListIdentityProviderGroupsResponse, err error) { 3076 var ociResponse common.OCIResponse 3077 policy := common.NoRetryPolicy() 3078 if request.RetryPolicy() != nil { 3079 policy = *request.RetryPolicy() 3080 } 3081 ociResponse, err = common.Retry(ctx, request, client.listIdentityProviderGroups, policy) 3082 if err != nil { 3083 if ociResponse != nil { 3084 response = ListIdentityProviderGroupsResponse{RawResponse: ociResponse.HTTPResponse()} 3085 } 3086 return 3087 } 3088 if convertedResponse, ok := ociResponse.(ListIdentityProviderGroupsResponse); ok { 3089 response = convertedResponse 3090 } else { 3091 err = fmt.Errorf("failed to convert OCIResponse into ListIdentityProviderGroupsResponse") 3092 } 3093 return 3094} 3095 3096// listIdentityProviderGroups implements the OCIOperation interface (enables retrying operations) 3097func (client IdentityClient) listIdentityProviderGroups(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3098 httpRequest, err := request.HTTPRequest(http.MethodGet, "/identityProviders/{identityProviderId}/groups") 3099 if err != nil { 3100 return nil, err 3101 } 3102 3103 var response ListIdentityProviderGroupsResponse 3104 var httpResponse *http.Response 3105 httpResponse, err = client.Call(ctx, &httpRequest) 3106 defer common.CloseBodyIfValid(httpResponse) 3107 response.RawResponse = httpResponse 3108 if err != nil { 3109 return response, err 3110 } 3111 3112 err = common.UnmarshalResponse(httpResponse, &response) 3113 return response, err 3114} 3115 3116//listidentityprovider allows to unmarshal list of polymorphic IdentityProvider 3117type listidentityprovider []identityprovider 3118 3119//UnmarshalPolymorphicJSON unmarshals polymorphic json list of items 3120func (m *listidentityprovider) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { 3121 res := make([]IdentityProvider, len(*m)) 3122 for i, v := range *m { 3123 nn, err := v.UnmarshalPolymorphicJSON(v.JsonData) 3124 if err != nil { 3125 return nil, err 3126 } 3127 res[i] = nn.(IdentityProvider) 3128 } 3129 return res, nil 3130} 3131 3132// ListIdentityProviders Lists all the identity providers in your tenancy. You must specify the identity provider type (e.g., `SAML2` for 3133// identity providers using the SAML2.0 protocol). You must specify your tenancy's OCID as the value for the 3134// compartment ID (remember that the tenancy is simply the root compartment). 3135// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 3136func (client IdentityClient) ListIdentityProviders(ctx context.Context, request ListIdentityProvidersRequest) (response ListIdentityProvidersResponse, err error) { 3137 var ociResponse common.OCIResponse 3138 policy := common.NoRetryPolicy() 3139 if request.RetryPolicy() != nil { 3140 policy = *request.RetryPolicy() 3141 } 3142 ociResponse, err = common.Retry(ctx, request, client.listIdentityProviders, policy) 3143 if err != nil { 3144 if ociResponse != nil { 3145 response = ListIdentityProvidersResponse{RawResponse: ociResponse.HTTPResponse()} 3146 } 3147 return 3148 } 3149 if convertedResponse, ok := ociResponse.(ListIdentityProvidersResponse); ok { 3150 response = convertedResponse 3151 } else { 3152 err = fmt.Errorf("failed to convert OCIResponse into ListIdentityProvidersResponse") 3153 } 3154 return 3155} 3156 3157// listIdentityProviders implements the OCIOperation interface (enables retrying operations) 3158func (client IdentityClient) listIdentityProviders(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3159 httpRequest, err := request.HTTPRequest(http.MethodGet, "/identityProviders") 3160 if err != nil { 3161 return nil, err 3162 } 3163 3164 var response ListIdentityProvidersResponse 3165 var httpResponse *http.Response 3166 httpResponse, err = client.Call(ctx, &httpRequest) 3167 defer common.CloseBodyIfValid(httpResponse) 3168 response.RawResponse = httpResponse 3169 if err != nil { 3170 return response, err 3171 } 3172 3173 err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &listidentityprovider{}) 3174 return response, err 3175} 3176 3177// ListIdpGroupMappings Lists the group mappings for the specified identity provider. 3178func (client IdentityClient) ListIdpGroupMappings(ctx context.Context, request ListIdpGroupMappingsRequest) (response ListIdpGroupMappingsResponse, err error) { 3179 var ociResponse common.OCIResponse 3180 policy := common.NoRetryPolicy() 3181 if request.RetryPolicy() != nil { 3182 policy = *request.RetryPolicy() 3183 } 3184 ociResponse, err = common.Retry(ctx, request, client.listIdpGroupMappings, policy) 3185 if err != nil { 3186 if ociResponse != nil { 3187 response = ListIdpGroupMappingsResponse{RawResponse: ociResponse.HTTPResponse()} 3188 } 3189 return 3190 } 3191 if convertedResponse, ok := ociResponse.(ListIdpGroupMappingsResponse); ok { 3192 response = convertedResponse 3193 } else { 3194 err = fmt.Errorf("failed to convert OCIResponse into ListIdpGroupMappingsResponse") 3195 } 3196 return 3197} 3198 3199// listIdpGroupMappings implements the OCIOperation interface (enables retrying operations) 3200func (client IdentityClient) listIdpGroupMappings(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3201 httpRequest, err := request.HTTPRequest(http.MethodGet, "/identityProviders/{identityProviderId}/groupMappings") 3202 if err != nil { 3203 return nil, err 3204 } 3205 3206 var response ListIdpGroupMappingsResponse 3207 var httpResponse *http.Response 3208 httpResponse, err = client.Call(ctx, &httpRequest) 3209 defer common.CloseBodyIfValid(httpResponse) 3210 response.RawResponse = httpResponse 3211 if err != nil { 3212 return response, err 3213 } 3214 3215 err = common.UnmarshalResponse(httpResponse, &response) 3216 return response, err 3217} 3218 3219// ListMfaTotpDevices Lists the MFA TOTP devices for the specified user. The returned object contains the device's OCID, but not 3220// the seed. The seed is returned only upon creation or when the IAM service regenerates the MFA seed for the device. 3221func (client IdentityClient) ListMfaTotpDevices(ctx context.Context, request ListMfaTotpDevicesRequest) (response ListMfaTotpDevicesResponse, err error) { 3222 var ociResponse common.OCIResponse 3223 policy := common.NoRetryPolicy() 3224 if request.RetryPolicy() != nil { 3225 policy = *request.RetryPolicy() 3226 } 3227 ociResponse, err = common.Retry(ctx, request, client.listMfaTotpDevices, policy) 3228 if err != nil { 3229 if ociResponse != nil { 3230 response = ListMfaTotpDevicesResponse{RawResponse: ociResponse.HTTPResponse()} 3231 } 3232 return 3233 } 3234 if convertedResponse, ok := ociResponse.(ListMfaTotpDevicesResponse); ok { 3235 response = convertedResponse 3236 } else { 3237 err = fmt.Errorf("failed to convert OCIResponse into ListMfaTotpDevicesResponse") 3238 } 3239 return 3240} 3241 3242// listMfaTotpDevices implements the OCIOperation interface (enables retrying operations) 3243func (client IdentityClient) listMfaTotpDevices(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3244 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/mfaTotpDevices") 3245 if err != nil { 3246 return nil, err 3247 } 3248 3249 var response ListMfaTotpDevicesResponse 3250 var httpResponse *http.Response 3251 httpResponse, err = client.Call(ctx, &httpRequest) 3252 defer common.CloseBodyIfValid(httpResponse) 3253 response.RawResponse = httpResponse 3254 if err != nil { 3255 return response, err 3256 } 3257 3258 err = common.UnmarshalResponse(httpResponse, &response) 3259 return response, err 3260} 3261 3262// ListPolicies Lists the policies in the specified compartment (either the tenancy or another of your compartments). 3263// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 3264// To determine which policies apply to a particular group or compartment, you must view the individual 3265// statements inside all your policies. There isn't a way to automatically obtain that information via the API. 3266func (client IdentityClient) ListPolicies(ctx context.Context, request ListPoliciesRequest) (response ListPoliciesResponse, err error) { 3267 var ociResponse common.OCIResponse 3268 policy := common.NoRetryPolicy() 3269 if request.RetryPolicy() != nil { 3270 policy = *request.RetryPolicy() 3271 } 3272 ociResponse, err = common.Retry(ctx, request, client.listPolicies, policy) 3273 if err != nil { 3274 if ociResponse != nil { 3275 response = ListPoliciesResponse{RawResponse: ociResponse.HTTPResponse()} 3276 } 3277 return 3278 } 3279 if convertedResponse, ok := ociResponse.(ListPoliciesResponse); ok { 3280 response = convertedResponse 3281 } else { 3282 err = fmt.Errorf("failed to convert OCIResponse into ListPoliciesResponse") 3283 } 3284 return 3285} 3286 3287// listPolicies implements the OCIOperation interface (enables retrying operations) 3288func (client IdentityClient) listPolicies(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3289 httpRequest, err := request.HTTPRequest(http.MethodGet, "/policies") 3290 if err != nil { 3291 return nil, err 3292 } 3293 3294 var response ListPoliciesResponse 3295 var httpResponse *http.Response 3296 httpResponse, err = client.Call(ctx, &httpRequest) 3297 defer common.CloseBodyIfValid(httpResponse) 3298 response.RawResponse = httpResponse 3299 if err != nil { 3300 return response, err 3301 } 3302 3303 err = common.UnmarshalResponse(httpResponse, &response) 3304 return response, err 3305} 3306 3307// ListRegionSubscriptions Lists the region subscriptions for the specified tenancy. 3308func (client IdentityClient) ListRegionSubscriptions(ctx context.Context, request ListRegionSubscriptionsRequest) (response ListRegionSubscriptionsResponse, err error) { 3309 var ociResponse common.OCIResponse 3310 policy := common.NoRetryPolicy() 3311 if request.RetryPolicy() != nil { 3312 policy = *request.RetryPolicy() 3313 } 3314 ociResponse, err = common.Retry(ctx, request, client.listRegionSubscriptions, policy) 3315 if err != nil { 3316 if ociResponse != nil { 3317 response = ListRegionSubscriptionsResponse{RawResponse: ociResponse.HTTPResponse()} 3318 } 3319 return 3320 } 3321 if convertedResponse, ok := ociResponse.(ListRegionSubscriptionsResponse); ok { 3322 response = convertedResponse 3323 } else { 3324 err = fmt.Errorf("failed to convert OCIResponse into ListRegionSubscriptionsResponse") 3325 } 3326 return 3327} 3328 3329// listRegionSubscriptions implements the OCIOperation interface (enables retrying operations) 3330func (client IdentityClient) listRegionSubscriptions(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3331 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tenancies/{tenancyId}/regionSubscriptions") 3332 if err != nil { 3333 return nil, err 3334 } 3335 3336 var response ListRegionSubscriptionsResponse 3337 var httpResponse *http.Response 3338 httpResponse, err = client.Call(ctx, &httpRequest) 3339 defer common.CloseBodyIfValid(httpResponse) 3340 response.RawResponse = httpResponse 3341 if err != nil { 3342 return response, err 3343 } 3344 3345 err = common.UnmarshalResponse(httpResponse, &response) 3346 return response, err 3347} 3348 3349// ListRegions Lists all the regions offered by Oracle Cloud Infrastructure. 3350func (client IdentityClient) ListRegions(ctx context.Context) (response ListRegionsResponse, err error) { 3351 var ociResponse common.OCIResponse 3352 ociResponse, err = client.listRegions(ctx) 3353 if err != nil { 3354 if ociResponse != nil { 3355 response = ListRegionsResponse{RawResponse: ociResponse.HTTPResponse()} 3356 } 3357 return 3358 } 3359 if convertedResponse, ok := ociResponse.(ListRegionsResponse); ok { 3360 response = convertedResponse 3361 } else { 3362 err = fmt.Errorf("failed to convert OCIResponse into ListRegionsResponse") 3363 } 3364 return 3365} 3366 3367// listRegions performs the request (retry policy is not enabled without a request object) 3368func (client IdentityClient) listRegions(ctx context.Context) (common.OCIResponse, error) { 3369 httpRequest := common.MakeDefaultHTTPRequest(http.MethodGet, "/regions") 3370 var err error 3371 3372 var response ListRegionsResponse 3373 var httpResponse *http.Response 3374 httpResponse, err = client.Call(ctx, &httpRequest) 3375 defer common.CloseBodyIfValid(httpResponse) 3376 response.RawResponse = httpResponse 3377 if err != nil { 3378 return response, err 3379 } 3380 3381 err = common.UnmarshalResponse(httpResponse, &response) 3382 return response, err 3383} 3384 3385// ListSmtpCredentials Lists the SMTP credentials for the specified user. The returned object contains the credential's OCID, 3386// the SMTP user name but not the SMTP password. The SMTP password is returned only upon creation. 3387func (client IdentityClient) ListSmtpCredentials(ctx context.Context, request ListSmtpCredentialsRequest) (response ListSmtpCredentialsResponse, err error) { 3388 var ociResponse common.OCIResponse 3389 policy := common.NoRetryPolicy() 3390 if request.RetryPolicy() != nil { 3391 policy = *request.RetryPolicy() 3392 } 3393 ociResponse, err = common.Retry(ctx, request, client.listSmtpCredentials, policy) 3394 if err != nil { 3395 if ociResponse != nil { 3396 response = ListSmtpCredentialsResponse{RawResponse: ociResponse.HTTPResponse()} 3397 } 3398 return 3399 } 3400 if convertedResponse, ok := ociResponse.(ListSmtpCredentialsResponse); ok { 3401 response = convertedResponse 3402 } else { 3403 err = fmt.Errorf("failed to convert OCIResponse into ListSmtpCredentialsResponse") 3404 } 3405 return 3406} 3407 3408// listSmtpCredentials implements the OCIOperation interface (enables retrying operations) 3409func (client IdentityClient) listSmtpCredentials(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3410 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/smtpCredentials") 3411 if err != nil { 3412 return nil, err 3413 } 3414 3415 var response ListSmtpCredentialsResponse 3416 var httpResponse *http.Response 3417 httpResponse, err = client.Call(ctx, &httpRequest) 3418 defer common.CloseBodyIfValid(httpResponse) 3419 response.RawResponse = httpResponse 3420 if err != nil { 3421 return response, err 3422 } 3423 3424 err = common.UnmarshalResponse(httpResponse, &response) 3425 return response, err 3426} 3427 3428// ListSwiftPasswords **Deprecated. Use ListAuthTokens instead.** 3429// Lists the Swift passwords for the specified user. The returned object contains the password's OCID, but not 3430// the password itself. The actual password is returned only upon creation. 3431func (client IdentityClient) ListSwiftPasswords(ctx context.Context, request ListSwiftPasswordsRequest) (response ListSwiftPasswordsResponse, err error) { 3432 var ociResponse common.OCIResponse 3433 policy := common.NoRetryPolicy() 3434 if request.RetryPolicy() != nil { 3435 policy = *request.RetryPolicy() 3436 } 3437 ociResponse, err = common.Retry(ctx, request, client.listSwiftPasswords, policy) 3438 if err != nil { 3439 if ociResponse != nil { 3440 response = ListSwiftPasswordsResponse{RawResponse: ociResponse.HTTPResponse()} 3441 } 3442 return 3443 } 3444 if convertedResponse, ok := ociResponse.(ListSwiftPasswordsResponse); ok { 3445 response = convertedResponse 3446 } else { 3447 err = fmt.Errorf("failed to convert OCIResponse into ListSwiftPasswordsResponse") 3448 } 3449 return 3450} 3451 3452// listSwiftPasswords implements the OCIOperation interface (enables retrying operations) 3453func (client IdentityClient) listSwiftPasswords(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3454 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users/{userId}/swiftPasswords") 3455 if err != nil { 3456 return nil, err 3457 } 3458 3459 var response ListSwiftPasswordsResponse 3460 var httpResponse *http.Response 3461 httpResponse, err = client.Call(ctx, &httpRequest) 3462 defer common.CloseBodyIfValid(httpResponse) 3463 response.RawResponse = httpResponse 3464 if err != nil { 3465 return response, err 3466 } 3467 3468 err = common.UnmarshalResponse(httpResponse, &response) 3469 return response, err 3470} 3471 3472// ListTagDefaults Lists the tag defaults for tag definitions in the specified compartment. 3473func (client IdentityClient) ListTagDefaults(ctx context.Context, request ListTagDefaultsRequest) (response ListTagDefaultsResponse, err error) { 3474 var ociResponse common.OCIResponse 3475 policy := common.NoRetryPolicy() 3476 if request.RetryPolicy() != nil { 3477 policy = *request.RetryPolicy() 3478 } 3479 ociResponse, err = common.Retry(ctx, request, client.listTagDefaults, policy) 3480 if err != nil { 3481 if ociResponse != nil { 3482 response = ListTagDefaultsResponse{RawResponse: ociResponse.HTTPResponse()} 3483 } 3484 return 3485 } 3486 if convertedResponse, ok := ociResponse.(ListTagDefaultsResponse); ok { 3487 response = convertedResponse 3488 } else { 3489 err = fmt.Errorf("failed to convert OCIResponse into ListTagDefaultsResponse") 3490 } 3491 return 3492} 3493 3494// listTagDefaults implements the OCIOperation interface (enables retrying operations) 3495func (client IdentityClient) listTagDefaults(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3496 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagDefaults") 3497 if err != nil { 3498 return nil, err 3499 } 3500 3501 var response ListTagDefaultsResponse 3502 var httpResponse *http.Response 3503 httpResponse, err = client.Call(ctx, &httpRequest) 3504 defer common.CloseBodyIfValid(httpResponse) 3505 response.RawResponse = httpResponse 3506 if err != nil { 3507 return response, err 3508 } 3509 3510 err = common.UnmarshalResponse(httpResponse, &response) 3511 return response, err 3512} 3513 3514// ListTagNamespaces Lists the tag namespaces in the specified compartment. 3515func (client IdentityClient) ListTagNamespaces(ctx context.Context, request ListTagNamespacesRequest) (response ListTagNamespacesResponse, err error) { 3516 var ociResponse common.OCIResponse 3517 policy := common.NoRetryPolicy() 3518 if request.RetryPolicy() != nil { 3519 policy = *request.RetryPolicy() 3520 } 3521 ociResponse, err = common.Retry(ctx, request, client.listTagNamespaces, policy) 3522 if err != nil { 3523 if ociResponse != nil { 3524 response = ListTagNamespacesResponse{RawResponse: ociResponse.HTTPResponse()} 3525 } 3526 return 3527 } 3528 if convertedResponse, ok := ociResponse.(ListTagNamespacesResponse); ok { 3529 response = convertedResponse 3530 } else { 3531 err = fmt.Errorf("failed to convert OCIResponse into ListTagNamespacesResponse") 3532 } 3533 return 3534} 3535 3536// listTagNamespaces implements the OCIOperation interface (enables retrying operations) 3537func (client IdentityClient) listTagNamespaces(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3538 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagNamespaces") 3539 if err != nil { 3540 return nil, err 3541 } 3542 3543 var response ListTagNamespacesResponse 3544 var httpResponse *http.Response 3545 httpResponse, err = client.Call(ctx, &httpRequest) 3546 defer common.CloseBodyIfValid(httpResponse) 3547 response.RawResponse = httpResponse 3548 if err != nil { 3549 return response, err 3550 } 3551 3552 err = common.UnmarshalResponse(httpResponse, &response) 3553 return response, err 3554} 3555 3556// ListTaggingWorkRequestErrors Gets the errors for a work request. 3557func (client IdentityClient) ListTaggingWorkRequestErrors(ctx context.Context, request ListTaggingWorkRequestErrorsRequest) (response ListTaggingWorkRequestErrorsResponse, err error) { 3558 var ociResponse common.OCIResponse 3559 policy := common.NoRetryPolicy() 3560 if request.RetryPolicy() != nil { 3561 policy = *request.RetryPolicy() 3562 } 3563 ociResponse, err = common.Retry(ctx, request, client.listTaggingWorkRequestErrors, policy) 3564 if err != nil { 3565 if ociResponse != nil { 3566 response = ListTaggingWorkRequestErrorsResponse{RawResponse: ociResponse.HTTPResponse()} 3567 } 3568 return 3569 } 3570 if convertedResponse, ok := ociResponse.(ListTaggingWorkRequestErrorsResponse); ok { 3571 response = convertedResponse 3572 } else { 3573 err = fmt.Errorf("failed to convert OCIResponse into ListTaggingWorkRequestErrorsResponse") 3574 } 3575 return 3576} 3577 3578// listTaggingWorkRequestErrors implements the OCIOperation interface (enables retrying operations) 3579func (client IdentityClient) listTaggingWorkRequestErrors(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3580 httpRequest, err := request.HTTPRequest(http.MethodGet, "/taggingWorkRequests/{workRequestId}/errors") 3581 if err != nil { 3582 return nil, err 3583 } 3584 3585 var response ListTaggingWorkRequestErrorsResponse 3586 var httpResponse *http.Response 3587 httpResponse, err = client.Call(ctx, &httpRequest) 3588 defer common.CloseBodyIfValid(httpResponse) 3589 response.RawResponse = httpResponse 3590 if err != nil { 3591 return response, err 3592 } 3593 3594 err = common.UnmarshalResponse(httpResponse, &response) 3595 return response, err 3596} 3597 3598// ListTaggingWorkRequestLogs Gets the logs for a work request. 3599func (client IdentityClient) ListTaggingWorkRequestLogs(ctx context.Context, request ListTaggingWorkRequestLogsRequest) (response ListTaggingWorkRequestLogsResponse, err error) { 3600 var ociResponse common.OCIResponse 3601 policy := common.NoRetryPolicy() 3602 if request.RetryPolicy() != nil { 3603 policy = *request.RetryPolicy() 3604 } 3605 ociResponse, err = common.Retry(ctx, request, client.listTaggingWorkRequestLogs, policy) 3606 if err != nil { 3607 if ociResponse != nil { 3608 response = ListTaggingWorkRequestLogsResponse{RawResponse: ociResponse.HTTPResponse()} 3609 } 3610 return 3611 } 3612 if convertedResponse, ok := ociResponse.(ListTaggingWorkRequestLogsResponse); ok { 3613 response = convertedResponse 3614 } else { 3615 err = fmt.Errorf("failed to convert OCIResponse into ListTaggingWorkRequestLogsResponse") 3616 } 3617 return 3618} 3619 3620// listTaggingWorkRequestLogs implements the OCIOperation interface (enables retrying operations) 3621func (client IdentityClient) listTaggingWorkRequestLogs(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3622 httpRequest, err := request.HTTPRequest(http.MethodGet, "/taggingWorkRequests/{workRequestId}/logs") 3623 if err != nil { 3624 return nil, err 3625 } 3626 3627 var response ListTaggingWorkRequestLogsResponse 3628 var httpResponse *http.Response 3629 httpResponse, err = client.Call(ctx, &httpRequest) 3630 defer common.CloseBodyIfValid(httpResponse) 3631 response.RawResponse = httpResponse 3632 if err != nil { 3633 return response, err 3634 } 3635 3636 err = common.UnmarshalResponse(httpResponse, &response) 3637 return response, err 3638} 3639 3640// ListTaggingWorkRequests Lists the tagging work requests in compartment. 3641func (client IdentityClient) ListTaggingWorkRequests(ctx context.Context, request ListTaggingWorkRequestsRequest) (response ListTaggingWorkRequestsResponse, err error) { 3642 var ociResponse common.OCIResponse 3643 policy := common.NoRetryPolicy() 3644 if request.RetryPolicy() != nil { 3645 policy = *request.RetryPolicy() 3646 } 3647 ociResponse, err = common.Retry(ctx, request, client.listTaggingWorkRequests, policy) 3648 if err != nil { 3649 if ociResponse != nil { 3650 response = ListTaggingWorkRequestsResponse{RawResponse: ociResponse.HTTPResponse()} 3651 } 3652 return 3653 } 3654 if convertedResponse, ok := ociResponse.(ListTaggingWorkRequestsResponse); ok { 3655 response = convertedResponse 3656 } else { 3657 err = fmt.Errorf("failed to convert OCIResponse into ListTaggingWorkRequestsResponse") 3658 } 3659 return 3660} 3661 3662// listTaggingWorkRequests implements the OCIOperation interface (enables retrying operations) 3663func (client IdentityClient) listTaggingWorkRequests(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3664 httpRequest, err := request.HTTPRequest(http.MethodGet, "/taggingWorkRequests") 3665 if err != nil { 3666 return nil, err 3667 } 3668 3669 var response ListTaggingWorkRequestsResponse 3670 var httpResponse *http.Response 3671 httpResponse, err = client.Call(ctx, &httpRequest) 3672 defer common.CloseBodyIfValid(httpResponse) 3673 response.RawResponse = httpResponse 3674 if err != nil { 3675 return response, err 3676 } 3677 3678 err = common.UnmarshalResponse(httpResponse, &response) 3679 return response, err 3680} 3681 3682// ListTags Lists the tag definitions in the specified tag namespace. 3683func (client IdentityClient) ListTags(ctx context.Context, request ListTagsRequest) (response ListTagsResponse, err error) { 3684 var ociResponse common.OCIResponse 3685 policy := common.NoRetryPolicy() 3686 if request.RetryPolicy() != nil { 3687 policy = *request.RetryPolicy() 3688 } 3689 ociResponse, err = common.Retry(ctx, request, client.listTags, policy) 3690 if err != nil { 3691 if ociResponse != nil { 3692 response = ListTagsResponse{RawResponse: ociResponse.HTTPResponse()} 3693 } 3694 return 3695 } 3696 if convertedResponse, ok := ociResponse.(ListTagsResponse); ok { 3697 response = convertedResponse 3698 } else { 3699 err = fmt.Errorf("failed to convert OCIResponse into ListTagsResponse") 3700 } 3701 return 3702} 3703 3704// listTags implements the OCIOperation interface (enables retrying operations) 3705func (client IdentityClient) listTags(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3706 httpRequest, err := request.HTTPRequest(http.MethodGet, "/tagNamespaces/{tagNamespaceId}/tags") 3707 if err != nil { 3708 return nil, err 3709 } 3710 3711 var response ListTagsResponse 3712 var httpResponse *http.Response 3713 httpResponse, err = client.Call(ctx, &httpRequest) 3714 defer common.CloseBodyIfValid(httpResponse) 3715 response.RawResponse = httpResponse 3716 if err != nil { 3717 return response, err 3718 } 3719 3720 err = common.UnmarshalResponse(httpResponse, &response) 3721 return response, err 3722} 3723 3724// ListUserGroupMemberships Lists the `UserGroupMembership` objects in your tenancy. You must specify your tenancy's OCID 3725// as the value for the compartment ID 3726// (see Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five)). 3727// You must also then filter the list in one of these ways: 3728// - You can limit the results to just the memberships for a given user by specifying a `userId`. 3729// - Similarly, you can limit the results to just the memberships for a given group by specifying a `groupId`. 3730// - You can set both the `userId` and `groupId` to determine if the specified user is in the specified group. 3731// If the answer is no, the response is an empty list. 3732// - Although`userId` and `groupId` are not indvidually required, you must set one of them. 3733func (client IdentityClient) ListUserGroupMemberships(ctx context.Context, request ListUserGroupMembershipsRequest) (response ListUserGroupMembershipsResponse, err error) { 3734 var ociResponse common.OCIResponse 3735 policy := common.NoRetryPolicy() 3736 if request.RetryPolicy() != nil { 3737 policy = *request.RetryPolicy() 3738 } 3739 ociResponse, err = common.Retry(ctx, request, client.listUserGroupMemberships, policy) 3740 if err != nil { 3741 if ociResponse != nil { 3742 response = ListUserGroupMembershipsResponse{RawResponse: ociResponse.HTTPResponse()} 3743 } 3744 return 3745 } 3746 if convertedResponse, ok := ociResponse.(ListUserGroupMembershipsResponse); ok { 3747 response = convertedResponse 3748 } else { 3749 err = fmt.Errorf("failed to convert OCIResponse into ListUserGroupMembershipsResponse") 3750 } 3751 return 3752} 3753 3754// listUserGroupMemberships implements the OCIOperation interface (enables retrying operations) 3755func (client IdentityClient) listUserGroupMemberships(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3756 httpRequest, err := request.HTTPRequest(http.MethodGet, "/userGroupMemberships") 3757 if err != nil { 3758 return nil, err 3759 } 3760 3761 var response ListUserGroupMembershipsResponse 3762 var httpResponse *http.Response 3763 httpResponse, err = client.Call(ctx, &httpRequest) 3764 defer common.CloseBodyIfValid(httpResponse) 3765 response.RawResponse = httpResponse 3766 if err != nil { 3767 return response, err 3768 } 3769 3770 err = common.UnmarshalResponse(httpResponse, &response) 3771 return response, err 3772} 3773 3774// ListUsers Lists the users in your tenancy. You must specify your tenancy's OCID as the value for the 3775// compartment ID (remember that the tenancy is simply the root compartment). 3776// See Where to Get the Tenancy's OCID and User's OCID (https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#five). 3777func (client IdentityClient) ListUsers(ctx context.Context, request ListUsersRequest) (response ListUsersResponse, err error) { 3778 var ociResponse common.OCIResponse 3779 policy := common.NoRetryPolicy() 3780 if request.RetryPolicy() != nil { 3781 policy = *request.RetryPolicy() 3782 } 3783 ociResponse, err = common.Retry(ctx, request, client.listUsers, policy) 3784 if err != nil { 3785 if ociResponse != nil { 3786 response = ListUsersResponse{RawResponse: ociResponse.HTTPResponse()} 3787 } 3788 return 3789 } 3790 if convertedResponse, ok := ociResponse.(ListUsersResponse); ok { 3791 response = convertedResponse 3792 } else { 3793 err = fmt.Errorf("failed to convert OCIResponse into ListUsersResponse") 3794 } 3795 return 3796} 3797 3798// listUsers implements the OCIOperation interface (enables retrying operations) 3799func (client IdentityClient) listUsers(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3800 httpRequest, err := request.HTTPRequest(http.MethodGet, "/users") 3801 if err != nil { 3802 return nil, err 3803 } 3804 3805 var response ListUsersResponse 3806 var httpResponse *http.Response 3807 httpResponse, err = client.Call(ctx, &httpRequest) 3808 defer common.CloseBodyIfValid(httpResponse) 3809 response.RawResponse = httpResponse 3810 if err != nil { 3811 return response, err 3812 } 3813 3814 err = common.UnmarshalResponse(httpResponse, &response) 3815 return response, err 3816} 3817 3818// ListWorkRequests Lists the work requests in compartment. 3819func (client IdentityClient) ListWorkRequests(ctx context.Context, request ListWorkRequestsRequest) (response ListWorkRequestsResponse, err error) { 3820 var ociResponse common.OCIResponse 3821 policy := common.NoRetryPolicy() 3822 if request.RetryPolicy() != nil { 3823 policy = *request.RetryPolicy() 3824 } 3825 ociResponse, err = common.Retry(ctx, request, client.listWorkRequests, policy) 3826 if err != nil { 3827 if ociResponse != nil { 3828 response = ListWorkRequestsResponse{RawResponse: ociResponse.HTTPResponse()} 3829 } 3830 return 3831 } 3832 if convertedResponse, ok := ociResponse.(ListWorkRequestsResponse); ok { 3833 response = convertedResponse 3834 } else { 3835 err = fmt.Errorf("failed to convert OCIResponse into ListWorkRequestsResponse") 3836 } 3837 return 3838} 3839 3840// listWorkRequests implements the OCIOperation interface (enables retrying operations) 3841func (client IdentityClient) listWorkRequests(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3842 httpRequest, err := request.HTTPRequest(http.MethodGet, "/workRequests") 3843 if err != nil { 3844 return nil, err 3845 } 3846 3847 var response ListWorkRequestsResponse 3848 var httpResponse *http.Response 3849 httpResponse, err = client.Call(ctx, &httpRequest) 3850 defer common.CloseBodyIfValid(httpResponse) 3851 response.RawResponse = httpResponse 3852 if err != nil { 3853 return response, err 3854 } 3855 3856 err = common.UnmarshalResponse(httpResponse, &response) 3857 return response, err 3858} 3859 3860// MoveCompartment Move the compartment to a different parent compartment in the same tenancy. When you move a 3861// compartment, all its contents (subcompartments and resources) are moved with it. Note that 3862// the `CompartmentId` that you specify in the path is the compartment that you want to move. 3863// **IMPORTANT**: After you move a compartment to a new parent compartment, the access policies of 3864// the new parent take effect and the policies of the previous parent no longer apply. Ensure that you 3865// are aware of the implications for the compartment contents before you move it. For more 3866// information, see Moving a Compartment (https://docs.cloud.oracle.com/Content/Identity/Tasks/managingcompartments.htm#MoveCompartment). 3867func (client IdentityClient) MoveCompartment(ctx context.Context, request MoveCompartmentRequest) (response MoveCompartmentResponse, err error) { 3868 var ociResponse common.OCIResponse 3869 policy := common.NoRetryPolicy() 3870 if request.RetryPolicy() != nil { 3871 policy = *request.RetryPolicy() 3872 } 3873 3874 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 3875 request.OpcRetryToken = common.String(common.RetryToken()) 3876 } 3877 3878 ociResponse, err = common.Retry(ctx, request, client.moveCompartment, policy) 3879 if err != nil { 3880 if ociResponse != nil { 3881 response = MoveCompartmentResponse{RawResponse: ociResponse.HTTPResponse()} 3882 } 3883 return 3884 } 3885 if convertedResponse, ok := ociResponse.(MoveCompartmentResponse); ok { 3886 response = convertedResponse 3887 } else { 3888 err = fmt.Errorf("failed to convert OCIResponse into MoveCompartmentResponse") 3889 } 3890 return 3891} 3892 3893// moveCompartment implements the OCIOperation interface (enables retrying operations) 3894func (client IdentityClient) moveCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3895 httpRequest, err := request.HTTPRequest(http.MethodPost, "/compartments/{compartmentId}/actions/moveCompartment") 3896 if err != nil { 3897 return nil, err 3898 } 3899 3900 var response MoveCompartmentResponse 3901 var httpResponse *http.Response 3902 httpResponse, err = client.Call(ctx, &httpRequest) 3903 defer common.CloseBodyIfValid(httpResponse) 3904 response.RawResponse = httpResponse 3905 if err != nil { 3906 return response, err 3907 } 3908 3909 err = common.UnmarshalResponse(httpResponse, &response) 3910 return response, err 3911} 3912 3913// RemoveUserFromGroup Removes a user from a group by deleting the corresponding `UserGroupMembership`. 3914func (client IdentityClient) RemoveUserFromGroup(ctx context.Context, request RemoveUserFromGroupRequest) (response RemoveUserFromGroupResponse, err error) { 3915 var ociResponse common.OCIResponse 3916 policy := common.NoRetryPolicy() 3917 if request.RetryPolicy() != nil { 3918 policy = *request.RetryPolicy() 3919 } 3920 ociResponse, err = common.Retry(ctx, request, client.removeUserFromGroup, policy) 3921 if err != nil { 3922 if ociResponse != nil { 3923 response = RemoveUserFromGroupResponse{RawResponse: ociResponse.HTTPResponse()} 3924 } 3925 return 3926 } 3927 if convertedResponse, ok := ociResponse.(RemoveUserFromGroupResponse); ok { 3928 response = convertedResponse 3929 } else { 3930 err = fmt.Errorf("failed to convert OCIResponse into RemoveUserFromGroupResponse") 3931 } 3932 return 3933} 3934 3935// removeUserFromGroup implements the OCIOperation interface (enables retrying operations) 3936func (client IdentityClient) removeUserFromGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3937 httpRequest, err := request.HTTPRequest(http.MethodDelete, "/userGroupMemberships/{userGroupMembershipId}") 3938 if err != nil { 3939 return nil, err 3940 } 3941 3942 var response RemoveUserFromGroupResponse 3943 var httpResponse *http.Response 3944 httpResponse, err = client.Call(ctx, &httpRequest) 3945 defer common.CloseBodyIfValid(httpResponse) 3946 response.RawResponse = httpResponse 3947 if err != nil { 3948 return response, err 3949 } 3950 3951 err = common.UnmarshalResponse(httpResponse, &response) 3952 return response, err 3953} 3954 3955// ResetIdpScimClient Resets the OAuth2 client credentials for the SCIM client associated with this identity provider. 3956func (client IdentityClient) ResetIdpScimClient(ctx context.Context, request ResetIdpScimClientRequest) (response ResetIdpScimClientResponse, err error) { 3957 var ociResponse common.OCIResponse 3958 policy := common.NoRetryPolicy() 3959 if request.RetryPolicy() != nil { 3960 policy = *request.RetryPolicy() 3961 } 3962 ociResponse, err = common.Retry(ctx, request, client.resetIdpScimClient, policy) 3963 if err != nil { 3964 if ociResponse != nil { 3965 response = ResetIdpScimClientResponse{RawResponse: ociResponse.HTTPResponse()} 3966 } 3967 return 3968 } 3969 if convertedResponse, ok := ociResponse.(ResetIdpScimClientResponse); ok { 3970 response = convertedResponse 3971 } else { 3972 err = fmt.Errorf("failed to convert OCIResponse into ResetIdpScimClientResponse") 3973 } 3974 return 3975} 3976 3977// resetIdpScimClient implements the OCIOperation interface (enables retrying operations) 3978func (client IdentityClient) resetIdpScimClient(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 3979 httpRequest, err := request.HTTPRequest(http.MethodPost, "/identityProviders/{identityProviderId}/actions/resetScimClient") 3980 if err != nil { 3981 return nil, err 3982 } 3983 3984 var response ResetIdpScimClientResponse 3985 var httpResponse *http.Response 3986 httpResponse, err = client.Call(ctx, &httpRequest) 3987 defer common.CloseBodyIfValid(httpResponse) 3988 response.RawResponse = httpResponse 3989 if err != nil { 3990 return response, err 3991 } 3992 3993 err = common.UnmarshalResponse(httpResponse, &response) 3994 return response, err 3995} 3996 3997// UpdateAuthToken Updates the specified auth token's description. 3998func (client IdentityClient) UpdateAuthToken(ctx context.Context, request UpdateAuthTokenRequest) (response UpdateAuthTokenResponse, err error) { 3999 var ociResponse common.OCIResponse 4000 policy := common.NoRetryPolicy() 4001 if request.RetryPolicy() != nil { 4002 policy = *request.RetryPolicy() 4003 } 4004 ociResponse, err = common.Retry(ctx, request, client.updateAuthToken, policy) 4005 if err != nil { 4006 if ociResponse != nil { 4007 response = UpdateAuthTokenResponse{RawResponse: ociResponse.HTTPResponse()} 4008 } 4009 return 4010 } 4011 if convertedResponse, ok := ociResponse.(UpdateAuthTokenResponse); ok { 4012 response = convertedResponse 4013 } else { 4014 err = fmt.Errorf("failed to convert OCIResponse into UpdateAuthTokenResponse") 4015 } 4016 return 4017} 4018 4019// updateAuthToken implements the OCIOperation interface (enables retrying operations) 4020func (client IdentityClient) updateAuthToken(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4021 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}/authTokens/{authTokenId}") 4022 if err != nil { 4023 return nil, err 4024 } 4025 4026 var response UpdateAuthTokenResponse 4027 var httpResponse *http.Response 4028 httpResponse, err = client.Call(ctx, &httpRequest) 4029 defer common.CloseBodyIfValid(httpResponse) 4030 response.RawResponse = httpResponse 4031 if err != nil { 4032 return response, err 4033 } 4034 4035 err = common.UnmarshalResponse(httpResponse, &response) 4036 return response, err 4037} 4038 4039// UpdateAuthenticationPolicy Updates authentication policy for the specified tenancy 4040func (client IdentityClient) UpdateAuthenticationPolicy(ctx context.Context, request UpdateAuthenticationPolicyRequest) (response UpdateAuthenticationPolicyResponse, err error) { 4041 var ociResponse common.OCIResponse 4042 policy := common.NoRetryPolicy() 4043 if request.RetryPolicy() != nil { 4044 policy = *request.RetryPolicy() 4045 } 4046 ociResponse, err = common.Retry(ctx, request, client.updateAuthenticationPolicy, policy) 4047 if err != nil { 4048 if ociResponse != nil { 4049 response = UpdateAuthenticationPolicyResponse{RawResponse: ociResponse.HTTPResponse()} 4050 } 4051 return 4052 } 4053 if convertedResponse, ok := ociResponse.(UpdateAuthenticationPolicyResponse); ok { 4054 response = convertedResponse 4055 } else { 4056 err = fmt.Errorf("failed to convert OCIResponse into UpdateAuthenticationPolicyResponse") 4057 } 4058 return 4059} 4060 4061// updateAuthenticationPolicy implements the OCIOperation interface (enables retrying operations) 4062func (client IdentityClient) updateAuthenticationPolicy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4063 httpRequest, err := request.HTTPRequest(http.MethodPut, "/authenticationPolicies/{compartmentId}") 4064 if err != nil { 4065 return nil, err 4066 } 4067 4068 var response UpdateAuthenticationPolicyResponse 4069 var httpResponse *http.Response 4070 httpResponse, err = client.Call(ctx, &httpRequest) 4071 defer common.CloseBodyIfValid(httpResponse) 4072 response.RawResponse = httpResponse 4073 if err != nil { 4074 return response, err 4075 } 4076 4077 err = common.UnmarshalResponse(httpResponse, &response) 4078 return response, err 4079} 4080 4081// UpdateCompartment Updates the specified compartment's description or name. You can't update the root compartment. 4082func (client IdentityClient) UpdateCompartment(ctx context.Context, request UpdateCompartmentRequest) (response UpdateCompartmentResponse, err error) { 4083 var ociResponse common.OCIResponse 4084 policy := common.NoRetryPolicy() 4085 if request.RetryPolicy() != nil { 4086 policy = *request.RetryPolicy() 4087 } 4088 ociResponse, err = common.Retry(ctx, request, client.updateCompartment, policy) 4089 if err != nil { 4090 if ociResponse != nil { 4091 response = UpdateCompartmentResponse{RawResponse: ociResponse.HTTPResponse()} 4092 } 4093 return 4094 } 4095 if convertedResponse, ok := ociResponse.(UpdateCompartmentResponse); ok { 4096 response = convertedResponse 4097 } else { 4098 err = fmt.Errorf("failed to convert OCIResponse into UpdateCompartmentResponse") 4099 } 4100 return 4101} 4102 4103// updateCompartment implements the OCIOperation interface (enables retrying operations) 4104func (client IdentityClient) updateCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4105 httpRequest, err := request.HTTPRequest(http.MethodPut, "/compartments/{compartmentId}") 4106 if err != nil { 4107 return nil, err 4108 } 4109 4110 var response UpdateCompartmentResponse 4111 var httpResponse *http.Response 4112 httpResponse, err = client.Call(ctx, &httpRequest) 4113 defer common.CloseBodyIfValid(httpResponse) 4114 response.RawResponse = httpResponse 4115 if err != nil { 4116 return response, err 4117 } 4118 4119 err = common.UnmarshalResponse(httpResponse, &response) 4120 return response, err 4121} 4122 4123// UpdateCustomerSecretKey Updates the specified secret key's description. 4124func (client IdentityClient) UpdateCustomerSecretKey(ctx context.Context, request UpdateCustomerSecretKeyRequest) (response UpdateCustomerSecretKeyResponse, err error) { 4125 var ociResponse common.OCIResponse 4126 policy := common.NoRetryPolicy() 4127 if request.RetryPolicy() != nil { 4128 policy = *request.RetryPolicy() 4129 } 4130 ociResponse, err = common.Retry(ctx, request, client.updateCustomerSecretKey, policy) 4131 if err != nil { 4132 if ociResponse != nil { 4133 response = UpdateCustomerSecretKeyResponse{RawResponse: ociResponse.HTTPResponse()} 4134 } 4135 return 4136 } 4137 if convertedResponse, ok := ociResponse.(UpdateCustomerSecretKeyResponse); ok { 4138 response = convertedResponse 4139 } else { 4140 err = fmt.Errorf("failed to convert OCIResponse into UpdateCustomerSecretKeyResponse") 4141 } 4142 return 4143} 4144 4145// updateCustomerSecretKey implements the OCIOperation interface (enables retrying operations) 4146func (client IdentityClient) updateCustomerSecretKey(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4147 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}/customerSecretKeys/{customerSecretKeyId}") 4148 if err != nil { 4149 return nil, err 4150 } 4151 4152 var response UpdateCustomerSecretKeyResponse 4153 var httpResponse *http.Response 4154 httpResponse, err = client.Call(ctx, &httpRequest) 4155 defer common.CloseBodyIfValid(httpResponse) 4156 response.RawResponse = httpResponse 4157 if err != nil { 4158 return response, err 4159 } 4160 4161 err = common.UnmarshalResponse(httpResponse, &response) 4162 return response, err 4163} 4164 4165// UpdateDynamicGroup Updates the specified dynamic group. 4166func (client IdentityClient) UpdateDynamicGroup(ctx context.Context, request UpdateDynamicGroupRequest) (response UpdateDynamicGroupResponse, err error) { 4167 var ociResponse common.OCIResponse 4168 policy := common.NoRetryPolicy() 4169 if request.RetryPolicy() != nil { 4170 policy = *request.RetryPolicy() 4171 } 4172 ociResponse, err = common.Retry(ctx, request, client.updateDynamicGroup, policy) 4173 if err != nil { 4174 if ociResponse != nil { 4175 response = UpdateDynamicGroupResponse{RawResponse: ociResponse.HTTPResponse()} 4176 } 4177 return 4178 } 4179 if convertedResponse, ok := ociResponse.(UpdateDynamicGroupResponse); ok { 4180 response = convertedResponse 4181 } else { 4182 err = fmt.Errorf("failed to convert OCIResponse into UpdateDynamicGroupResponse") 4183 } 4184 return 4185} 4186 4187// updateDynamicGroup implements the OCIOperation interface (enables retrying operations) 4188func (client IdentityClient) updateDynamicGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4189 httpRequest, err := request.HTTPRequest(http.MethodPut, "/dynamicGroups/{dynamicGroupId}") 4190 if err != nil { 4191 return nil, err 4192 } 4193 4194 var response UpdateDynamicGroupResponse 4195 var httpResponse *http.Response 4196 httpResponse, err = client.Call(ctx, &httpRequest) 4197 defer common.CloseBodyIfValid(httpResponse) 4198 response.RawResponse = httpResponse 4199 if err != nil { 4200 return response, err 4201 } 4202 4203 err = common.UnmarshalResponse(httpResponse, &response) 4204 return response, err 4205} 4206 4207// UpdateGroup Updates the specified group. 4208func (client IdentityClient) UpdateGroup(ctx context.Context, request UpdateGroupRequest) (response UpdateGroupResponse, err error) { 4209 var ociResponse common.OCIResponse 4210 policy := common.NoRetryPolicy() 4211 if request.RetryPolicy() != nil { 4212 policy = *request.RetryPolicy() 4213 } 4214 ociResponse, err = common.Retry(ctx, request, client.updateGroup, policy) 4215 if err != nil { 4216 if ociResponse != nil { 4217 response = UpdateGroupResponse{RawResponse: ociResponse.HTTPResponse()} 4218 } 4219 return 4220 } 4221 if convertedResponse, ok := ociResponse.(UpdateGroupResponse); ok { 4222 response = convertedResponse 4223 } else { 4224 err = fmt.Errorf("failed to convert OCIResponse into UpdateGroupResponse") 4225 } 4226 return 4227} 4228 4229// updateGroup implements the OCIOperation interface (enables retrying operations) 4230func (client IdentityClient) updateGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4231 httpRequest, err := request.HTTPRequest(http.MethodPut, "/groups/{groupId}") 4232 if err != nil { 4233 return nil, err 4234 } 4235 4236 var response UpdateGroupResponse 4237 var httpResponse *http.Response 4238 httpResponse, err = client.Call(ctx, &httpRequest) 4239 defer common.CloseBodyIfValid(httpResponse) 4240 response.RawResponse = httpResponse 4241 if err != nil { 4242 return response, err 4243 } 4244 4245 err = common.UnmarshalResponse(httpResponse, &response) 4246 return response, err 4247} 4248 4249// UpdateIdentityProvider Updates the specified identity provider. 4250func (client IdentityClient) UpdateIdentityProvider(ctx context.Context, request UpdateIdentityProviderRequest) (response UpdateIdentityProviderResponse, err error) { 4251 var ociResponse common.OCIResponse 4252 policy := common.NoRetryPolicy() 4253 if request.RetryPolicy() != nil { 4254 policy = *request.RetryPolicy() 4255 } 4256 ociResponse, err = common.Retry(ctx, request, client.updateIdentityProvider, policy) 4257 if err != nil { 4258 if ociResponse != nil { 4259 response = UpdateIdentityProviderResponse{RawResponse: ociResponse.HTTPResponse()} 4260 } 4261 return 4262 } 4263 if convertedResponse, ok := ociResponse.(UpdateIdentityProviderResponse); ok { 4264 response = convertedResponse 4265 } else { 4266 err = fmt.Errorf("failed to convert OCIResponse into UpdateIdentityProviderResponse") 4267 } 4268 return 4269} 4270 4271// updateIdentityProvider implements the OCIOperation interface (enables retrying operations) 4272func (client IdentityClient) updateIdentityProvider(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4273 httpRequest, err := request.HTTPRequest(http.MethodPut, "/identityProviders/{identityProviderId}") 4274 if err != nil { 4275 return nil, err 4276 } 4277 4278 var response UpdateIdentityProviderResponse 4279 var httpResponse *http.Response 4280 httpResponse, err = client.Call(ctx, &httpRequest) 4281 defer common.CloseBodyIfValid(httpResponse) 4282 response.RawResponse = httpResponse 4283 if err != nil { 4284 return response, err 4285 } 4286 4287 err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &identityprovider{}) 4288 return response, err 4289} 4290 4291// UpdateIdpGroupMapping Updates the specified group mapping. 4292func (client IdentityClient) UpdateIdpGroupMapping(ctx context.Context, request UpdateIdpGroupMappingRequest) (response UpdateIdpGroupMappingResponse, err error) { 4293 var ociResponse common.OCIResponse 4294 policy := common.NoRetryPolicy() 4295 if request.RetryPolicy() != nil { 4296 policy = *request.RetryPolicy() 4297 } 4298 ociResponse, err = common.Retry(ctx, request, client.updateIdpGroupMapping, policy) 4299 if err != nil { 4300 if ociResponse != nil { 4301 response = UpdateIdpGroupMappingResponse{RawResponse: ociResponse.HTTPResponse()} 4302 } 4303 return 4304 } 4305 if convertedResponse, ok := ociResponse.(UpdateIdpGroupMappingResponse); ok { 4306 response = convertedResponse 4307 } else { 4308 err = fmt.Errorf("failed to convert OCIResponse into UpdateIdpGroupMappingResponse") 4309 } 4310 return 4311} 4312 4313// updateIdpGroupMapping implements the OCIOperation interface (enables retrying operations) 4314func (client IdentityClient) updateIdpGroupMapping(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4315 httpRequest, err := request.HTTPRequest(http.MethodPut, "/identityProviders/{identityProviderId}/groupMappings/{mappingId}") 4316 if err != nil { 4317 return nil, err 4318 } 4319 4320 var response UpdateIdpGroupMappingResponse 4321 var httpResponse *http.Response 4322 httpResponse, err = client.Call(ctx, &httpRequest) 4323 defer common.CloseBodyIfValid(httpResponse) 4324 response.RawResponse = httpResponse 4325 if err != nil { 4326 return response, err 4327 } 4328 4329 err = common.UnmarshalResponse(httpResponse, &response) 4330 return response, err 4331} 4332 4333// UpdatePolicy Updates the specified policy. You can update the description or the policy statements themselves. 4334// Policy changes take effect typically within 10 seconds. 4335func (client IdentityClient) UpdatePolicy(ctx context.Context, request UpdatePolicyRequest) (response UpdatePolicyResponse, err error) { 4336 var ociResponse common.OCIResponse 4337 policy := common.NoRetryPolicy() 4338 if request.RetryPolicy() != nil { 4339 policy = *request.RetryPolicy() 4340 } 4341 ociResponse, err = common.Retry(ctx, request, client.updatePolicy, policy) 4342 if err != nil { 4343 if ociResponse != nil { 4344 response = UpdatePolicyResponse{RawResponse: ociResponse.HTTPResponse()} 4345 } 4346 return 4347 } 4348 if convertedResponse, ok := ociResponse.(UpdatePolicyResponse); ok { 4349 response = convertedResponse 4350 } else { 4351 err = fmt.Errorf("failed to convert OCIResponse into UpdatePolicyResponse") 4352 } 4353 return 4354} 4355 4356// updatePolicy implements the OCIOperation interface (enables retrying operations) 4357func (client IdentityClient) updatePolicy(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4358 httpRequest, err := request.HTTPRequest(http.MethodPut, "/policies/{policyId}") 4359 if err != nil { 4360 return nil, err 4361 } 4362 4363 var response UpdatePolicyResponse 4364 var httpResponse *http.Response 4365 httpResponse, err = client.Call(ctx, &httpRequest) 4366 defer common.CloseBodyIfValid(httpResponse) 4367 response.RawResponse = httpResponse 4368 if err != nil { 4369 return response, err 4370 } 4371 4372 err = common.UnmarshalResponse(httpResponse, &response) 4373 return response, err 4374} 4375 4376// UpdateSmtpCredential Updates the specified SMTP credential's description. 4377func (client IdentityClient) UpdateSmtpCredential(ctx context.Context, request UpdateSmtpCredentialRequest) (response UpdateSmtpCredentialResponse, err error) { 4378 var ociResponse common.OCIResponse 4379 policy := common.NoRetryPolicy() 4380 if request.RetryPolicy() != nil { 4381 policy = *request.RetryPolicy() 4382 } 4383 ociResponse, err = common.Retry(ctx, request, client.updateSmtpCredential, policy) 4384 if err != nil { 4385 if ociResponse != nil { 4386 response = UpdateSmtpCredentialResponse{RawResponse: ociResponse.HTTPResponse()} 4387 } 4388 return 4389 } 4390 if convertedResponse, ok := ociResponse.(UpdateSmtpCredentialResponse); ok { 4391 response = convertedResponse 4392 } else { 4393 err = fmt.Errorf("failed to convert OCIResponse into UpdateSmtpCredentialResponse") 4394 } 4395 return 4396} 4397 4398// updateSmtpCredential implements the OCIOperation interface (enables retrying operations) 4399func (client IdentityClient) updateSmtpCredential(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4400 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}/smtpCredentials/{smtpCredentialId}") 4401 if err != nil { 4402 return nil, err 4403 } 4404 4405 var response UpdateSmtpCredentialResponse 4406 var httpResponse *http.Response 4407 httpResponse, err = client.Call(ctx, &httpRequest) 4408 defer common.CloseBodyIfValid(httpResponse) 4409 response.RawResponse = httpResponse 4410 if err != nil { 4411 return response, err 4412 } 4413 4414 err = common.UnmarshalResponse(httpResponse, &response) 4415 return response, err 4416} 4417 4418// UpdateSwiftPassword **Deprecated. Use UpdateAuthToken instead.** 4419// Updates the specified Swift password's description. 4420func (client IdentityClient) UpdateSwiftPassword(ctx context.Context, request UpdateSwiftPasswordRequest) (response UpdateSwiftPasswordResponse, err error) { 4421 var ociResponse common.OCIResponse 4422 policy := common.NoRetryPolicy() 4423 if request.RetryPolicy() != nil { 4424 policy = *request.RetryPolicy() 4425 } 4426 ociResponse, err = common.Retry(ctx, request, client.updateSwiftPassword, policy) 4427 if err != nil { 4428 if ociResponse != nil { 4429 response = UpdateSwiftPasswordResponse{RawResponse: ociResponse.HTTPResponse()} 4430 } 4431 return 4432 } 4433 if convertedResponse, ok := ociResponse.(UpdateSwiftPasswordResponse); ok { 4434 response = convertedResponse 4435 } else { 4436 err = fmt.Errorf("failed to convert OCIResponse into UpdateSwiftPasswordResponse") 4437 } 4438 return 4439} 4440 4441// updateSwiftPassword implements the OCIOperation interface (enables retrying operations) 4442func (client IdentityClient) updateSwiftPassword(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4443 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}/swiftPasswords/{swiftPasswordId}") 4444 if err != nil { 4445 return nil, err 4446 } 4447 4448 var response UpdateSwiftPasswordResponse 4449 var httpResponse *http.Response 4450 httpResponse, err = client.Call(ctx, &httpRequest) 4451 defer common.CloseBodyIfValid(httpResponse) 4452 response.RawResponse = httpResponse 4453 if err != nil { 4454 return response, err 4455 } 4456 4457 err = common.UnmarshalResponse(httpResponse, &response) 4458 return response, err 4459} 4460 4461// UpdateTag Updates the specified tag definition. 4462// Setting a 'validator' will enable enforcement of additional validation on values contained in the specified for 4463// this definedTag. Any values that were previously set will not be changed, but any new value set for the 4464// definedTag must pass validation. 4465func (client IdentityClient) UpdateTag(ctx context.Context, request UpdateTagRequest) (response UpdateTagResponse, err error) { 4466 var ociResponse common.OCIResponse 4467 policy := common.NoRetryPolicy() 4468 if request.RetryPolicy() != nil { 4469 policy = *request.RetryPolicy() 4470 } 4471 ociResponse, err = common.Retry(ctx, request, client.updateTag, policy) 4472 if err != nil { 4473 if ociResponse != nil { 4474 response = UpdateTagResponse{RawResponse: ociResponse.HTTPResponse()} 4475 } 4476 return 4477 } 4478 if convertedResponse, ok := ociResponse.(UpdateTagResponse); ok { 4479 response = convertedResponse 4480 } else { 4481 err = fmt.Errorf("failed to convert OCIResponse into UpdateTagResponse") 4482 } 4483 return 4484} 4485 4486// updateTag implements the OCIOperation interface (enables retrying operations) 4487func (client IdentityClient) updateTag(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4488 httpRequest, err := request.HTTPRequest(http.MethodPut, "/tagNamespaces/{tagNamespaceId}/tags/{tagName}") 4489 if err != nil { 4490 return nil, err 4491 } 4492 4493 var response UpdateTagResponse 4494 var httpResponse *http.Response 4495 httpResponse, err = client.Call(ctx, &httpRequest) 4496 defer common.CloseBodyIfValid(httpResponse) 4497 response.RawResponse = httpResponse 4498 if err != nil { 4499 return response, err 4500 } 4501 4502 err = common.UnmarshalResponse(httpResponse, &response) 4503 return response, err 4504} 4505 4506// UpdateTagDefault Updates the specified tag default. If you specify that a value is required, a value is set 4507// during resource creation (either by the user creating the resource or another tag defualt). 4508// If no value is set, resource creation is blocked. 4509// * If the `isRequired` flag is set to "true", the value is set during resource creation. 4510// * If the `isRequired` flag is set to "false", the value you enter is set during resource creation. 4511func (client IdentityClient) UpdateTagDefault(ctx context.Context, request UpdateTagDefaultRequest) (response UpdateTagDefaultResponse, err error) { 4512 var ociResponse common.OCIResponse 4513 policy := common.NoRetryPolicy() 4514 if request.RetryPolicy() != nil { 4515 policy = *request.RetryPolicy() 4516 } 4517 ociResponse, err = common.Retry(ctx, request, client.updateTagDefault, policy) 4518 if err != nil { 4519 if ociResponse != nil { 4520 response = UpdateTagDefaultResponse{RawResponse: ociResponse.HTTPResponse()} 4521 } 4522 return 4523 } 4524 if convertedResponse, ok := ociResponse.(UpdateTagDefaultResponse); ok { 4525 response = convertedResponse 4526 } else { 4527 err = fmt.Errorf("failed to convert OCIResponse into UpdateTagDefaultResponse") 4528 } 4529 return 4530} 4531 4532// updateTagDefault implements the OCIOperation interface (enables retrying operations) 4533func (client IdentityClient) updateTagDefault(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4534 httpRequest, err := request.HTTPRequest(http.MethodPut, "/tagDefaults/{tagDefaultId}") 4535 if err != nil { 4536 return nil, err 4537 } 4538 4539 var response UpdateTagDefaultResponse 4540 var httpResponse *http.Response 4541 httpResponse, err = client.Call(ctx, &httpRequest) 4542 defer common.CloseBodyIfValid(httpResponse) 4543 response.RawResponse = httpResponse 4544 if err != nil { 4545 return response, err 4546 } 4547 4548 err = common.UnmarshalResponse(httpResponse, &response) 4549 return response, err 4550} 4551 4552// UpdateTagNamespace Updates the the specified tag namespace. You can't update the namespace name. 4553// Updating `isRetired` to 'true' retires the namespace and all the tag definitions in the namespace. Reactivating a 4554// namespace (changing `isRetired` from 'true' to 'false') does not reactivate tag definitions. 4555// To reactivate the tag definitions, you must reactivate each one indvidually *after* you reactivate the namespace, 4556// using UpdateTag. For more information about retiring tag namespaces, see 4557// Retiring Key Definitions and Namespace Definitions (https://docs.cloud.oracle.com/Content/Identity/Concepts/taggingoverview.htm#Retiring). 4558// You can't add a namespace with the same name as a retired namespace in the same tenancy. 4559func (client IdentityClient) UpdateTagNamespace(ctx context.Context, request UpdateTagNamespaceRequest) (response UpdateTagNamespaceResponse, err error) { 4560 var ociResponse common.OCIResponse 4561 policy := common.NoRetryPolicy() 4562 if request.RetryPolicy() != nil { 4563 policy = *request.RetryPolicy() 4564 } 4565 ociResponse, err = common.Retry(ctx, request, client.updateTagNamespace, policy) 4566 if err != nil { 4567 if ociResponse != nil { 4568 response = UpdateTagNamespaceResponse{RawResponse: ociResponse.HTTPResponse()} 4569 } 4570 return 4571 } 4572 if convertedResponse, ok := ociResponse.(UpdateTagNamespaceResponse); ok { 4573 response = convertedResponse 4574 } else { 4575 err = fmt.Errorf("failed to convert OCIResponse into UpdateTagNamespaceResponse") 4576 } 4577 return 4578} 4579 4580// updateTagNamespace implements the OCIOperation interface (enables retrying operations) 4581func (client IdentityClient) updateTagNamespace(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4582 httpRequest, err := request.HTTPRequest(http.MethodPut, "/tagNamespaces/{tagNamespaceId}") 4583 if err != nil { 4584 return nil, err 4585 } 4586 4587 var response UpdateTagNamespaceResponse 4588 var httpResponse *http.Response 4589 httpResponse, err = client.Call(ctx, &httpRequest) 4590 defer common.CloseBodyIfValid(httpResponse) 4591 response.RawResponse = httpResponse 4592 if err != nil { 4593 return response, err 4594 } 4595 4596 err = common.UnmarshalResponse(httpResponse, &response) 4597 return response, err 4598} 4599 4600// UpdateUser Updates the description of the specified user. 4601func (client IdentityClient) UpdateUser(ctx context.Context, request UpdateUserRequest) (response UpdateUserResponse, err error) { 4602 var ociResponse common.OCIResponse 4603 policy := common.NoRetryPolicy() 4604 if request.RetryPolicy() != nil { 4605 policy = *request.RetryPolicy() 4606 } 4607 ociResponse, err = common.Retry(ctx, request, client.updateUser, policy) 4608 if err != nil { 4609 if ociResponse != nil { 4610 response = UpdateUserResponse{RawResponse: ociResponse.HTTPResponse()} 4611 } 4612 return 4613 } 4614 if convertedResponse, ok := ociResponse.(UpdateUserResponse); ok { 4615 response = convertedResponse 4616 } else { 4617 err = fmt.Errorf("failed to convert OCIResponse into UpdateUserResponse") 4618 } 4619 return 4620} 4621 4622// updateUser implements the OCIOperation interface (enables retrying operations) 4623func (client IdentityClient) updateUser(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4624 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}") 4625 if err != nil { 4626 return nil, err 4627 } 4628 4629 var response UpdateUserResponse 4630 var httpResponse *http.Response 4631 httpResponse, err = client.Call(ctx, &httpRequest) 4632 defer common.CloseBodyIfValid(httpResponse) 4633 response.RawResponse = httpResponse 4634 if err != nil { 4635 return response, err 4636 } 4637 4638 err = common.UnmarshalResponse(httpResponse, &response) 4639 return response, err 4640} 4641 4642// UpdateUserCapabilities Updates the capabilities of the specified user. 4643func (client IdentityClient) UpdateUserCapabilities(ctx context.Context, request UpdateUserCapabilitiesRequest) (response UpdateUserCapabilitiesResponse, err error) { 4644 var ociResponse common.OCIResponse 4645 policy := common.NoRetryPolicy() 4646 if request.RetryPolicy() != nil { 4647 policy = *request.RetryPolicy() 4648 } 4649 ociResponse, err = common.Retry(ctx, request, client.updateUserCapabilities, policy) 4650 if err != nil { 4651 if ociResponse != nil { 4652 response = UpdateUserCapabilitiesResponse{RawResponse: ociResponse.HTTPResponse()} 4653 } 4654 return 4655 } 4656 if convertedResponse, ok := ociResponse.(UpdateUserCapabilitiesResponse); ok { 4657 response = convertedResponse 4658 } else { 4659 err = fmt.Errorf("failed to convert OCIResponse into UpdateUserCapabilitiesResponse") 4660 } 4661 return 4662} 4663 4664// updateUserCapabilities implements the OCIOperation interface (enables retrying operations) 4665func (client IdentityClient) updateUserCapabilities(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4666 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}/capabilities") 4667 if err != nil { 4668 return nil, err 4669 } 4670 4671 var response UpdateUserCapabilitiesResponse 4672 var httpResponse *http.Response 4673 httpResponse, err = client.Call(ctx, &httpRequest) 4674 defer common.CloseBodyIfValid(httpResponse) 4675 response.RawResponse = httpResponse 4676 if err != nil { 4677 return response, err 4678 } 4679 4680 err = common.UnmarshalResponse(httpResponse, &response) 4681 return response, err 4682} 4683 4684// UpdateUserState Updates the state of the specified user. 4685func (client IdentityClient) UpdateUserState(ctx context.Context, request UpdateUserStateRequest) (response UpdateUserStateResponse, err error) { 4686 var ociResponse common.OCIResponse 4687 policy := common.NoRetryPolicy() 4688 if request.RetryPolicy() != nil { 4689 policy = *request.RetryPolicy() 4690 } 4691 ociResponse, err = common.Retry(ctx, request, client.updateUserState, policy) 4692 if err != nil { 4693 if ociResponse != nil { 4694 response = UpdateUserStateResponse{RawResponse: ociResponse.HTTPResponse()} 4695 } 4696 return 4697 } 4698 if convertedResponse, ok := ociResponse.(UpdateUserStateResponse); ok { 4699 response = convertedResponse 4700 } else { 4701 err = fmt.Errorf("failed to convert OCIResponse into UpdateUserStateResponse") 4702 } 4703 return 4704} 4705 4706// updateUserState implements the OCIOperation interface (enables retrying operations) 4707func (client IdentityClient) updateUserState(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4708 httpRequest, err := request.HTTPRequest(http.MethodPut, "/users/{userId}/state") 4709 if err != nil { 4710 return nil, err 4711 } 4712 4713 var response UpdateUserStateResponse 4714 var httpResponse *http.Response 4715 httpResponse, err = client.Call(ctx, &httpRequest) 4716 defer common.CloseBodyIfValid(httpResponse) 4717 response.RawResponse = httpResponse 4718 if err != nil { 4719 return response, err 4720 } 4721 4722 err = common.UnmarshalResponse(httpResponse, &response) 4723 return response, err 4724} 4725 4726// UploadApiKey Uploads an API signing key for the specified user. 4727// Every user has permission to use this operation to upload a key for *their own user ID*. An 4728// administrator in your organization does not need to write a policy to give users this ability. 4729// To compare, administrators who have permission to the tenancy can use this operation to upload a 4730// key for any user, including themselves. 4731// **Important:** Even though you have permission to upload an API key, you might not yet 4732// have permission to do much else. If you try calling an operation unrelated to your own credential 4733// management (e.g., `ListUsers`, `LaunchInstance`) and receive an "unauthorized" error, 4734// check with an administrator to confirm which IAM Service group(s) you're in and what access 4735// you have. Also confirm you're working in the correct compartment. 4736// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using 4737// the object, first make sure its `lifecycleState` has changed to ACTIVE. 4738func (client IdentityClient) UploadApiKey(ctx context.Context, request UploadApiKeyRequest) (response UploadApiKeyResponse, err error) { 4739 var ociResponse common.OCIResponse 4740 policy := common.NoRetryPolicy() 4741 if request.RetryPolicy() != nil { 4742 policy = *request.RetryPolicy() 4743 } 4744 4745 if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { 4746 request.OpcRetryToken = common.String(common.RetryToken()) 4747 } 4748 4749 ociResponse, err = common.Retry(ctx, request, client.uploadApiKey, policy) 4750 if err != nil { 4751 if ociResponse != nil { 4752 response = UploadApiKeyResponse{RawResponse: ociResponse.HTTPResponse()} 4753 } 4754 return 4755 } 4756 if convertedResponse, ok := ociResponse.(UploadApiKeyResponse); ok { 4757 response = convertedResponse 4758 } else { 4759 err = fmt.Errorf("failed to convert OCIResponse into UploadApiKeyResponse") 4760 } 4761 return 4762} 4763 4764// uploadApiKey implements the OCIOperation interface (enables retrying operations) 4765func (client IdentityClient) uploadApiKey(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) { 4766 httpRequest, err := request.HTTPRequest(http.MethodPost, "/users/{userId}/apiKeys") 4767 if err != nil { 4768 return nil, err 4769 } 4770 4771 var response UploadApiKeyResponse 4772 var httpResponse *http.Response 4773 httpResponse, err = client.Call(ctx, &httpRequest) 4774 defer common.CloseBodyIfValid(httpResponse) 4775 response.RawResponse = httpResponse 4776 if err != nil { 4777 return response, err 4778 } 4779 4780 err = common.UnmarshalResponse(httpResponse, &response) 4781 return response, err 4782} 4783