update_chap_credentials ( $opt )

This operation updates the Challenge-Handshake Authentication Protocol (CHAP) credentials for a specified iSCSI target. By default, a gateway does not have CHAP enabled; however, for added security, you might use it.

When you update CHAP credentials, all existing connections on the target are closed and initiators must reconnect with the new credentials.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • TargetARN - string - Required - The Amazon Resource Name (ARN) of the iSCSI volume target. Use the DescribeStorediSCSIVolumes operation to return to retrieve the TargetARN for specified VolumeARN.
  • SecretToAuthenticateInitiator - string - Required - The secret key that the initiator (e.g. Windows client) must provide to participate in mutual CHAP with the target.
  • InitiatorName - string - Required - The iSCSI initiator that connects to the target. [Constraints: The value must be between 1 and 255 characters, and must match the following regular expression pattern: [0-9a-z:.-]+]
  • SecretToAuthenticateTarget - string - Optional - The secret key that the target must provide to participate in mutual CHAP with the initiator (e.g. Windows client).
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Volumes and Snapshots

$ec2 = new AmazonEC2();
$sg = new AmazonStorageGateway();

// Get network interface ID
$response = $sg->describe_gateway_information(array('GatewayARN' => $gateway_arn));
var_dump($response->isOK());
$network_interface_id = (string) $response->body->GatewayNetworkInterfaces->Ipv4Address;

// Get local disk
$response = $sg->list_local_disks(array('GatewayARN' => $gateway_arn));
var_dump($response->isOK());
$disks = $response->body->DiskId()->map_string();
$disk_id = $disks[1];

// List iSCSI volumes
$response = $sg->list_volumes(array('GatewayARN' => $gateway_arn));
var_dump($response->isOK());

// Add iSCSI volume
$response = $sg->create_stored_iscsi_volume(array(
	'GatewayARN'           => $gateway_arn,
	'DiskId'               => $disk_id,
	'NetworkInterfaceId'   => $network_interface_id,
	'PreserveExistingData' => true,
	'TargetName'           => 'aws-sdk-php-test-volume-01',
));
var_dump($response->isOK());
$volume_arn = (string) $response->body->VolumeARN;
$target_arn = (string) $response->body->TargetARN;

// Wait until volume is available
do
{
	sleep(20); echo '.';
	$response = $sg->describe_stored_iscsi_volumes(array('VolumeARNs' => array($volume_arn)));
	$status = $response->body->VolumeStatus()->map_string();
	$status = (string) reset($status);
} while ($status !== 'AVAILABLE');

// List iSCSI volumes
$response = $sg->list_volumes(array('GatewayARN' => $gateway_arn));
var_dump($response->isOK());

// Update snapshot schedule
$response = $sg->update_snapshot_schedule(array(
	'VolumeARN'         => $volume_arn,
	'StartAt'           => 0,
	'RecurrenceInHours' => 24,
	"Description"       => 'daily snapshot',
));
var_dump($response->isOK());

// Describe snapshot schedule
$response = $sg->describe_snapshot_schedule(array(
	'VolumeARN' => $volume_arn,
));
var_dump($response->isOK());

// Update chap credentials
$response = $sg->update_chap_credentials(array(
	'TargetARN'                     => $target_arn,
	'SecretToAuthenticateInitiator' => '111111111111',
	'InitiatorName'                 => 'example-initiator',
	'SecretToAuthenticateTarget'    => '222222222222',
));
var_dump($response->isOK());

// Describe chap credentials
$response = $sg->describe_chap_credentials(array(
	'TargetARN' => $target_arn,
));
var_dump($response->isOK());

// Delete chap credentials
$response = $sg->delete_chap_credentials(array(
	'TargetARN'     => $target_arn,
	'InitiatorName' => 'example-initiator',
));
var_dump($response->isOK());

// Delete iSCSI volume
$response = $sg->delete_volume(array(
	'VolumeARN'  => $volume_arn,
));
var_dump($response->isOK());

// List iSCSI volumes
$response = $sg->list_volumes(array('GatewayARN' => $gateway_arn));
var_dump($response->isOK());

Source

Method defined in services/storagegateway.class.php | Toggle source view (6 lines) | View on GitHub

public function update_chap_credentials($opt = null)
{
    if (!$opt) $opt = array();
    
    return $this->authenticate('UpdateChapCredentials', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback