// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
package main
import (
"context"
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
"github.com/oracle/oci-go-sdk/v65/identitydomains"
)
func ExampleCreatePasswordPolicy() {
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
client, err := identitydomains.NewIdentityDomainsClientWithConfigurationProvider(common.DefaultConfigProvider(), "specificEndpoint")
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := identitydomains.CreatePasswordPolicyRequest{Authorization: common.String("EXAMPLE-authorization-Value"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
PasswordPolicy: identitydomains.PasswordPolicy{Tags: []identitydomains.Tags{identitydomains.Tags{Key: common.String("EXAMPLE-key-Value"),
Value: common.String("EXAMPLE-value-Value")}},
CompartmentOcid: common.String("EXAMPLE-compartmentOcid-Value"),
Description: common.String("EXAMPLE-description-Value"),
MaxLength: common.Int(302),
MinPasswordAge: common.Int(522),
NumPasswordsInHistory: common.Int(830),
Ocid: common.String("EXAMPLE-ocid-Value"),
Schemas: []string{"EXAMPLE--Value"},
UserNameDisallowed: common.Bool(true),
DisallowedChars: common.String("EXAMPLE-disallowedChars-Value"),
DisallowedSubstrings: []string{"EXAMPLE--Value"},
FirstNameDisallowed: common.Bool(false),
LastNameDisallowed: common.Bool(true),
MaxRepeatedChars: common.Int(535),
MinUniqueChars: common.Int(50),
TenancyOcid: common.String("EXAMPLE-tenancyOcid-Value"),
AllowedChars: common.String("EXAMPLE-allowedChars-Value"),
ForcePasswordReset: common.Bool(false),
Groups: []identitydomains.PasswordPolicyGroups{identitydomains.PasswordPolicyGroups{Display: common.String("EXAMPLE-display-Value"),
Value: common.String("EXAMPLE-value-Value"),
Ref: common.String("EXAMPLE-$ref-Value")}},
Meta: &identitydomains.Meta{Created: common.String("EXAMPLE-created-Value"),
LastModified: common.String("EXAMPLE-lastModified-Value"),
Location: common.String("EXAMPLE-location-Value"),
ResourceType: common.String("EXAMPLE-resourceType-Value"),
Version: common.String("EXAMPLE-version-Value")},
Name: common.String("EXAMPLE-name-Value"),
RequiredChars: common.String("EXAMPLE-requiredChars-Value"),
PasswordExpireWarning: common.Int(968),
ConfiguredPasswordPolicyRules: []identitydomains.PasswordPolicyConfiguredPasswordPolicyRules{identitydomains.PasswordPolicyConfiguredPasswordPolicyRules{Key: common.String("EXAMPLE-key-Value"),
Value: common.String("EXAMPLE-value-Value")}},
DeleteInProgress: common.Bool(true),
ExternalId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-externalId-Value"),
Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value"),
IdcsCreatedBy: &identitydomains.IdcsCreatedBy{Ref: common.String("EXAMPLE-$ref-Value"),
Display: common.String("EXAMPLE-display-Value"),
Ocid: common.String("EXAMPLE-ocid-Value"),
Type: identitydomains.IdcsCreatedByTypeUser,
Value: common.String("EXAMPLE-value-Value")},
LockoutDuration: common.Int(920),
MinAlphas: common.Int(251),
PasswordStrength: identitydomains.PasswordPolicyPasswordStrengthStandard,
Priority: common.Int(507),
DictionaryLocation: common.String("EXAMPLE-dictionaryLocation-Value"),
IdcsLastUpgradedInRelease: common.String("EXAMPLE-idcsLastUpgradedInRelease-Value"),
IdcsPreventedOperations: []identitydomains.IdcsPreventedOperationsEnum{identitydomains.IdcsPreventedOperationsReplace},
MinNumerals: common.Int(86),
DistinctCharacters: common.Int(122),
MinAlphaNumerals: common.Int(977),
MinSpecialChars: common.Int(691),
PasswordExpiresAfter: common.Int(689),
StartsWithAlphabet: common.Bool(true),
MinLength: common.Int(540),
DictionaryDelimiter: common.String("EXAMPLE-dictionaryDelimiter-Value"),
DictionaryWordDisallowed: common.Bool(true),
DisallowedUserAttributeValues: []string{"EXAMPLE--Value"},
DomainOcid: common.String("EXAMPLE-domainOcid-Value"),
IdcsLastModifiedBy: &identitydomains.IdcsLastModifiedBy{Value: common.String("EXAMPLE-value-Value"),
Ref: common.String("EXAMPLE-$ref-Value"),
Display: common.String("EXAMPLE-display-Value"),
Ocid: common.String("EXAMPLE-ocid-Value"),
Type: identitydomains.IdcsLastModifiedByTypeApp},
MaxIncorrectAttempts: common.Int(20),
MaxSpecialChars: common.Int(259),
MinLowerCase: common.Int(351),
MinUpperCase: common.Int(125)},
ResourceTypeSchemaVersion: common.String("EXAMPLE-resourceTypeSchemaVersion-Value"),
AttributeSets: []identitydomains.AttributeSetsEnum{identitydomains.AttributeSetsDefault},
Attributes: common.String("EXAMPLE-attributes-Value")}
// Send the request using the service client
resp, err := client.CreatePasswordPolicy(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}