vania-janet/multiturn-rag-retrieval-data huggingface dataset:
Creating resources by using the CLI 

You can create a resource by using the IBM Cloud® Command Line Interface. For detailed information about working with resources, see [Working with resources and resource groups](https://cloud.ibm.com/docs/cli?topic=cli-ibmcloud_commands_resource).



1. Log in, and select the account.

ibmcloud login
2. Create an organization by running the [ibmcloud resource service-instance-create](https://cloud.ibm.com/docs/cli?topic=cli-ibmcloud_commands_resourceibmcloud_resource_service_instance_create) command.



In this command,NAME is the name of the service instance, SERVICE_NAME or SERVICE_ID is the name or ID of the service, SERVICE_PLAN_NAME or SERVICE_PLAN_IDis the name or ID of the service plan, and LOCATIONis the target location or environment to create the service instance.

ibmcloud resource service-instance-create NAME (SERVICE_NAME | SERVICE_ID) SERVICE_PLAN_NAME LOCATION [-d, --deployment DEPLOYMENT_NAME] [-p, --parameters @JSON_FILE | JSON_STRING ] [-g RESOURCE_GROUP] [--service-endpoints SERVICE_ENDPOINTS_TYPE] [--allow-cleanup] [--lock]

To list services, use the [ibmcloud catalog service-marketplace](https://cloud.ibm.com/docs/cli/reference/ibmcloud?topic=cli-ibmcloud_catalogibmcloud_catalog_service_marketplace) command.

For example, the following command creates a service instance that is named my-service-instance, uses service plan test- service-plan of service test-service on location eu-gb:

ibmcloud resource service-instance-create my-service-instance test-service test-service-plan eu-gb





 Creating new resource instances by using the API 

You can programmatically create a new resource instance by calling the Resource Controller API as shown in the following sample request.
Create a key ring within a kp instance.



 Example 

The example shows the use of the CLI plugin to create a key ring in the given instance.

ibmcloud kp key-ring create KEY_RING_ID -i <INSTANCE_ID>





 Required parameters 



* KEY_RING_ID

The alphanumeric reference longer than or equal to 2 characters and fewer than or equal to 100 for the key ring.
* -i, --instance-ID

The IBM Cloud instance ID that identifies your Key Protect instance.

You can set an environment variable instead of specifying -i with the following command: $ export KP_INSTANCE_ID=<INSTANCE_ID>.









 kp key-ring delete 

Delete a key ring within a kp instance.



 Example 

The example shows the use of the CLI plugin to delete a key ring in the given instance.

ibmcloud kp key-ring delete KEY_RING_ID -i <INSTANCE_ID>





 Required parameters 



* KEY_RING_ID

The alphanumeric reference longer than or equal to 2 characters and fewer than or equal to 100 for the key ring.
* -i, --instance-ID

The IBM Cloud instance ID that identifies your Key Protect instance.

You can set an environment variable instead of specifying -i with the following command: $ export KP_INSTANCE_ID=<INSTANCE_ID>.









 kp key rotate 

[Rotate a root key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-rotate-keys) that is stored in your Key Protect service.

When you rotate your root key, you replace the key with a new key material.

If Key Protect created the key (the key was not created with the -k parameter) then Key Protect creates a new key. You cannot specify kp key rotate with the -k parameter.

If you created a key and provided the key material ( kp key create key-name -k $KEY_MATERIAL) then you must provide a new key material when you rotate the key (kp key rotate $KEY_ID_OR_ALIAS -k $NEW_KEY_MATERIAL)
[Sample basic network structure](https://cloud.ibm.com/docs-content/v1/content/c5288bed34c3820e3a5251d820ee91adcd2591a3/blockchain/images/ibp-v2-build-network.svg)

Figure 1. Sample basic network structure

This configuration is sufficient both for testing applications and smart contracts and as a guide for building components and joining production networks that will suit your own use case. The network contains the following components:



* Two peer organizations: Org1 and Org2
The tutorial series describe how to create two peer organizations and two associated peers. Think of organizations on a blockchain network to be like two different banks that need to transact with each other. We will create the definitions of Org1 and Org2.
* One ordering service organization: Ordering Service
Because we are building a distributed ledger, the peers and ordering service should be part of separate organizations. Therefore, a separate organization is created for the ordering service. Among other things, an ordering service orders the blocks of transactions that are sent to the peers to be written to their ledgers and become the blockchain. We will create the definition of the Ordering Service organization.
* Three Certificate Authorities (CAs): Org1 CA, Org2 CA, Ordering Service CA
A CA is the node that issues certificates to both the users and the nodes associated with an organization. Because it’s a best practice to deploy one CA per organization, we will deploy three CAs in total: one for each peer organization and one for the ordering service organization. These CAs will also create the definition of each organization, which is encapsulated by a Membership Service Provider (MSP). A TLS CA is automatically deployed together with each organization CA and provides the TLS certificates that are used for communication between nodes. For more information, see [Using your TLS CA](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ibp-console-identitiesibp-console-identities-tlsca).
[Build the configuration file](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ibp-v2-apisibp-v2-apis-config) that is required to create an ordering service or peer. You must build a unique configuration file for each ordering service or peer that you want to create. If you are deploying multiple ordering nodes, you need to provide a configuration file for each node that you want to create.
5. Create an ordering service by calling [POST /ak/api/v2/kubernetes/components/orderer](https://cloud.ibm.com/apidocs/blockchaincreate-an-ordering-service).
6. Create a peer by calling [POST /ak/api/v2/kubernetes/components/peer](https://cloud.ibm.com/apidocs/blockchaincreate-a-peer).
7. If you want to use the console to operate your blockchain components, you must import your administrator identity into your console wallet. Use the wallet tab to import the certificate and private key of your node admin into the console and create an identity. You then need to use the console to associate this identity with the components you created. For more information, see [Importing an admin identity into the IBM Blockchain Platform console](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ibp-v2-apisibp-v2-apis-admin-console).
8. After you deploy your network, you can use the Fabric SDKs, the Peer CLI, or the console UI to create channels and deploy smart contracts. If you need to programmatically create a channel, you must provide the consortium name. For IBM® Blockchain Platform, the consortium name must be set to SampleConsortium.



The service credential that is used for API authentication must have the Manager role in IAM to be able to create components.
If Key Protect created the key (the key was not created with the -k parameter) then Key Protect creates a new key. You cannot specify kp key rotate with the -k parameter.

If you created a key and provided the key material ( kp key create key-name -k $KEY_MATERIAL) then you must provide a new key material when you rotate the key (kp key rotate $KEY_ID_OR_ALIAS -k $NEW_KEY_MATERIAL)

You cannot rotate a standard key, that is, a key created using the kp create key-name --standard-key command.

ibmcloud kp key rotate KEY_ID_OR_ALIAS
-i, --instance-id INSTANCE_ID
[--key-ring KEY_RING_ID]
[-k, --key-material KEY_MATERIAL]



 Examples 

These are examples of kp key rotate.



 Example 1 

Rotate a root key.

 create a root key
$ ibmcloud kp key create my-root-key

Creating key: 'my-root-key', in instance: '390086ac-76fa-4094-8cf3-c0829bd69526'...
OK
Key ID Key Name
1a6d5be8-287c-4eb3-9c44-cf0c2b0d67ad my-root-key

 rotate the key
$ ibmcloud kp key rotate 1a6d5be8-287c-4eb3-9c44-cf0c2b0d67ad

Rotating root key...
OK

 show key details
$ ibmcloud kp key show 1a6d5be8-287c-4eb3-9c44-cf0c2b0d67ad

Grabbing info for key id: 1a6d5be8-287c-4eb3-9c44-cf0c2b0d67ad...
OK
Key ID Key Name Description Creation Date Expiration Date
* [Create a project](https://cloud.ibm.com/docs/codeengine?topic=codeengine-manage-project).
* [Create a job](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-job-create). For example, create a job that is called myjob that uses the icr.io/codeengine/codeengine image. This image is built from codeengine.go, available from the [Samples for IBM Cloud Code Engine GitHub repo](https://github.com/IBM/CodeEngine).



ibmcloud ce job create --name myjob --image icr.io/codeengine/codeengine

To connect your job to the Periodic timer (cron) subscription with the CLI by using the [ibmcloud ce sub cron create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-subscription-cron-create) command.

ibmcloud ce sub cron create --name NAME --destination-type job --destination JOB_NAME --schedule CRON

For example, to create a cron subscription that sends an event to a job called myjob every 5 minutes,

ibmcloud ce sub cron create --name mycronevent --destination-type job --destination myjob --schedule '/5 * * * ' --data '{ "message": "Hello world!" }' --content-type application/json

You must wrap the schedule value in quotation marks to ensure that it is treated as a single string.

The following table summarizes the options that are used with the sub cron create command in this example. For more information about the command and its options, see the [ibmcloud ce subscription cron create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-subscription-cron-create) command.



Table 1. Command options

 Option Description 

 --name The name of the cron event source.
* UI
* CLI







 Creating an instance template 

You can create an instance template to define instance details for provisioning one or more virtual servers. When your instance template is created, you can use it to provision single virtual server instances, or you can provision multiple instances at the same time as part of an instance group.



 Creating an instance template with the UI 

The instance template defines the details of the virtual server instances that are created from the template. For example, specify the profile (vCPU and memory), image, attached volumes, and network interfaces for the image template.

To create an instance template, complete the following steps.



1. In the [IBM Cloud console)](https://cloud.ibm.com/login), go to menu icon ![menu icon](https://cloud.ibm.com/docs-content/v1/content/f02b9c9adcbb7328d95a45e105cec371d50f15eb/icons/icon_hamburger.svg) > VPC Infrastructure > Auto scale > Instance templates.
2. Click New instance template and enter the information in Table 1.
3. Click Create instance template when the information is complete.



When you create an instance template, validation steps are performed that ensure you can use your template to provision a virtual server instance.



Table 1. Instance template selections

 Field Value 

 Architecture Select the processor architecture that your instance is created with. x86 means x86_64 bit processor, and s390x is z Systems or LinuxONE (s390x processor architecture). 
 Hosting type A Public virtual server instance, created in a multi-tenant environment, is the default selection for a new instance. You can also select a Dedicated virtual server instance to create the instance in a single-tenant space. To provision a dedicated instance, you must have a dedicated host available or [create one](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-dedicated-hosts-instances). z/OS virtual server instances do not support the dedicated type.
[Look up the ID of the resource group](https://cloud.ibm.com/apidocs/resource-controller/resource-managerlist-resource-groups) in which you want to create your instance.
3. Choose the region in which you want to create your instance.
4. [Look up the ID of the service plan](https://globalcatalog.cloud.ibm.com/search?q=continuous-delivery) of the instance that you want to create.
5. Create an instance of Continuous Delivery within the targeted account, region, and resource group.



* Curl
* Java
* Node
* Python
* Go



curl -X POST https://resource-controller.cloud.ibm.com/v2/resource_instances -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{
"name": "{instance_name}",
"target": "{region}",
"resource_group": "{resource_group_id}",
"resource_plan_id": "{plan_id}"
"parameters": "{parameters}"
}'

import com.ibm.cloud.platform_services.resource_controller.v2.ResourceController;
import com.ibm.cloud.platform_services.resource_controller.v2.model.;
...
ResourceController resourceControllerService = ResourceController.newInstance();
CreateResourceInstanceOptions createCdInstanceOptions = new CreateResourceInstanceOptions.Builder()
.name({instance_name})
.target({region})
.resourceGroup({resource_group_id})
.resourcePlanId({plan_id})
.build();
Response<ResourceInstance> response = resourceControllerService.createResourceInstance(createCdInstanceOptions).execute();
ResourceInstance cdInstance = response.getResult();
_cos.createBucket(bucketName);
System.out.printf("Bucket: %s created!n", bucketName);
}



 Create a bucket with a different storage class 

A list of valid provisioning codes for LocationConstraint can be referenced in [the Storage Classes guide](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-classesclasses).

cos.createBucket("sample", "us-vault"); // the name of the bucket, and the storage class (LocationConstraint)

SDK References



* [createBucket](https://ibm.github.io/ibm-cos-sdk-java/com/ibm/cloud/objectstorage/services/s3/AmazonS3.htmlcreateBucket-java.lang.String-)









 Creating a new text file 

public static void createTextFile(String bucketName, String itemName, String fileText) {
System.out.printf("Creating new item: %sn", itemName);

byte[] arr = fileText.getBytes(StandardCharsets.UTF_8);
InputStream newStream = new ByteArrayInputStream(arr);

ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(arr.length);

PutObjectRequest req = new PutObjectRequest(bucketName, itemName, newStream, metadata);
_cos.putObject(req);

System.out.printf("Item: %s created!n", itemName);
}

Note that when adding custom metadata to an object, it is necessary to create an ObjectMetadata object by using the SDK, and not to manually send a custom header containing x-amz-meta-{key}. The latter can cause issues when authenticating by using HMAC credentials.





 Upload object from a file 

This example assumes that the bucket sample exists.

cos.putObject(
* git to clone source code repository.



You will find instructions to download and install these tools for your operating environment in the [Getting started with solution tutorials](https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-tutorials) guide.

In addition: A minimal cluster with one (1) zone, one (1) worker node and the smallest available size (Flavor) is sufficient for this tutorial.

Open the [Kubernetes clusters](https://cloud.ibm.com/kubernetes/clusters) and click Create cluster. See the documentation referenced below for more details based on the cluster type. Summary:



* Click Standard tier cluster
* For Kubernetes on VPC infrastructure see reference documentation [Creating VPC clusters](https://cloud.ibm.com/docs/containers?topic=containers-cluster-create-vpc-gen2&interface=ui).



* Click Create VPC:



* Enter a name for the VPC.
* Chose the same resource group as the cluster.
* Click Create.



* Attach a Public Gateway to each of the subnets that you create:



* Navigate to the [Virtual private clouds](https://cloud.ibm.com/vpc-ext/network/vpcs).
* Click the previously created VPC used for the cluster.
* Scroll down to subnets section and click a subnet.
* In the Public Gateway section, click Detached to change the state to Attached.
* Click the browser back button to return to the VPC details page.
* Repeat the previous three steps to attach a public gateway to each subnet.





* For Kubernetes on Classic infrastructure see reference documentation [Creating classic cluster](https://cloud.ibm.com/docs/containers?topic=containers-cluster-create-classic&interface=ui).
* Choose a resource group.
* Uncheck all zones except one.
* Scale down to 1 Worker nodes per zone.
* Choose the smallest Worker Pool flavor.
* Enter a Cluster name.
* Click Create.







 Step 1: Deploy a dynamic web application to be accelerated
Create the Org2 Membership Services Provider (MSP) definition which defines the organization Org2.
* One peerPeer Org2
The ledger, Ledger x in the illustration above, is maintained by distributed peers. The peer is deployed with [Couch DB](https://hyperledger-fabric.readthedocs.io/en/release-2.2/couchdb_as_state_database.html) as the state database.
* One Certificate Authority (CA)Org2 CA A CA is the node that issues certificates to all organization admins as well as to nodes associated with an organization. We will create one CA for the peer organization Org2.
* Joining one channel The tutorial describes how to join the channel that was created by the [Build a network tutorial](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ibp-console-build-networkibp-console-build-network).



Throughout this tutorial we supply recommended values for some of the fields in the console. This allows the names and identities to be easier to recognize in the tabs and drop-down lists. These values are not mandatory, but you will find them helpful, especially since you will have to remember certain values, especially the IDs and secrets of registered users, you input at a previous step. If you forget these values, you will have to register additional users for your admins and components. We provide a table of the recommended values after each task and recommend that if you do not use sample values that you record the values you do use somewhere as you proceed through the tutorial.





 Step one: Create a peer organization and a peer 

For each organization that you want to create with the console, you should deploy at least one CA. A CA is the node that issues certificates to all network participants (peers, ordering services, clients, admins, and so on). These certificates, which include a signing certificate and private key, allow network participants to communicate, authenticate, and ultimately transact. These CAs will create all of the identities and certificates that belong to your organization, in addition to defining the organization itself. You can then use those identities to deploy nodes, create admin identities, and submit transactions.
For detailed information about how to use it, see [Create a Space](http://v3-apidocs.cloudfoundry.org/version/3.97.0/index.htmlcreate-a-space). Check the following sample request, where my-spaceis the name of your space:

curl "https://api.example.org/v3/spaces" -X POST -H "Authorization: bearer [token]" -H "Content-Type: application/json" -d '{
"name": "my-space",
"relationships": {
"organization": {
"data": {
"guid": "[org-guid]"
}
}
}
}'
Create a bucket with a storage class 



* Java
* Python
* Go
* Node



public static void createBucket(String bucketName) {
System.out.printf("Creating new bucket: %sn", bucketName);
_cos.createBucket(bucketName, "us-vault");
System.out.printf("Bucket: %s created!n", bucketName);
}

def create_bucket(bucket_name):
print("Creating new bucket: {0}".format(bucket_name))
try:
cos.Bucket(bucket_name).create(
CreateBucketConfiguration={
"LocationConstraint":COS_BUCKET_LOCATION
}
)
print("Bucket: {0} created!".format(bucket_name))
except ClientError as be:
print("CLIENT ERROR: {0}n".format(be))
except Exception as e:
print("Unable to create bucket: {0}".format(e))

func main() {

// Create client
sess := session.Must(session.NewSession())
client := s3.New(sess, conf)

// Bucket Names
newBucket := "<NEW_BUCKET_NAME>"

input := &s3.CreateBucketInput{
Bucket: aws.String(newBucket),
CreateBucketConfiguration: &s3.CreateBucketConfiguration{
LocationConstraint: aws.String("us-cold"),
},
}
client.CreateBucket(input)

d, _ := client.ListBuckets(&s3.ListBucketsInput{})
fmt.Println(d)
}

function createBucket(bucketName) {
console.log(Creating new bucket: ${bucketName});
return cos.createBucket({
Bucket: bucketName,
[kp create](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-create-039) Create a key 
 [kp list](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-list-039) Retrieve a list of keys 
 [kp get](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-get-039) Retrieve a key 
 [kp wrap](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-wrap-039) Wrap a data encryption key 
 [kp unwrap](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-unwrap-039) Unwrap a data encryption key 
 [kp rotate](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-rotate-039) Rotate a root key 
 [kp delete](https://cloud.ibm.com/docs/key-protect?topic=key-protect-cli-reference-039kp-delete-039) Delete a key 







 kp create 

[Create a root key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-create-root-keys) in the Key Protect instance that you specify.

ibmcloud kp create KEY_NAME -i $INSTANCE_ID
[-k, --key-material KEY_MATERIAL]
[-s, --standard-key]
[--output FORMAT]



 Required parameters 

KEY_NAME
: A unique, human-readable alias to assign to your key.





 Optional parameters 

-k, --key-material
: Enter the namespace where you want to create your secret. To reference the secret in your PVC, the PVC must be created in the same namespace.

encrypted
: In the string data section, enter true to create a secret that sets up encryption for Block Storage for Classic volumes. If you set this option to true, you must provide the root key CRN of your Key Protect service instance that you want to use in parameters.encryptionKey. For more information about encrypting your data, see [Setting up encryption](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-blockvpc-block-encryption) for your Block Storage for VPC.

encryptionKey
: In the data section, if you entered truefor parameters.encrypted, then enter the root key CRN of your Key Protect service instance that you want to use to encrypt your Block Storage for Classic volume. To use your root key CRN in a secret, you must first convert it to base 64 by running echo -n "<root_key_CRN>" | base64. For more information about encrypting your data, see [Setting up encryption for your Block Storage for VPC](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-blockvpc-block-encryption).
2. Create the Kubernetes secret.

oc apply -f secret.yaml
3. Follow the steps to [create a customized storage class](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-blockvpc-customize-storage-class). In the customized storage class YAML file, reference the Kubernetes secret in the metadata.parameters section as follows. Make sure to enter the name of the Kubernetes secret that you created earlier and the namespace where you created the secret.

csi.storage.k8s.io/provisioner-secret-name: <secret_name>
csi.storage.k8s.io/provisioner-secret-namespace: <secret_namespace>