// 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 loadbalancer from "oci-loadbalancer";
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 loadbalancer.LoadBalancerClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const createLoadBalancerDetails = {
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
displayName: "EXAMPLE-displayName-Value",
shapeName: "EXAMPLE-shapeName-Value",
shapeDetails: {
minimumBandwidthInMbps: 6246,
maximumBandwidthInMbps: 237,
}
,
isPrivate: false,
isDeleteProtectionEnabled: true,
ipMode: loadbalancer.models.CreateLoadBalancerDetails.IpMode.Ipv4,
ipv6SubnetCidr: "EXAMPLE-ipv6SubnetCidr-Value",
isRequestIdEnabled: true,
requestIdHeader: "EXAMPLE-requestIdHeader-Value",
reservedIps: [{
id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
}
],
listeners: {
EXAMPLE_KEY_aOJdR :{
defaultBackendSetName: "EXAMPLE-defaultBackendSetName-Value",
port: 60137,
protocol: "EXAMPLE-protocol-Value",
hostnameNames: ["EXAMPLE--Value" ],
pathRouteSetName: "EXAMPLE-pathRouteSetName-Value",
sslConfiguration: {
verifyDepth: 942,
verifyPeerCertificate: false,
hasSessionResumption: false,
trustedCertificateAuthorityIds: ["EXAMPLE--Value" ],
certificateIds: ["EXAMPLE--Value" ],
certificateName: "EXAMPLE-certificateName-Value",
protocols: ["EXAMPLE--Value" ],
cipherSuiteName: "EXAMPLE-cipherSuiteName-Value",
serverOrderPreference: loadbalancer.models.SSLConfigurationDetails.ServerOrderPreference.Enabled,
}
,
connectionConfiguration: {
idleTimeout: 838,
backendTcpProxyProtocolVersion: 1,
backendTcpProxyProtocolOptions: [loadbalancer.models.ConnectionConfiguration.BackendTcpProxyProtocolOptions.Pp2TypeAuthority ],
}
,
routingPolicyName: "EXAMPLE-routingPolicyName-Value",
ruleSetNames: ["EXAMPLE--Value" ],
}
},
hostnames: {
EXAMPLE_KEY_LEB1l :{
name: "EXAMPLE-name-Value",
hostname: "EXAMPLE-hostname-Value",
}
},
backendSets: {
EXAMPLE_KEY_nHUV3 :{
policy: "EXAMPLE-policy-Value",
backends: [{
ipAddress: "EXAMPLE-ipAddress-Value",
port: 3096,
weight: 473,
maxConnections: 60362,
backup: false,
drain: false,
offline: false,
}
],
backendMaxConnections: 22437,
healthChecker: {
protocol: "EXAMPLE-protocol-Value",
urlPath: "EXAMPLE-urlPath-Value",
port: 38071,
returnCode: 17,
retries: 597,
timeoutInMillis: 548677,
intervalInMillis: 1569037,
responseBodyRegex: "EXAMPLE-responseBodyRegex-Value",
isForcePlainText: false,
}
,
sslConfiguration: {
verifyDepth: 843,
verifyPeerCertificate: true,
hasSessionResumption: true,
trustedCertificateAuthorityIds: ["EXAMPLE--Value" ],
certificateIds: ["EXAMPLE--Value" ],
certificateName: "EXAMPLE-certificateName-Value",
protocols: ["EXAMPLE--Value" ],
cipherSuiteName: "EXAMPLE-cipherSuiteName-Value",
serverOrderPreference: loadbalancer.models.SSLConfigurationDetails.ServerOrderPreference.Enabled,
}
,
sessionPersistenceConfiguration: {
cookieName: "EXAMPLE-cookieName-Value",
disableFallback: true,
}
,
lbCookieSessionPersistenceConfiguration: {
cookieName: "EXAMPLE-cookieName-Value",
disableFallback: false,
domain: "EXAMPLE-domain-Value",
path: "EXAMPLE-path-Value",
maxAgeInSeconds: 71,
isSecure: true,
isHttpOnly: false,
}
,
}
},
networkSecurityGroupIds: ["EXAMPLE--Value" ],
subnetIds: ["EXAMPLE--Value" ],
certificates: {
EXAMPLE_KEY_Xvoz2 :{
passphrase: "EXAMPLE-passphrase-Value",
privateKey: "EXAMPLE-privateKey-Value",
publicCertificate: "EXAMPLE-publicCertificate-Value",
caCertificate: "EXAMPLE-caCertificate-Value",
certificateName: "EXAMPLE-certificateName-Value",
}
},
sslCipherSuites: {
EXAMPLE_KEY_VkEy1 :{
name: "EXAMPLE-name-Value",
ciphers: ["EXAMPLE--Value" ],
}
},
pathRouteSets: {
EXAMPLE_KEY_1mnoQ :{
pathRoutes: [{
path: "EXAMPLE-path-Value",
pathMatchType: {
matchType: loadbalancer.models.PathMatchType.MatchType.ExactMatch,
}
,
backendSetName: "EXAMPLE-backendSetName-Value",
}
],
}
},
freeformTags: {
EXAMPLE_KEY_XoS0V :"EXAMPLE_VALUE_KVQCZRHB9CuHpoeVA9xB"
},
definedTags: {
EXAMPLE_KEY_DzkAS :{
EXAMPLE_KEY_Kqdqu :"EXAMPLE--Value"
}
},
securityAttributes: {
EXAMPLE_KEY_matqi :{
EXAMPLE_KEY_5FHdI :"EXAMPLE--Value"
}
},
ruleSets: {
EXAMPLE_KEY_E1w5v :{
items: [{
action: "REMOVE_HTTP_RESPONSE_HEADER", header: "EXAMPLE-header-Value"
}
],
}
},
}
const createLoadBalancerRequest: loadbalancer.requests.CreateLoadBalancerRequest = {
createLoadBalancerDetails: createLoadBalancerDetails,
opcRequestId: "DJZUZQNHVPTV8GCBHV5W<unique_ID>",
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
};
// Send request to the Client.
const createLoadBalancerResponse = await client.createLoadBalancer(createLoadBalancerRequest);
}
catch (error) {
console.log("createLoadBalancer Failed with error " + error);
}
})();