// 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).

import * as identitydomains from "oci-identitydomains";
import common = require("oci-common");

// 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.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
    try {
     // Create a service client
     const client = new identitydomains.IdentityDomainsClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  app = {
		id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
		ocid: "EXAMPLE-ocid-Value",
		schemas: ["EXAMPLE--Value"				],
		meta: {
			resourceType: "EXAMPLE-resourceType-Value",
			created: "EXAMPLE-created-Value",
			lastModified: "EXAMPLE-lastModified-Value",
			location: "EXAMPLE-location-Value",
			version: "EXAMPLE-version-Value",

			}
,
		idcsCreatedBy: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",
			type: identitydomains.models.IdcsCreatedBy.Type.App,
			display: "EXAMPLE-display-Value",
			ocid: "EXAMPLE-ocid-Value",

			}
,
		idcsLastModifiedBy: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",
			type: identitydomains.models.IdcsLastModifiedBy.Type.User,
			display: "EXAMPLE-display-Value",
			ocid: "EXAMPLE-ocid-Value",

			}
,
		idcsPreventedOperations: [identitydomains.models.IdcsPreventedOperations.Update				],
		tags: [{
				key: "EXAMPLE-key-Value",
				value: "EXAMPLE-value-Value",

				}
				],
		deleteInProgress: false,
		idcsLastUpgradedInRelease: "EXAMPLE-idcsLastUpgradedInRelease-Value",
		domainOcid: "EXAMPLE-domainOcid-Value",
		compartmentOcid: "EXAMPLE-compartmentOcid-Value",
		tenancyOcid: "EXAMPLE-tenancyOcid-Value",
		meterAsOPCService: false,
		name: "EXAMPLE-name-Value",
		clientSecret: "EXAMPLE-clientSecret-Value",
		hashedClientSecret: "EXAMPLE-hashedClientSecret-Value",
		displayName: "EXAMPLE-displayName-Value",
		description: "EXAMPLE-description-Value",
		idTokenEncAlgo: "EXAMPLE-idTokenEncAlgo-Value",
		delegatedServiceNames: ["EXAMPLE--Value"				],
		active: true,
		appIcon: "EXAMPLE-appIcon-Value",
		appThumbnail: "EXAMPLE-appThumbnail-Value",
		migrated: true,
		infrastructure: false,
		isLoginTarget: true,
		showInMyApps: true,
		loginMechanism: identitydomains.models.App.LoginMechanism.Saml,
		landingPageUrl: "EXAMPLE-landingPageUrl-Value",
		productLogoUrl: "EXAMPLE-productLogoUrl-Value",
		privacyPolicyUrl: "EXAMPLE-privacyPolicyUrl-Value",
		termsOfServiceUrl: "EXAMPLE-termsOfServiceUrl-Value",
		contactEmailAddress: "EXAMPLE-contactEmailAddress-Value",
		productName: "EXAMPLE-productName-Value",
		homePageUrl: "EXAMPLE-homePageUrl-Value",
		isFormFill: true,
		isOAuthClient: false,
		isRadiusApp: true,
		clientType: identitydomains.models.App.ClientType.Public,
		redirectUris: ["EXAMPLE--Value"				],
		allUrlSchemesAllowed: true,
		logoutUri: "EXAMPLE-logoutUri-Value",
		postLogoutRedirectUris: ["EXAMPLE--Value"				],
		allowedGrants: ["EXAMPLE--Value"				],
		allowedOperations: [identitydomains.models.App.AllowedOperations.OnBehalfOfUser				],
		clientIPChecking: identitydomains.models.App.ClientIPChecking.Anywhere,
		isOPCService: true,
		isUnmanagedApp: true,
		allowAccessControl: false,
		isOAuthResource: false,
		accessTokenExpiry: 190,
		refreshTokenExpiry: 710,
		allowOffline: false,
		callbackServiceUrl: "EXAMPLE-callbackServiceUrl-Value",
		audience: "EXAMPLE-audience-Value",
		isMobileTarget: false,
		loginPageUrl: "EXAMPLE-loginPageUrl-Value",
		linkingCallbackUrl: "EXAMPLE-linkingCallbackUrl-Value",
		logoutPageUrl: "EXAMPLE-logoutPageUrl-Value",
		errorPageUrl: "EXAMPLE-errorPageUrl-Value",
		isSamlServiceProvider: false,
		isWebTierPolicy: false,
		isKerberosRealm: true,
		icon: "EXAMPLE-icon-Value",
		isAliasApp: false,
		isManagedApp: false,
		serviceTypeURN: "EXAMPLE-serviceTypeURN-Value",
		serviceTypeVersion: "EXAMPLE-serviceTypeVersion-Value",
		isObligationCapable: false,
		readyToUpgrade: true,
		trustScope: identitydomains.models.App.TrustScope.Explicit,
		isDatabaseService: true,
		secondaryAudiences: ["EXAMPLE--Value"				],
		isEnterpriseApp: false,
		bypassConsent: false,
		disableKmsiTokenAuthentication: false,
		isMulticloudServiceApp: true,
		radiusPolicy: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",

			}
,
		appsNetworkPerimeters: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",

				}
				],
		cloudControlProperties: [{
				name: "EXAMPLE-name-Value",
				values: ["EXAMPLE--Value"						],

				}
				],
		editableAttributes: [{
				name: "EXAMPLE-name-Value",

				}
				],
		termsOfUse: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",
			name: "EXAMPLE-name-Value",

			}
,
		protectableSecondaryAudiences: [{
				value: "EXAMPLE-value-Value",
				readOnly: false,

				}
				],
		idpPolicy: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",

			}
,
		allowedTags: [{
				key: "EXAMPLE-key-Value",
				value: "EXAMPLE-value-Value",
				readOnly: false,

				}
				],
		appSignonPolicy: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",

			}
,
		trustPolicies: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",

				}
				],
		signonPolicy: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",

			}
,
		identityProviders: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				display: "EXAMPLE-display-Value",

				}
				],
		accounts: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				ownerId: "ocid1.test.oc1..<unique_ID>EXAMPLE-ownerId-Value",
				name: "EXAMPLE-name-Value",
				active: true,

				}
				],
		grants: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				granteeId: "ocid1.test.oc1..<unique_ID>EXAMPLE-granteeId-Value",
				granteeType: identitydomains.models.AppGrants.GranteeType.User,
				grantMechanism: identitydomains.models.AppGrants.GrantMechanism.AdministratorToUser,

				}
				],
		serviceParams: [{
				name: "EXAMPLE-name-Value",
				value: "EXAMPLE-value-Value",

				}
				],
		attrRenderingMetadata: [{
				name: "EXAMPLE-name-Value",
				label: "EXAMPLE-label-Value",
				helptext: "EXAMPLE-helptext-Value",
				widget: identitydomains.models.AppAttrRenderingMetadata.Widget.Textarea,
				datatype: "EXAMPLE-datatype-Value",
				section: identitydomains.models.AppAttrRenderingMetadata.Section.Saml,
				order: 471,
				required: false,
				regexp: "EXAMPLE-regexp-Value",
				readOnly: true,
				visible: true,
				minLength: 450,
				maxLength: 730,
				minSize: 456,
				maxSize: 364,

				}
				],
		basedOnTemplate: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",
			lastModified: "EXAMPLE-lastModified-Value",
			wellKnownId: "ocid1.test.oc1..<unique_ID>EXAMPLE-wellKnownId-Value",

			}
,
		grantedAppRoles: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				type: identitydomains.models.AppGrantedAppRoles.Type.Direct,
				display: "EXAMPLE-display-Value",
				appId: "ocid1.test.oc1..<unique_ID>EXAMPLE-appId-Value",
				appName: "EXAMPLE-appName-Value",
				adminRole: true,
				legacyGroupName: "EXAMPLE-legacyGroupName-Value",
				readOnly: true,

				}
				],
		samlServiceProvider: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",

			}
,
		allowedScopes: [{
				fqs: "EXAMPLE-fqs-Value",
				idOfDefiningApp: "EXAMPLE-idOfDefiningApp-Value",
				readOnly: false,

				}
				],
		certificates: [{
				certAlias: "EXAMPLE-certAlias-Value",
				sha1Thumbprint: "EXAMPLE-sha1Thumbprint-Value",
				kid: "EXAMPLE-kid-Value",
				x5t: "EXAMPLE-x5t-Value",
				x509Base64Certificate: "EXAMPLE-x509Base64Certificate-Value",

				}
				],
		aliasApps: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				display: "EXAMPLE-display-Value",
				description: "EXAMPLE-description-Value",

				}
				],
		asOPCService: {
			value: "EXAMPLE-value-Value",
			ref: "EXAMPLE-$ref-Value",

			}
,
		adminRoles: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				display: "EXAMPLE-display-Value",
				description: "EXAMPLE-description-Value",

				}
				],
		userRoles: [{
				value: "EXAMPLE-value-Value",
				ref: "EXAMPLE-$ref-Value",
				display: "EXAMPLE-display-Value",
				description: "EXAMPLE-description-Value",

				}
				],
		scopes: [{
				value: "EXAMPLE-value-Value",
				fqs: "EXAMPLE-fqs-Value",
				description: "EXAMPLE-description-Value",
				displayName: "EXAMPLE-displayName-Value",
				requiresConsent: true,
				readOnly: true,

				}
				],

		}

	const putAppRequest: identitydomains.requests.PutAppRequest = { 
	appId: "ocid1.test.oc1..<unique_ID>EXAMPLE-appId-Value",
	authorization: "EXAMPLE-authorization-Value",
	resourceTypeSchemaVersion: "EXAMPLE-resourceTypeSchemaVersion-Value",
	attributes: "EXAMPLE-attributes-Value",
	attributeSets: [identitydomains.models.AttributeSets.All			],
	app: app,
	ifMatch: "EXAMPLE-ifMatch-Value",
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",

		}; 


     // Send request to the Client.
     const putAppResponse = await client.putApp(putAppRequest);
     }
     catch (error) {
         console.log("putApp Failed with error  " + error);
     }
})();