vania-janet/multiturn-rag-retrieval-data huggingface dataset:
def create_text_file(bucket_name, item_name, file_text):
print("Creating new item: {0} in bucket: {1}".format(item_name, bucket_name))
try:
cos_cli.put_object(
Bucket=bucket_name,
Key=item_name,
Body=file_text
)
print("Item: {0} created!".format(item_name))
log_done()
except ClientError as be:
log_client_error(be)
except Exception as e:
log_error("Unable to create text file: {0}".format(e))

 Delete item
def delete_item(bucket_name, item_name):
print("Deleting item: {0} from bucket: {1}".format(item_name, bucket_name))
try:
cos_cli.delete_object(
Bucket=bucket_name,
Key=item_name
)
print("Item: {0} deleted!".format(item_name))
log_done()
except ClientError as be:
log_client_error(be)
except Exception as e:
log_error("Unable to delete item: {0}".format(e))

 Delete bucket
def delete_bucket(bucket_name):
print("Deleting bucket: {0}".format(bucket_name))
try:
cos_cli.delete_bucket(Bucket=bucket_name)
print("Bucket: {0} deleted!".format(bucket_name))
log_done()
except ClientError as be:
log_client_error(be)
except Exception as e:
log_error("Unable to delete bucket: {0}".format(e))

def upload_large_file(bucket_name, item_name, file_path):
When you created a dedicated host by using the API, you can create the host in a specific dedicated host group, or you can simply specify a zone (such as us-south-1) where you want it created. If you specify a zone instead of a group, a new group is created automatically for your dedicated host.

The following request example creates a dedicated host in a specific group.

curl -X POST "$vpc_api_endpoint/v1/dedicated_hosts?version=2020-11-17&generation=2" -H "Authorization: $iam_token" -d '{
"name": "my-host",
"group": {
"id": "0076-edf611ff-0fd6-44bf-b5f3-102eeb3cf928"
},
"profile": {
"name": "mx2-host-152x1216"
}
}'

The dedicated group information is optional. If you want a dedicated group to be created for you automatically, you can omit the group information and add a zone instead.

For more information, see [Create a dedicated host](https://cloud.ibm.com/apidocs/vpccreate-dedicated-host).

For details about the $vpc_api_endpoint and $iam_token variables, see the Authentication and Endpoint URLs sections in [Virtual Private Cloud API Introduction](https://cloud.ibm.com/apidocs/vpcabout-vpc-api).





 Next steps 

When you have a dedicated host created, you can start provisioning virtual server instances on the dedicated host. For more information, see [Creating instances on dedicated hosts](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-instance-on-dh).
For more information, see [CLI prerequisites](https://cloud.ibm.com/docs/vpc?topic=vpc-set-up-environmentcli-prerequisites-setup).



* IBM Cloud CLI
* The vpc-infrastructure plug-in



2. Have an [IBM Cloud VPC created](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-a-vpc-using-cli).







 Gathering information to create a placement group in the CLI 

Ready to create a placement group? Before you can run the ibmcloud is placement-group-create command, you need to know the following information.

Gather the following required information:



Table 3. Information required to create a placement group using the CLI

 Field Value 

 Placement group details Options 
 Strategy The placement group strategy. Either host_spread or power_spread 
 Name The placement group name 
 Resource group ID The ID of the resource group 
 Resource group name The name of the resource group 









 Creating the placement group from the CLI 

You can create a placement group in your IBM Cloud VPC by using the command-line interface (CLI).

To create a placement group by using the CLI, use the ibmcloud is placement-group-create command. Specify the placement group strategy for the placement group, the name of the placement group, the resource group ID, and the name of the resource group.

The following example creates a placement group with a host spread strategy, named MyPlacementGroup, with resource group ID RESOURCE_GROUP_ID, and a resource group name of RESOURCE_GROUP_NAME.

ibmcloud is placement-group-create --strategy host_spread --name MyPlacementGroup --resource-group-id RESOURCE_GROUP_ID --resource-group-name RESOURCE_GROUP_NAME





 Creating a placement group with the API 

You can create a placement group in your IBM Cloud VPC by using the API.

A placement group must be created first before an instance can use it. After a placement group is created, an instance can be attached to it during provisioning.
Creating key: 'my-base64-root-key', in instance: '390086ac-76fa-4094-8cf3-c0829bd69526'...
OK
Key ID Key Name
5f9eef2d-53b4-42e8-8b56-c2970255210a my-base64-root-key





 Example 4 

Create a root key using an import token.

 create an import token that expires in 5 minutes and allows 10 retrievals
$ ibmcloud kp import-token create -e 300 -m 10

 create a random, base64-encoded, 32-byte key material
$ KEY_MATERIAL=$(openssl rand -base64 32)

 extract the nonce that was created by the "kp import-token create" command
$ NONCE=$(ibmcloud kp import-token show | jq -r '.["nonce"]')

 extract the public key that was created by the "kp import-token create" command
$ PUBLIC_KEY=$(ibmcloud kp import-token show | jq -r '.["payload"]')

 encrypt the key material using the public key
$ ibmcloud kp import-token key-encrypt -k $KEY_MATERIAL -p $PUBLIC_KEY

Encrypted Key
qT1pyiS1Sivbmmt4doTtfZC4XuLazk7u ...<redacted>... +a/6EqeAamo/9vo=

 capture the encrypted key material
$ ENCRYPTED_KEY=qT1pyiS1Sivbmmt4doTtfZC4XuLazk7u ...<redacted>... +a/6EqeAamo/9vo=

 encrypt the nonce
$ ibmcloud kp import-token nonce-encrypt -k $KEY_MATERIAL -n $NONCE

Encrypted Nonce IV
Created at: 2020-06-15T16:03:39Z
Updated at: 2020-06-15T16:03:39Z
Last Operation: Status create succeeded Message Completed create instance operation

 capture the COS instance id (GUID)
$ COS_INSTANCE_ID=4b636e74-f3ca-40bb-80b8-3bd21801ccb8

 create a Key Management Service (KMS) service instance
 "tiered-pricing" is the pricing plan and "us-south" is the region
$ KMS_NAME=my-kms-1

$ ibmcloud resource service-instance-create $KMS_NAME kms tiered-pricing us-south

Creating service instance my-kms-1 in resource group Default of account <account name> as <email address>...
OK
Service instance my-kms-1 was created.
Name: my-kms-1
ID: crn:v1:bluemix:public:kms:us-south:a/ea998d3389c3473aa0987652b46fb146:b3933ab0-d579-46fc-8ed5-351aea657b9a::
GUID: b3933ab0-d579-46fc-8ed5-351aea657b9a
Location: us-south
State: active
Type: service_instance
Sub Type: kms
Allow Cleanup: false
Locked: false
Created at: 2020-06-15T16:04:40Z
Updated at: 2020-06-15T16:04:40Z
Last Operation: Status create succeeded Message Completed create instance operation

 capture the Key Protect (KP) instance id (GUID)
$ KP_INSTANCE_ID=b3933ab0-d579-46fc-8ed5-351aea657b9a

 create a policy for COS to read KMS; source is COS, target is KMS
logdnaat.service-key.create This event is generated when an administrator creates a service key through the UI. 
 logdnaat.service-key.delete This event is generated when an administrator deletes a service key through the UI. 



The following table lists custom fields that are included in these events:



Table 15. Custom fields for service keys actions

 Custom fields Valid values Description 

 requestData.key Masked field Use this field to identify the service key that is created to export data by using the Activity Tracker export API. 
 requestData.keyType service Defines the type of key that is configured. 
 responseData.logdnaId Sample 3a941d8ert Defines the Activity Tracker ID that is associated with the Activity Tracker instance. 







 Streaming events 



Table 16. Events for streaming actions

 Action Description 

 logdnaat.streaming-configuration.validate This event is generated when you configure the connection in Activity Tracker to Event Streams. 
 logdnaat.streaming-samples.send This event is generated when sample data is sent to verify the connection. 
 logdnaat.account-streaming-setting.configure This event is generated when you start streaming. 
 logdnaat.streaming-configuration.deactivate This event is generated when you stop streaming. 
 logdnaat.streaming-logs.send This event is generated when there is a failure streaming data. 
 logdnaat.exclusion-rule.create This event is generated when an streaming exclusion rule is configured. 
 logdnaat.exclusion-rule.delete This event is generated when an streaming exclusion rule is deleted. 







 Parsing templates 



Table 17. Events for parsing templates actions

 Action Description 

 logdnaat.parsing-template.create This event is generated when an administrator creates a parsing template through the UI. 
 logdnaat.parsing-template.update This event is generated when an administrator updates a parsing template through the UI. 
 logdnaat.parsing-template.delete This event is generated when an administrator deletes a parsing template through the UI. 



The following table lists custom fields that are included in these events:



Table 18. Custom fields for parsing templates actions

 Custom fields Description
Creating a new Virtuozzo container (CLI) 



 How to create a new Virtuozzo container (CLI) 

Complete the following steps to create a new container on a Virtuozzo server.



1. Check the list of containers on your host.

[root@vztrain01 ] vzlist -a

CTID NPROC STATUS IP_ADDR HOSTNAME

1 93 running 192.168.135.58 ServiceCT

100 9 running 67.228.128.93 vztest01.softlayer.local
2. Create a container with an open ID#. The number must be higher than 100 and not already in use. In this example, use 122.

[root@vztrain01 ] vzctl create 122 --pkgset redhat-as3-minimal-x86_64 --config basic

Creating Container private area (redhat-as3-minimal-x86_64/20080630)

Container is mounted

Postcreate action done

Container is unmounted

Container private area created

Container registered succesfully

[root@vztrain01 ] vzlist -a

CTID NPROC STATUS IP_ADDR HOSTNAME

1 93 running 192.168.135.58 ServiceCT

100 9 running 67.228.128.93 vztest01.softlayer.local

122 - stopped - -
Show more



After you create a container, the VZ is in the stopped state. If you are not sure what packages are installed, you can use the vzpkgls command. This command shows you a list of installed Virtuozzo OS and application packages that are on the server. For the example, a RedHat template is used, but Virtuozzo supports several different operating systems: RedHat, CentOS, Debian, Fedora Core, and SUSE.



3. Review the default configuration for the container and make necessary changes.

[root@vztrain01 ] less /vz/private/122/ve.conf
4. Start the container.

[root@vztrain01 ] vzctl start 122
For more information, see [Gathering information to create an instance by using the CLI](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-virtual-servers&interface=cligather-info-to-create-virtual-servers-cli).





 Creating an instance on a dedicated host by using the CLI 

To create an instance on a dedicated group by using the CLI, use the ibmcloud is instance-create command. Specify the name that you want to give the instance, the VPC, the zone, the profile that you want to use for the instance, the subnet, the image ID, and the dedicated group where you want to provision the instance. The instance is provisioned on an available dedicated host within the dedicated group.

The following example command creates a dedicated host with the following parameters:



* Name: my-instance-name
* VPC: r006-e49dbfc6-03b5-4609-b680-684311be5457
* Zone: us-south-1
* Profile: mx2-2x16
* Subnet: 0076-2249dabc-8c71-4a54-bxy7-953701ca3999
* Image: r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8
* Key ID: r006-c23faac2-5983-428c-91b8-2959620e1b96
* Dedicated group 0076-edf611ff-0fd6-44bf-b5f3-102eeb3cf928
ibm_is_security_group_rule.ingress_ssh_all will be created
+ resource "ibm_is_security_group_rule" "ingress_ssh_all" {
...
}

ibm_is_subnet.subnet1 will be created
+ resource "ibm_is_subnet" "subnet1" {
...
}

ibm_is_vpc.vpc will be created
+ resource "ibm_is_vpc" "vpc" {
...
}

Plan: 6 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.





 Step 4: Executing Terraform apply 

Create the VPC infrastructure resources. Confirm the creation by entering yes when prompted.

terraform apply

Observe the [terraform.tfstate](https://developer.hashicorp.com/terraform/language/state/purpose) file that is created in your directory. Terraform state file maps your resources to your configuration and keep track of the metadata. Also improves performance for the large infrastructures.

Example output

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create

Terraform will perform the following actions:

ibm_is_floating_ip.fip1 will be created
+ resource "ibm_is_floating_ip" "fip1" {
...
}

ibm_is_instance.vsi1 will be created
+ resource "ibm_is_instance" "vsi1" {
...
}
}
If you don't already have an instance of the secrets management vault provider of your choice, create one.
* Optional. A namespace that is created by using the container registry command line. To create a namespace, type the following command from the command line:

ibmcloud cr namespace-add <my namespace>

Alternatively, you can create a namespace on the [Container Registry](https://cloud.ibm.com/registry/namespaces) page. For more information about creating a namespace in this location, see [IBM Cloud Container Registry](https://cloud.ibm.com/docs/Registry?topic=Registry-getting-startedgetting-started) service.





 Related content 



* [Getting started with Continuous Delivery](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-getting-started)
* [Getting started with clusters](https://cloud.ibm.com/docs/containers?topic=containers-getting-started)
* [Getting started with toolchains](https://cloud.ibm.com/devops/getting-started)









 Step 1: Create the toolchain 

In this step, you create a Develop a Kubernetes app toolchain. The target Kubernetes cluster is configured during the toolchain setup by using your IBM Cloud API key and your Kubernetes cluster name. You can change these settings later by updating the Delivery Pipeline configuration. Any code that is merged into the target Git repo branch is automatically built, validated, and deployed into the Kubernetes cluster.

To create a Develop a Kubernetes app toolchain, click

[!
In a paid cluster, you have the option between creating a one node ordering service (sufficient for testing purposes) and a crash fault tolerant ordering service featuring five nodes tied to a single organization. In a free cluster, you will only be able to create a single node ordering service. In this tutorial, we will show the one node ordering service.

However, just as with the peer, before we can create an ordering service, we need to create a CA to supply the identities and the MSP of our ordering service organization.

Watch the following video to learn about the process to create the ordering service's organization and the ordering service (for video tutorials on how how to create a peer and a channel, see [video series](https://developer.ibm.com/series/ibm-blockchain-platform-console-video-series/):

Video transcript

Hello everyone, and welcome to this demonstration of how to create an ordering service using the IBM blockchain platform console. if you watched our other video on how to create a peer, much of this flow will seem similar to you. You still have to create a Certificate Authority first, use it to create identities and an organization, and then finally use those identities to create the ordering service itself. Once again, this information and more is present in our series of tutorials taking you through a full end to end where you create all of the nodes and identities, create a channel, join a channel, and deploy a smart contract. By the end of this video you'll have a configuration that looks like THIS, only without the channel, which we’ll create in our next demonstration.

So let's go ahead and add that CA. We're creating a CA so we can click next here. As we did with the peer, we need to give this CA a display name. And as before, you can use whatever values you want, but we’ll call it the Ordering Service CA. We’ll give an admin identity of admin and a secret of adminpw for our CA admin. Although this identity has the same id and secret as the Org1 CA admin, it is not the same identity because it is not the same CA. Note the resource allocation box.
}
]
}

{
"name": "Example zone 1",
"description": "",
"addresses": [
{
"type": "serviceRef",
"ref": {
"service_name": "server-protect"
}
}
]
}





 Creating network zones by using the CLI 



1. To create network zones from the CLI, [install the CBR CLI plug-in](https://cloud.ibm.com/docs/account?topic=cli-cbr-plugininstall-cbr-plugin).
2. Use the cbr-zone-create command to add network locations, VPCs, and service references to network zones. For more information, see the CBR [CLI reference](https://cloud.ibm.com/docs/account?topic=cli-cbr-plugincbr-zones-cli).

To find a list of available service reference targets, run the ibmcloud cbr service-ref-targets[command](https://cloud.ibm.com/docs/account?topic=cli-cbr-plugincbr-cli-service-ref-targets-command). The service_name for VPC Infrastructure Services is is and Cloud Block Storage is server-protect.

The following example command adds the is service, referred to as "VPC Infrastructure Services" in IBM Cloud® console, to a network zone.

ibmcloud cbr zone-create --name example-zone-1 --description "Example zone 1" --service-ref service_name=is

The following example command adds the server-protect service, referred to as "Cloud Block Storage" in IBM Cloud® console, to a network zone.

ibmcloud cbr zone-create --name example-zone-1 --description "Example zone 1" --service-ref service_name=server-protect







 Creating network zones from the console 



1. Determine which resources you want to add to your allowlist.
2.
FAQs for auto scale 



 What elements do I need to create to set up auto scaling? 

If you are using IBM Cloud console, you need to create an instance template, an instance group, and if you choose the dynamic scaling method, you must create scaling policies. For more information, see [Setting up auto scale with the UI](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-auto-scale-instance-groupsetting-up-autoscale-overview). If you are using the IBM Cloud CLI or API you must also create an instance group manager. For more information, see [Setting up auto scale with the CLI](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-auto-scale-instance-groupsetting-up-auto-scale-with-the-cli).





 How much am I charged for using auto scale? 

Auto scale for VPC is free, but you are charged for the resources that you consume. For example, you are charged for virtual server instances that are created in the instance group.





 How does auto scaling work? 

You set scaling policies that define your desired average utilization for metrics like CPU, memory, and network usage. The policies that you define determine when virtual server instances are added or removed from your instance group.

Auto scale uses the following computation to determine how many instances are running at any given time:

Σ(Current average utilization of each instance)/target utilization = membership count

For more information about how it works, see [Auto Scale for VPC](https://cloud.ibm.com/docs/vpc?topic=vpc-creating-auto-scale-instance-groupauto-scale-vpc).





 What permissions do I need for using auto scale? 

You can check the required permissions for actions on instance templates, instance groups, instance group managers, memberships, and policies in the [Required permissions for VPC resources](https://cloud.ibm.com/docs/vpc?topic=vpc-resource-authorizations-required-for-api-and-cli-calls).
Copy the following PVC configuration and save it to a file called pvc.yaml. This example PVC automatically creates a bucket with a quota equal to 20Gi.

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: my-cos-pvc
namespace: default
annotations:
ibm.io/auto-create-bucket: "true"
ibm.io/auto-delete-bucket: "true"
ibm.io/secret-name: "my-cos-secret"
ibm.io/quota-limit: "true"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: ibmc-s3fs-standard-cross-region
Show more
2. Create the PVC in your cluster.

oc apply -f pvc.yaml

Example output.

persistentvolumeclaim/my-cos-pvc created
3. List your PVCs and verify the my-cos-pvc is in the Bound state.

NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
my-cos-pvc Bound pvc-64a4e0c9-b5ec-40e3-8b7e-77ff47ae6c5e 20Gi RWO ibmc-s3fs-standard-cross-region 6s
4. [Navigate to your Object Storage instance in the console](https://cloud.ibm.com/objectstorage) and click the Buckets tab.
5. Review the details of the automatically created bucket. The bucket name is in the format tmp-s3fs-XXXX.
6. Click the tmp-s3fs-XXXX bucket, then click the Configuration tab.
7. On the Configuration page, look for the Quota enforcement section. Note that the bucket was automatically created with a quota equal to the size you specified in the PVC. In this example, the value was 20Gi.







 Step 5: Uploading a file to your bucket 



1.
response = await service.accountPublishVersion({ 'versionLocId': versionLocator});
console.log(response);





 Creating a private catalog by using Terraform 

Use the following steps to create a private catalog by using Terraform.



1. Add your argument to your main.tf file. The following example creates a private catalog by using the ibm_cm_catalog resource, where label is a display name to identify the catalog.

resource "ibm_cm_catalog" "cm_catalog" {
label = "label"
short_description = "short_description"
}

For more information, see the argument reference details on the [Terraform Catalog Management](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/cm_catalog) page.
2. After you finish building your configuration file, initialize the Terraform CLI. For more information, see [Initializing Working Directories](https://www.terraform.io/cli/init).

terraform init
3. Provision the resources from the main.tf file. For more information, see [Provisioning Infrastructure with Terraform](https://www.terraform.io/cli/run).



1. Run terraform plan to generate a Terraform execution plan to preview the proposed actions.

terraform plan
2. Run terraform apply to create the resources that are defined in the plan.

terraform apply









 Importing a product to your catalog by using Terraform 

Use the following steps to import a product to your private catalog by using Terraform.



1. Add your argument to your main.tf file. The following example adds your product by using the ibm_cm_offering resource, where label is a display name to identify the product.

resource "ibm_cm_offering" "cm_offering" {
catalog_id = "catalog_id"
label = "label"
tags = [ "tags" ]
}