// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.IdentitydomainsService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Identitydomains
{
public class CreateAppExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var app = new Oci.IdentitydomainsService.Models.App
{
Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
Ocid = "EXAMPLE-ocid-Value",
Schemas = new List<string>
{
"EXAMPLE--Value"
},
Meta = new Oci.IdentitydomainsService.Models.Meta
{
ResourceType = "EXAMPLE-resourceType-Value",
Created = "EXAMPLE-created-Value",
LastModified = "EXAMPLE-lastModified-Value",
Location = "EXAMPLE-location-Value",
Version = "EXAMPLE-version-Value"
},
IdcsCreatedBy = new Oci.IdentitydomainsService.Models.IdcsCreatedBy
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Type = Oci.IdentitydomainsService.Models.IdcsCreatedBy.TypeEnum.User,
Display = "EXAMPLE-display-Value",
Ocid = "EXAMPLE-ocid-Value"
},
IdcsLastModifiedBy = new Oci.IdentitydomainsService.Models.IdcsLastModifiedBy
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Type = Oci.IdentitydomainsService.Models.IdcsLastModifiedBy.TypeEnum.App,
Display = "EXAMPLE-display-Value",
Ocid = "EXAMPLE-ocid-Value"
},
IdcsPreventedOperations = new List<Oci.IdentitydomainsService.Models.IdcsPreventedOperations>
{
Oci.IdentitydomainsService.Models.IdcsPreventedOperations.Replace
},
Tags = new List<Oci.IdentitydomainsService.Models.Tags>
{
new Oci.IdentitydomainsService.Models.Tags
{
Key = "EXAMPLE-key-Value",
Value = "EXAMPLE-value-Value"
}
},
DeleteInProgress = true,
IdcsLastUpgradedInRelease = "EXAMPLE-idcsLastUpgradedInRelease-Value",
DomainOcid = "EXAMPLE-domainOcid-Value",
CompartmentOcid = "EXAMPLE-compartmentOcid-Value",
TenancyOcid = "EXAMPLE-tenancyOcid-Value",
MeterAsOPCService = true,
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 = new List<string>
{
"EXAMPLE--Value"
},
Active = true,
AppIcon = "EXAMPLE-appIcon-Value",
AppThumbnail = "EXAMPLE-appThumbnail-Value",
Migrated = false,
Infrastructure = false,
IsLoginTarget = true,
ShowInMyApps = true,
LoginMechanism = Oci.IdentitydomainsService.Models.App.LoginMechanismEnum.Oidc,
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 = false,
IsOAuthClient = false,
IsRadiusApp = true,
ClientType = Oci.IdentitydomainsService.Models.App.ClientTypeEnum.Trusted,
RedirectUris = new List<string>
{
"EXAMPLE--Value"
},
AllUrlSchemesAllowed = false,
LogoutUri = "EXAMPLE-logoutUri-Value",
PostLogoutRedirectUris = new List<string>
{
"EXAMPLE--Value"
},
AllowedGrants = new List<string>
{
"EXAMPLE--Value"
},
AllowedOperations = new List<Oci.IdentitydomainsService.Models.App.AllowedOperationsEnum>
{
Oci.IdentitydomainsService.Models.App.AllowedOperationsEnum.Introspect
},
ClientIPChecking = Oci.IdentitydomainsService.Models.App.ClientIPCheckingEnum.Anywhere,
IsOPCService = false,
IsUnmanagedApp = true,
AllowAccessControl = true,
IsOAuthResource = true,
AccessTokenExpiry = 768,
RefreshTokenExpiry = 305,
AllowOffline = true,
CallbackServiceUrl = "EXAMPLE-callbackServiceUrl-Value",
Audience = "EXAMPLE-audience-Value",
IsMobileTarget = true,
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 = true,
ServiceTypeURN = "EXAMPLE-serviceTypeURN-Value",
ServiceTypeVersion = "EXAMPLE-serviceTypeVersion-Value",
IsObligationCapable = true,
ReadyToUpgrade = false,
TrustScope = Oci.IdentitydomainsService.Models.App.TrustScopeEnum.Default,
IsDatabaseService = false,
SecondaryAudiences = new List<string>
{
"EXAMPLE--Value"
},
IsEnterpriseApp = false,
BypassConsent = true,
DisableKmsiTokenAuthentication = false,
IsMulticloudServiceApp = false,
RadiusPolicy = new Oci.IdentitydomainsService.Models.AppRadiusPolicy
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
},
AppsNetworkPerimeters = new List<Oci.IdentitydomainsService.Models.AppAppsNetworkPerimeters>
{
new Oci.IdentitydomainsService.Models.AppAppsNetworkPerimeters
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
}
},
CloudControlProperties = new List<Oci.IdentitydomainsService.Models.AppCloudControlProperties>
{
new Oci.IdentitydomainsService.Models.AppCloudControlProperties
{
Name = "EXAMPLE-name-Value",
Values = new List<string>
{
"EXAMPLE--Value"
}
}
},
EditableAttributes = new List<Oci.IdentitydomainsService.Models.AppEditableAttributes>
{
new Oci.IdentitydomainsService.Models.AppEditableAttributes
{
Name = "EXAMPLE-name-Value"
}
},
TermsOfUse = new Oci.IdentitydomainsService.Models.AppTermsOfUse
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Name = "EXAMPLE-name-Value"
},
ProtectableSecondaryAudiences = new List<Oci.IdentitydomainsService.Models.AppProtectableSecondaryAudiences>
{
new Oci.IdentitydomainsService.Models.AppProtectableSecondaryAudiences
{
Value = "EXAMPLE-value-Value",
ReadOnly = true
}
},
IdpPolicy = new Oci.IdentitydomainsService.Models.AppIdpPolicy
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
},
AllowedTags = new List<Oci.IdentitydomainsService.Models.AppAllowedTags>
{
new Oci.IdentitydomainsService.Models.AppAllowedTags
{
Key = "EXAMPLE-key-Value",
Value = "EXAMPLE-value-Value",
ReadOnly = true
}
},
AppSignonPolicy = new Oci.IdentitydomainsService.Models.AppAppSignonPolicy
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
},
TrustPolicies = new List<Oci.IdentitydomainsService.Models.AppTrustPolicies>
{
new Oci.IdentitydomainsService.Models.AppTrustPolicies
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
}
},
SignonPolicy = new Oci.IdentitydomainsService.Models.AppSignonPolicy
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
},
IdentityProviders = new List<Oci.IdentitydomainsService.Models.AppIdentityProviders>
{
new Oci.IdentitydomainsService.Models.AppIdentityProviders
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Display = "EXAMPLE-display-Value"
}
},
Accounts = new List<Oci.IdentitydomainsService.Models.AppAccounts>
{
new Oci.IdentitydomainsService.Models.AppAccounts
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
OwnerId = "ocid1.test.oc1..<unique_ID>EXAMPLE-ownerId-Value",
Name = "EXAMPLE-name-Value",
Active = true
}
},
Grants = new List<Oci.IdentitydomainsService.Models.AppGrants>
{
new Oci.IdentitydomainsService.Models.AppGrants
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
GranteeId = "ocid1.test.oc1..<unique_ID>EXAMPLE-granteeId-Value",
GranteeType = Oci.IdentitydomainsService.Models.AppGrants.GranteeTypeEnum.User,
GrantMechanism = Oci.IdentitydomainsService.Models.AppGrants.GrantMechanismEnum.ServiceManagerToApp
}
},
ServiceParams = new List<Oci.IdentitydomainsService.Models.AppServiceParams>
{
new Oci.IdentitydomainsService.Models.AppServiceParams
{
Name = "EXAMPLE-name-Value",
Value = "EXAMPLE-value-Value"
}
},
AttrRenderingMetadata = new List<Oci.IdentitydomainsService.Models.AppAttrRenderingMetadata>
{
new Oci.IdentitydomainsService.Models.AppAttrRenderingMetadata
{
Name = "EXAMPLE-name-Value",
Label = "EXAMPLE-label-Value",
Helptext = "EXAMPLE-helptext-Value",
Widget = Oci.IdentitydomainsService.Models.AppAttrRenderingMetadata.WidgetEnum.Inputtext,
Datatype = "EXAMPLE-datatype-Value",
Section = Oci.IdentitydomainsService.Models.AppAttrRenderingMetadata.SectionEnum.General,
Order = 76,
Required = false,
Regexp = "EXAMPLE-regexp-Value",
ReadOnly = true,
Visible = false,
MinLength = 663,
MaxLength = 23,
MinSize = 120,
MaxSize = 196
}
},
BasedOnTemplate = new Oci.IdentitydomainsService.Models.AppBasedOnTemplate
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
LastModified = "EXAMPLE-lastModified-Value",
WellKnownId = "ocid1.test.oc1..<unique_ID>EXAMPLE-wellKnownId-Value"
},
GrantedAppRoles = new List<Oci.IdentitydomainsService.Models.AppGrantedAppRoles>
{
new Oci.IdentitydomainsService.Models.AppGrantedAppRoles
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Type = Oci.IdentitydomainsService.Models.AppGrantedAppRoles.TypeEnum.Direct,
Display = "EXAMPLE-display-Value",
AppId = "ocid1.test.oc1..<unique_ID>EXAMPLE-appId-Value",
AppName = "EXAMPLE-appName-Value",
AdminRole = false,
LegacyGroupName = "EXAMPLE-legacyGroupName-Value",
ReadOnly = true
}
},
SamlServiceProvider = new Oci.IdentitydomainsService.Models.AppSamlServiceProvider
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
},
AllowedScopes = new List<Oci.IdentitydomainsService.Models.AppAllowedScopes>
{
new Oci.IdentitydomainsService.Models.AppAllowedScopes
{
Fqs = "EXAMPLE-fqs-Value",
IdOfDefiningApp = "EXAMPLE-idOfDefiningApp-Value",
ReadOnly = false
}
},
Certificates = new List<Oci.IdentitydomainsService.Models.AppCertificates>
{
new Oci.IdentitydomainsService.Models.AppCertificates
{
CertAlias = "EXAMPLE-certAlias-Value",
Sha1Thumbprint = "EXAMPLE-sha1Thumbprint-Value",
Kid = "EXAMPLE-kid-Value",
X5t = "EXAMPLE-x5t-Value",
X509Base64Certificate = "EXAMPLE-x509Base64Certificate-Value"
}
},
AliasApps = new List<Oci.IdentitydomainsService.Models.AppAliasApps>
{
new Oci.IdentitydomainsService.Models.AppAliasApps
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Display = "EXAMPLE-display-Value",
Description = "EXAMPLE-description-Value"
}
},
AsOPCService = new Oci.IdentitydomainsService.Models.AppAsOPCService
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value"
},
AdminRoles = new List<Oci.IdentitydomainsService.Models.AppAdminRoles>
{
new Oci.IdentitydomainsService.Models.AppAdminRoles
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Display = "EXAMPLE-display-Value",
Description = "EXAMPLE-description-Value"
}
},
UserRoles = new List<Oci.IdentitydomainsService.Models.AppUserRoles>
{
new Oci.IdentitydomainsService.Models.AppUserRoles
{
Value = "EXAMPLE-value-Value",
Ref = "EXAMPLE-$ref-Value",
Display = "EXAMPLE-display-Value",
Description = "EXAMPLE-description-Value"
}
},
Scopes = new List<Oci.IdentitydomainsService.Models.AppScopes>
{
new Oci.IdentitydomainsService.Models.AppScopes
{
Value = "EXAMPLE-value-Value",
Fqs = "EXAMPLE-fqs-Value",
Description = "EXAMPLE-description-Value",
DisplayName = "EXAMPLE-displayName-Value",
RequiresConsent = false,
ReadOnly = false
}
},
};
var createAppRequest = new Oci.IdentitydomainsService.Requests.CreateAppRequest
{
Authorization = "EXAMPLE-authorization-Value",
ResourceTypeSchemaVersion = "EXAMPLE-resourceTypeSchemaVersion-Value",
Attributes = "EXAMPLE-attributes-Value",
AttributeSets = new List<Oci.IdentitydomainsService.Models.AttributeSets>
{
Oci.IdentitydomainsService.Models.AttributeSets.Always
},
App = app,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
};
// 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.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new IdentityDomainsClient(provider, new ClientConfiguration()))
{
var response = await client.CreateApp(createAppRequest);
// Retrieve value from the response.
var id = response.App.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateApp Failed with {e.Message}");
throw e;
}
}
}
}