コード例 #1
0
ファイル: create.go プロジェクト: smashwilson/rack
func (command *commandCreate) Execute(resource *handler.Resource) {
	opts := resource.Params.(*paramsCreate).opts
	snapshot, err := osSnapshots.Create(command.Ctx.ServiceClient, opts).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = snapshotSingle(snapshot)
}
コード例 #2
0
ファイル: create.go プロジェクト: satyamkotakonda/rack
func (command *commandCreate) Execute(resource *handler.Resource) {
	opts := resource.Params.(*paramsCreate).opts
	snapshot, err := osSnapshots.Create(command.Ctx.ServiceClient, opts).Extract()
	if err != nil {
		resource.Err = err
		return
	}

	if resource.Params.(*paramsCreate).wait {
		err = osSnapshots.WaitForStatus(command.Ctx.ServiceClient, snapshot.ID, "available", 600)
		if err != nil {
			resource.Err = err
			return
		}

		snapshot, err = osSnapshots.Get(command.Ctx.ServiceClient, snapshot.ID).Extract()
		if err != nil {
			resource.Err = err
			return
		}
	}

	resource.Result = snapshotSingle(snapshot)
}
コード例 #3
0
ファイル: delegate.go プロジェクト: satyamkotakonda/rack
// Create will create a new Snapshot based on the values in CreateOpts. To
// extract the Snapshot object from the response, call the Extract method on the
// CreateResult.
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
	return CreateResult{os.Create(client, opts)}
}