nifty-cloud-sdk 1.8.beta1 → 1.9.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -1
- data/lib/NIFTY/Cloud/instances.rb +56 -2
- data/lib/NIFTY/Cloud/load_balancers.rb +178 -0
- data/lib/NIFTY/Cloud/resources.rb +90 -0
- data/lib/NIFTY/Cloud/security_groups.rb +59 -4
- data/lib/NIFTY/Cloud/uploads.rb +51 -0
- data/lib/NIFTY/version.rb +1 -1
- data/test/test_Cloud_instances.rb +132 -1
- data/test/test_Cloud_load_balancers.rb +356 -0
- data/test/test_Cloud_resources.rb +648 -0
- data/test/test_Cloud_security_groups.rb +141 -2
- data/test/test_Cloud_uploads.rb +105 -0
- metadata +10 -4
data/CHANGELOG
CHANGED
|
@@ -35,12 +35,13 @@ API Version.1.8 対応
|
|
|
35
35
|
- run_instances で Windows のイメージ ID が指定された場合のみ :password を必須とみなすようにする (see #13)
|
|
36
36
|
|
|
37
37
|
* lib/NIFTY/config.rb
|
|
38
|
+
* README.rdoc
|
|
38
39
|
- デフォルトの API エンドポイントを https://cp.cloud.nifty.com/api/1.7/ から https://cp.cloud.nifty.com/api/ へ変更する (see #14)
|
|
39
40
|
|
|
40
41
|
* test/test_*.rb
|
|
41
42
|
- テストコードにマジックコメントでスクリプトエンコーディングを指定する (see #16)
|
|
42
43
|
|
|
43
|
-
* lib/NIFTY/version.rb
|
|
44
|
+
* lib/NIFTY/version.rb
|
|
44
45
|
- VERSIONを変更
|
|
45
46
|
|
|
46
47
|
|
|
@@ -9,7 +9,7 @@ module NIFTY
|
|
|
9
9
|
INSTANCES_DESCRIBE_ATTRIBUTE = [
|
|
10
10
|
'instanceType', 'disableApiTermination', 'blockDeviceMapping', 'accountingType', 'nextMonthAccountingType',
|
|
11
11
|
'loadbalancing', 'copyInfo', 'autoscaling', 'ipType', 'groupId', 'description']
|
|
12
|
-
INSTANCES_MODIFY_ATTRIBUTE = ['instanceType', 'disableApiTermination', 'instanceName', 'description', 'ipType', 'groupId']
|
|
12
|
+
INSTANCES_MODIFY_ATTRIBUTE = ['instanceType', 'disableApiTermination', 'instanceName', 'description', 'ipType', 'groupId', 'accountingType']
|
|
13
13
|
INSTANCES_IGNORED_PARAMS = Regexp.union(/MinCount/,
|
|
14
14
|
/MaxCount/,
|
|
15
15
|
/AddisionalInfo/,
|
|
@@ -74,12 +74,14 @@ module NIFTY
|
|
|
74
74
|
# @option options [String] :instance_id サーバー名(必須)
|
|
75
75
|
# @option options [String] :attribute 更新対象の項目名(必須)
|
|
76
76
|
# 許可値: instanceType(サーバータイプを更新) | disableApiTermination(API からのサーバー削除可否を更新) | instanceName(サーバー名を更新) |
|
|
77
|
-
# description(メモ情報を更新) | ipType(IP アドレスの固定化タイプを更新) | groupId(ファイアウォールグループを更新)
|
|
77
|
+
# description(メモ情報を更新) | ipType(IP アドレスの固定化タイプを更新) | groupId(ファイアウォールグループを更新) |
|
|
78
|
+
# accountingType(利用料金タイプを更新)
|
|
78
79
|
#
|
|
79
80
|
# @option options [String] :value 更新値(必須)
|
|
80
81
|
# 許可値: (:attribute= instanceType) mini | small | small2 | small4 | small8 | medium | medium4 | medium8 | medium16 | large | large8 | large16 | large24 | large32 | extra-large16 | extra-large24 | extra-large32
|
|
81
82
|
# (:attribute= disableApiTermination) true | false
|
|
82
83
|
# (:attribute= ipType) static | dynamic | none
|
|
84
|
+
# (:attribute= accountingType) 1(月額課金) | 2(従量課金)
|
|
83
85
|
# @return [Hash] レスポンスXML解析結果
|
|
84
86
|
#
|
|
85
87
|
# @example
|
|
@@ -93,6 +95,7 @@ module NIFTY
|
|
|
93
95
|
raise ArgumentError, "Invalid :value provided." if options[:attribute] == 'instanceType' && !INSTANCE_TYPE.include?(options[:value].to_s)
|
|
94
96
|
raise ArgumentError, "Invalid :value provided." if options[:attribute] == 'disableApiTermination' && !BOOLEAN.include?(options[:value].to_s)
|
|
95
97
|
raise ArgumentError, "Invalid :value provided." if options[:attribute] == 'ipType' && !IP_TYPE.include?(options[:value].to_s)
|
|
98
|
+
raise ArgumentError, "Invalid :value provided." if options[:attribute] == 'accountingType' && !ACCOUNTING_TYPE.include?(options[:value].to_s)
|
|
96
99
|
|
|
97
100
|
params = {'Action' => 'ModifyInstanceAttribute'}
|
|
98
101
|
params.merge!(opts_to_prms(options, [:instance_id, :attribute, :value]))
|
|
@@ -386,6 +389,57 @@ module NIFTY
|
|
|
386
389
|
|
|
387
390
|
return response_generator(params)
|
|
388
391
|
end
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
# API「ImportInstances」を実行し、指定したOVFファイルの情報に基づいて、サーバーインポートを予約します。
|
|
395
|
+
# 1回のリクエストで1台のサーバーが予約可能です。
|
|
396
|
+
#
|
|
397
|
+
# イメージ(VMDKファイル)は、別途アップロード領域へアップロードしてください(このAPIのレスポンスに含まれるタスクIDを指定します)。
|
|
398
|
+
#
|
|
399
|
+
# サーバーの作成には、時間がかかることがあります。
|
|
400
|
+
# API「DescribeInstances」のレスポンス値「instanceState」でサーバーのステータスを確認できます。
|
|
401
|
+
#
|
|
402
|
+
# インポートしたサーバーは通常ほかのサーバー作成と同様に課金されますが、ニフティクラウドの基本ディスク容量(Linux:30GB、Windows:40GB)を超えるディスクを持つ場合は100GB単位で追加料金が発生します。
|
|
403
|
+
#
|
|
404
|
+
# ニフティクラウドがサポートしないOS製品である、複数OSのサーバーであるなどの場合はインポートできず、エラーが返されます。
|
|
405
|
+
#
|
|
406
|
+
# インポートしたサーバーは、APIからの削除が可能です。
|
|
407
|
+
# APIからの削除を禁止したい場合は、インポート完了後にAPI「ModifyInstanceAttribute」を実行してください。
|
|
408
|
+
#
|
|
409
|
+
# @option options [Array<String>] :security_group 適用するファイアフォールグループ名
|
|
410
|
+
# @option options [String] :instance_type サーバータイプ
|
|
411
|
+
# 許可値: mini | small | small2 | small4 | small8 | medium | medium4 | medium8 | medium16 | large | large8 | large16 | large24 | large32 | extra-large16 | extra-large24 | extra-large32
|
|
412
|
+
# @option options [String] :availability_zone
|
|
413
|
+
# @option options [Boolean] :disable_api_termination APIからのサーバー削除の可否
|
|
414
|
+
# 許可値: true(削除不可) | false(削除可)
|
|
415
|
+
# @option options [String] :instance_id サーバー名
|
|
416
|
+
# @option options [String] :ovf OVFデータ
|
|
417
|
+
# @option options [String] :accounting_type 利用料金タイプ
|
|
418
|
+
# 許可値: 1(月額課金) | 2(従量課金)
|
|
419
|
+
# @option options [String] :ip_type IPアドレスタイプ
|
|
420
|
+
# 許可値: static | dynamic | none
|
|
421
|
+
# @return [Hash] レスポンスXML解析結果
|
|
422
|
+
#
|
|
423
|
+
# @example
|
|
424
|
+
# cancel_copy_instances(:instance_id => 'server01')
|
|
425
|
+
#
|
|
426
|
+
def import_instance( options={} )
|
|
427
|
+
raise ArgumentError, "No :ovf provided." if blank?(options[:ovf])
|
|
428
|
+
#raise ArgumentError, "No :security_group provided." if blank?(options[:security_group])
|
|
429
|
+
raise ArgumentError, "Invalid :security_group provided." unless blank?(options[:security_group]) || GROUP_NAME =~ options[:security_group].to_s
|
|
430
|
+
raise ArgumentError, "Invalid :instance_type provided." unless blank?(options[:instance_type]) || INSTANCE_TYPE.include?(options[:instance_type].to_s)
|
|
431
|
+
raise ArgumentError, "Invalid :disable_api_termination provided." unless blank?(options[:disable_api_termination]) ||
|
|
432
|
+
BOOLEAN.include?(options[:disable_api_termination].to_s)
|
|
433
|
+
raise ArgumentError, "Invalid :accounting_type provided." unless blank?(options[:accounting_type]) || ACCOUNTING_TYPE.include?(options[:accounting_type].to_s)
|
|
434
|
+
raise ArgumentError, "Invalid :ip_type provided." unless blank?(options[:ip_type]) || IP_TYPE.include?(options[:ip_type].to_s)
|
|
435
|
+
|
|
436
|
+
params = {'Action' => 'ImportInstance'}
|
|
437
|
+
params.merge!(pathlist('SecurityGroup', options[:security_group]))
|
|
438
|
+
params.merge!(opts_to_prms(options, [:instance_type, :disable_api_termination, :instance_id, :ovf, :accounting_type, :ip_type]))
|
|
439
|
+
params.merge!(opts_to_prms(options, [:availability_zone], 'Placement'))
|
|
440
|
+
|
|
441
|
+
return response_generator(params)
|
|
442
|
+
end
|
|
389
443
|
end # end of Base class
|
|
390
444
|
end # end of Cloud module
|
|
391
445
|
end # end of NIFTY module
|
|
@@ -9,6 +9,8 @@ module NIFTY
|
|
|
9
9
|
LOAD_BALANCER_NAME = /^[a-zA-Z0-9]{1,15}$/
|
|
10
10
|
LOAD_BALANCERS_IGNORED_PARAMS = Regexp.union(/AvailabilityZones .member.*/,
|
|
11
11
|
/HealthCheck .Timeout/)
|
|
12
|
+
LOAD_BALANCER_SESSION_STICKINESS_EXPIRATION_PERIOD = ['3', '5', '10', '15', '30']
|
|
13
|
+
LOAD_BALANCER_SORRY_PAGE_STATUS_CODE = ['200', '503']
|
|
12
14
|
|
|
13
15
|
# API「ConfigureHealthCheck」を実行し、指定したロードバランサーのヘルスチェックの設定を変更します。
|
|
14
16
|
# ロードバランサーを指定するためには、ロードバランサー名・ポート番号が必要です。削除済みのロードバランサーを指定した、
|
|
@@ -435,6 +437,182 @@ module NIFTY
|
|
|
435
437
|
|
|
436
438
|
return response_generator(params)
|
|
437
439
|
end
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
# API「UpdateLoadBalancerOption」を実行し、指定したロードバランサーのオプション設定を更新します。
|
|
443
|
+
#
|
|
444
|
+
# 削除済みのロードバランサー名・待ち受けポートを指定した、管理外のロードバランサー名を指定した場合は、エラーが返されます。
|
|
445
|
+
#
|
|
446
|
+
# 各オプションの利用設定がtrueの場合は有効、falseの場合は無効へ更新します。
|
|
447
|
+
#
|
|
448
|
+
# Sorryページオプションを有効にするためには指定するロードバランサーの待ち受けポートが80番である必要があります。
|
|
449
|
+
#
|
|
450
|
+
# @option options [String] :load_balancer_name 変更対象のロードバランサー名(必須)
|
|
451
|
+
# @option options [Integer] :load_balancer_port 変更対象の待ち受けポート(必須)
|
|
452
|
+
# @option options [Integer] :instance_port 変更対象の宛先ポート(必須)
|
|
453
|
+
# @option options [String] :session_stickiness_policy_update セッション固定オプション
|
|
454
|
+
# <Hash> options [Boolean] :enable - セッション固定オプション利用設定
|
|
455
|
+
# <Hash> options [Integer] :expiration_period - セッション保持時間(セッション固定オプションが有効の場合必須)
|
|
456
|
+
# 許可値: 3 | 5 | 10 | 15 | 30
|
|
457
|
+
# @option options [String] :sorry_page_update Sorryページオプション
|
|
458
|
+
# <Hash> options [Boolean] :enable - Sorryページオプション利用設定
|
|
459
|
+
# <Hash> options [Integer] :status_code - レスポンスコード(Sorryページオプションが有効の場合必須)
|
|
460
|
+
# 許可値: 200 | 503
|
|
461
|
+
# @option options [String] :mobile_filter_update 携帯キャリアフィルターオプション
|
|
462
|
+
# <Hash> options [Boolean] :enable - 携帯キャリアフィルターオプション利用設定
|
|
463
|
+
# @return [Hash] レスポンスXML解析結果
|
|
464
|
+
#
|
|
465
|
+
# @example
|
|
466
|
+
# update_load_balancer_option(
|
|
467
|
+
# :load_balancer_name => 'lb0001',
|
|
468
|
+
# :load_balancer_port => 80,
|
|
469
|
+
# :instance_port => 80,
|
|
470
|
+
# :session_stickiness_enable => true,
|
|
471
|
+
# :session_stickiness_expiration_period => 10,
|
|
472
|
+
# :sorry_page_enable => true,
|
|
473
|
+
# :sorry_page_status_code => 200,
|
|
474
|
+
# :mobile_filter_enable => true
|
|
475
|
+
# )
|
|
476
|
+
#
|
|
477
|
+
def update_load_balancer_option( options={} )
|
|
478
|
+
raise ArgumentError, "No :load_balancer_name provided." if blank?(options[:load_balancer_name])
|
|
479
|
+
raise ArgumentError, "Invalid :load_balancer_name provided." unless LOAD_BALANCER_NAME =~ options[:load_balancer_name].to_s
|
|
480
|
+
raise ArgumentError, "No :load_balancer_port provided." if blank?(options[:load_balancer_port])
|
|
481
|
+
raise ArgumentError, "Invalid :load_balancer_port provided." unless blank?(options[:load_balancer_port]) ||
|
|
482
|
+
valid_port?(options[:load_balancer_port])
|
|
483
|
+
raise ArgumentError, "No :instance_port provided." if blank?(options[:instance_port]) && !blank?(options[:load_balancer_port])
|
|
484
|
+
raise ArgumentError, "Invalid :instance_port provided." unless blank?(options[:instance_port]) ||
|
|
485
|
+
valid_port?(options[:instance_port])
|
|
486
|
+
raise ArgumentError, "No :session_stickiness_expiration_period provided." if blank?(options[:session_stickiness_expiration_period]) &&
|
|
487
|
+
!blank?(options[:session_stickiness_enable]) && 'true' == options[:session_stickiness_enable].to_s
|
|
488
|
+
raise ArgumentError, "Invalid :session_stickiness_enable provided." unless blank?(options[:session_stickiness_enable]) ||
|
|
489
|
+
BOOLEAN.include?(options[:session_stickiness_enable].to_s)
|
|
490
|
+
raise ArgumentError, "Invalid :session_stickiness_expiration_period provided." unless blank?(options[:session_stickiness_expiration_period]) ||
|
|
491
|
+
LOAD_BALANCER_SESSION_STICKINESS_EXPIRATION_PERIOD.include?(options[:session_stickiness_expiration_period].to_s)
|
|
492
|
+
raise ArgumentError, "No :sorry_page_status_code provided." if blank?(options[:sorry_page_status_code]) &&
|
|
493
|
+
!blank?(options[:sorry_page_enable]) && 'true' == options[:sorry_page_enable].to_s
|
|
494
|
+
raise ArgumentError, "Invalid :sorry_page_enable provided." unless blank?(options[:sorry_page_enable]) ||
|
|
495
|
+
BOOLEAN.include?(options[:sorry_page_enable].to_s)
|
|
496
|
+
raise ArgumentError, "Invalid :sorry_page_status_code provided." unless blank?(options[:sorry_page_status_code]) ||
|
|
497
|
+
LOAD_BALANCER_SORRY_PAGE_STATUS_CODE.include?(options[:sorry_page_status_code].to_s)
|
|
498
|
+
raise ArgumentError, "Invalid :mobile_filter_enable provided." unless blank?(options[:mobile_filter_enable]) ||
|
|
499
|
+
BOOLEAN.include?(options[:mobile_filter_enable].to_s)
|
|
500
|
+
|
|
501
|
+
params = {
|
|
502
|
+
'Action' => 'UpdateLoadBalancerOption',
|
|
503
|
+
'SessionStickinessOptionUpdate.Enable' => options[:session_stickiness_enable].to_s,
|
|
504
|
+
'SessionStickinessOptionUpdate.ExpirationPeriod' => options[:session_stickiness_expiration_period].to_s,
|
|
505
|
+
'SorryPageOptionUpdate.Enable' => options[:sorry_page_enable].to_s,
|
|
506
|
+
'SorryPageOptionUpdate.StatusCode' => options[:sorry_page_status_code].to_s,
|
|
507
|
+
'MobileFilterOptionUpdate.Enable' => options[:mobile_filter_enable].to_s
|
|
508
|
+
}
|
|
509
|
+
params.merge!(opts_to_prms(options, [:load_balancer_name, :load_balancer_port, :instance_port]))
|
|
510
|
+
|
|
511
|
+
return response_generator(params)
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
# API「SetLoadBalancerListenerSSLCertificate」を実行し、指定したロードバランサーに対してSSL証明書を取り付けます。
|
|
516
|
+
#
|
|
517
|
+
# ロードバランサーを指定するためには、ロードバランサー名・ポート番号が必要です。
|
|
518
|
+
# 削除済みのロードバランサーを指定した、管理外のロードバランサーを指定したなど、無効なロードバランサーを指定した場合は、エラーが返されます。
|
|
519
|
+
#
|
|
520
|
+
# SSL証明書を指定するためには、SSL証明書の発行識別子が必要です。
|
|
521
|
+
# 削除済みのSSL証明書を指定した、管理外のSSL証明書を指定したなど、無効なSSL証明書を指定した場合は、エラーが返されます。
|
|
522
|
+
#
|
|
523
|
+
# 指定したSSL証明書のステータスが「有効」かつ、鍵長が1024bitかつ数量無制限の証明書のみ設定することができます。それ以外のSSL証明書を指定した場合はエラーが返されます。
|
|
524
|
+
#
|
|
525
|
+
# @option options [String] :load_balancer_name 対象のロードバランサー名(必須)
|
|
526
|
+
# @option options [Integer] :load_balancer_port 対象の待ち受けポート(必須)
|
|
527
|
+
# @option options [Integer] :instance_port 対象の宛先ポート(必須)
|
|
528
|
+
# @option options [String] :ssl_certificate_id SSL証明書の発行識別子(必須)
|
|
529
|
+
# @return [Hash] レスポンスXML解析結果
|
|
530
|
+
#
|
|
531
|
+
# @example
|
|
532
|
+
# set_load_balancer_listener_ssl_certificate(:load_balancer_name => 'lb0001', :load_balancer_port => 80, :instance_port => 80, :ssl_certificate_id => 111)
|
|
533
|
+
#
|
|
534
|
+
def set_load_balancer_listener_ssl_certificate( options={} )
|
|
535
|
+
raise ArgumentError, "No :load_balancer_name provided." if blank?(options[:load_balancer_name])
|
|
536
|
+
raise ArgumentError, "Invalid :load_balancer_name provided." unless LOAD_BALANCER_NAME =~ options[:load_balancer_name].to_s
|
|
537
|
+
raise ArgumentError, "No :load_balancer_port provided." if blank?(options[:load_balancer_port])
|
|
538
|
+
raise ArgumentError, "Invalid :load_balancer_port provided." unless blank?(options[:load_balancer_port]) ||
|
|
539
|
+
valid_port?(options[:load_balancer_port])
|
|
540
|
+
raise ArgumentError, "No :instance_port provided." if blank?(options[:instance_port])
|
|
541
|
+
raise ArgumentError, "Invalid :instance_port provided." unless blank?(options[:instance_port]) ||
|
|
542
|
+
valid_port?(options[:instance_port])
|
|
543
|
+
raise ArgumentError, "No :ssl_certificate_id provided." if blank?(options[:ssl_certificate_id])
|
|
544
|
+
|
|
545
|
+
params = {
|
|
546
|
+
'Action' => 'SetLoadBalancerListenerSSLCertificate',
|
|
547
|
+
'SSLCertificateId' => options[:ssl_certificate_id].to_s
|
|
548
|
+
}
|
|
549
|
+
params.merge!(opts_to_prms(options, [:load_balancer_name, :load_balancer_port, :instance_port]))
|
|
550
|
+
|
|
551
|
+
return response_generator(params)
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
# API「UnsetLoadBalancerListenerSSLCertificate」を実行し、指定したロードバランサーに設定されているSSL証明書をはずします。
|
|
555
|
+
#
|
|
556
|
+
# ロードバランサーを指定するためには、ロードバランサー名・ポート番号が必要です。
|
|
557
|
+
# 削除済みのロードバランサーを指定した、管理外のロードバランサーを指定したなど、無効なロードバランサーを指定した場合は、エラーが返されます。
|
|
558
|
+
#
|
|
559
|
+
# SSL証明書が設定されてないロードバランサー名を指定した場合は、エラーが返されます。
|
|
560
|
+
#
|
|
561
|
+
# @option options [String] :load_balancer_name 対象のロードバランサー名(必須)
|
|
562
|
+
# @option options [Integer] :load_balancer_port 対象の待ち受けポート(必須)
|
|
563
|
+
# @option options [Integer] :instance_port 対象の宛先ポート(必須)
|
|
564
|
+
# @return [Hash] レスポンスXML解析結果
|
|
565
|
+
#
|
|
566
|
+
# @example
|
|
567
|
+
# unset_load_balancer_listener_ssl_certificate(:load_balancer_name => 'lb0001', :load_balancer_port => 80, :instance_port => 80)
|
|
568
|
+
#
|
|
569
|
+
def unset_load_balancer_listener_ssl_certificate( options={} )
|
|
570
|
+
raise ArgumentError, "No :load_balancer_name provided." if blank?(options[:load_balancer_name])
|
|
571
|
+
raise ArgumentError, "Invalid :load_balancer_name provided." unless LOAD_BALANCER_NAME =~ options[:load_balancer_name].to_s
|
|
572
|
+
raise ArgumentError, "No :load_balancer_port provided." if blank?(options[:load_balancer_port])
|
|
573
|
+
raise ArgumentError, "Invalid :load_balancer_port provided." unless blank?(options[:load_balancer_port]) ||
|
|
574
|
+
valid_port?(options[:load_balancer_port])
|
|
575
|
+
raise ArgumentError, "No :instance_port provided." if blank?(options[:instance_port])
|
|
576
|
+
raise ArgumentError, "Invalid :instance_port provided." unless blank?(options[:instance_port]) ||
|
|
577
|
+
valid_port?(options[:instance_port])
|
|
578
|
+
|
|
579
|
+
params = {'Action' => 'UnsetLoadBalancerListenerSSLCertificate'}
|
|
580
|
+
params.merge!(opts_to_prms(options, [:load_balancer_name, :load_balancer_port, :instance_port]))
|
|
581
|
+
|
|
582
|
+
return response_generator(params)
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
# API「ClearLoadBalancerSession」を実行し、指定したセッション固定オプションを申し込んでいるロードバランサーのセッション情報を削除します。
|
|
587
|
+
#
|
|
588
|
+
# ロードバランサーを指定するためには、ロードバランサー名・ポート番号が必要です。
|
|
589
|
+
# 削除済みのロードバランサーを指定した、管理外のロードバランサーを指定したなど、無効なロードバランサーを指定した場合は、エラーが返されます。
|
|
590
|
+
#
|
|
591
|
+
# セッション固定オプションを申し込んでいないロードバランサー名を指定した場合は、エラーが返されます。
|
|
592
|
+
#
|
|
593
|
+
# @option options [String] :load_balancer_name 対象のロードバランサー名(必須)
|
|
594
|
+
# @option options [Integer] :load_balancer_port 対象の待ち受けポート(必須)
|
|
595
|
+
# @option options [Integer] :instance_port 対象の宛先ポート(必須)
|
|
596
|
+
# @return [Hash] レスポンスXML解析結果
|
|
597
|
+
#
|
|
598
|
+
# @example
|
|
599
|
+
# clear_load_balancer_session(:load_balancer_name => 'lb0001', :load_balancer_port => 80, :instance_port => 80)
|
|
600
|
+
#
|
|
601
|
+
def clear_load_balancer_session( options={} )
|
|
602
|
+
raise ArgumentError, "No :load_balancer_name provided." if blank?(options[:load_balancer_name])
|
|
603
|
+
raise ArgumentError, "Invalid :load_balancer_name provided." unless LOAD_BALANCER_NAME =~ options[:load_balancer_name].to_s
|
|
604
|
+
raise ArgumentError, "No :load_balancer_port provided." if blank?(options[:load_balancer_port])
|
|
605
|
+
raise ArgumentError, "Invalid :load_balancer_port provided." unless blank?(options[:load_balancer_port]) ||
|
|
606
|
+
valid_port?(options[:load_balancer_port])
|
|
607
|
+
raise ArgumentError, "No :instance_port provided." if blank?(options[:instance_port])
|
|
608
|
+
raise ArgumentError, "Invalid :instance_port provided." unless blank?(options[:instance_port]) ||
|
|
609
|
+
valid_port?(options[:instance_port])
|
|
610
|
+
|
|
611
|
+
params = {'Action' => 'ClearLoadBalancerSession'}
|
|
612
|
+
params.merge!(opts_to_prms(options, [:load_balancer_name, :load_balancer_port, :instance_port]))
|
|
613
|
+
|
|
614
|
+
return response_generator(params)
|
|
615
|
+
end
|
|
438
616
|
end
|
|
439
617
|
end
|
|
440
618
|
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
module NIFTY
|
|
2
|
+
module Cloud
|
|
3
|
+
class Base < NIFTY::Base
|
|
4
|
+
RESOURCES_DATE = /^\d{4}(\/|\-)?\d{2}(\/|\-)?\d{2}$/
|
|
5
|
+
RESOURCES_YEAR_MONTH = /^\d{4}(\/|\-)?\d{2}$/
|
|
6
|
+
|
|
7
|
+
# API「DescribeResources」を実行し、サービスの稼働情報を返却します。
|
|
8
|
+
# コントロールパネル画面のダッシュボードに当たります。
|
|
9
|
+
#
|
|
10
|
+
# @return [Hash] レスポンスXML解析結果
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# describe_resources()
|
|
14
|
+
#
|
|
15
|
+
def describe_resources( options={} )
|
|
16
|
+
params = {'Action' => 'DescribeResources'}
|
|
17
|
+
|
|
18
|
+
return response_generator(params)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# API「DescribeServiceStatus」を実行し、サービスの稼働情報を返却します。
|
|
23
|
+
# コントロールパネル画面のダッシュボードに当たります。
|
|
24
|
+
#
|
|
25
|
+
# @option options [String] :from_date 取得開始日
|
|
26
|
+
# @option options [String] :to_date 取得終了日
|
|
27
|
+
# @return [Hash] レスポンスXML解析結果
|
|
28
|
+
#
|
|
29
|
+
# @example
|
|
30
|
+
# describe_service_status(:from_date => '2012/02/01', :to_date => '2012/02/10')
|
|
31
|
+
#
|
|
32
|
+
def describe_service_status( options={} )
|
|
33
|
+
raise ArgumentError, "Invalid :from_date provided." unless blank?(options[:from_date]) || RESOURCES_DATE =~ options[:from_date].to_s
|
|
34
|
+
raise ArgumentError, "Invalid :to_date provided." unless blank?(options[:to_date]) || RESOURCES_DATE =~ options[:to_date].to_s
|
|
35
|
+
|
|
36
|
+
params = {'Action' => 'DescribeServiceStatus'}
|
|
37
|
+
params.merge!(opts_to_prms(options, [:from_date, :to_date]))
|
|
38
|
+
|
|
39
|
+
return response_generator(params)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# API「DescribeUsage」を実行し、リソースの利用状況を返却します。
|
|
44
|
+
# コントロールパネル画面の料金明細に当たりますが、金額は含まれません。
|
|
45
|
+
#
|
|
46
|
+
# 存在する情報のみ、レスポンス内にタグが生成されます。
|
|
47
|
+
#
|
|
48
|
+
# 取得対象リージョンを設定した場合はサーバー利用情報などそのリージョンに属する個別情報を、
|
|
49
|
+
# 指定しなかった場合はSSL証明書利用情報などリージョン共通情報と東日本リージョンの個別情報を返却します。
|
|
50
|
+
#
|
|
51
|
+
# @option options [String] :year_month 取得対象年月
|
|
52
|
+
# @option options [String] :region 取得対象リージョン
|
|
53
|
+
# @return [Hash] レスポンスXML解析結果
|
|
54
|
+
#
|
|
55
|
+
# @example
|
|
56
|
+
# describe_usage(:year_month => '2011-02', :region => 'east-1')
|
|
57
|
+
#
|
|
58
|
+
def describe_usage( options={} )
|
|
59
|
+
raise ArgumentError, "Invalid :year_month provided." unless blank?(options[:year_month]) || RESOURCES_YEAR_MONTH =~ options[:year_month].to_s
|
|
60
|
+
|
|
61
|
+
params = {'Action' => 'DescribeUsage'}
|
|
62
|
+
params.merge!(opts_to_prms(options, [:year_month, :region]))
|
|
63
|
+
|
|
64
|
+
return response_generator(params)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# API「DescribeUserActivities」を実行し、APIおよびコントロールパネルの利用履歴を返却します。
|
|
69
|
+
# コントロールパネル画面のログ取得に当たります。
|
|
70
|
+
#
|
|
71
|
+
# マルチアカウントの子アカウントでは、自身の利用履歴のみ返却されます。
|
|
72
|
+
# アップロード中のタスク情報を返却します。
|
|
73
|
+
#
|
|
74
|
+
# @option options [String] :year_month 取得対象年月
|
|
75
|
+
# @return [Hash] レスポンスXML解析結果
|
|
76
|
+
#
|
|
77
|
+
# @example
|
|
78
|
+
# describe_user_activities(:year_month => '201101')
|
|
79
|
+
#
|
|
80
|
+
def describe_user_activities( options={} )
|
|
81
|
+
raise ArgumentError, "Invalid :year_month provided." unless blank?(options[:year_month]) || RESOURCES_YEAR_MONTH =~ options[:year_month].to_s
|
|
82
|
+
|
|
83
|
+
params = {'Action' => 'DescribeUserActivities'}
|
|
84
|
+
params.merge!(opts_to_prms(options, [:year_month]))
|
|
85
|
+
|
|
86
|
+
return response_generator(params)
|
|
87
|
+
end
|
|
88
|
+
end # end of Base class
|
|
89
|
+
end # end of Cloud module
|
|
90
|
+
end # end of NIFTY module
|
|
@@ -9,6 +9,8 @@ module NIFTY
|
|
|
9
9
|
SECURITY_GROUPS_IGNORED_PARAMS = Regexp.union(/UserId/,
|
|
10
10
|
/IpPermissions\.\d+\.ToPort/,
|
|
11
11
|
/IpPermissions\.\d+\.Groups\.\d+\.UserId/)
|
|
12
|
+
SECURITY_GROUP_COURSE = ['1', '2']
|
|
13
|
+
NUMERIC = /^[0-9]+$/
|
|
12
14
|
|
|
13
15
|
# API「AuthorizeSecurityGroupIngress」を実行し、指定したファイアウォールグループへ許可ルールを追加します。
|
|
14
16
|
# 許可ルールの上限数を超える場合は、エラーが返されます。
|
|
@@ -333,9 +335,17 @@ module NIFTY
|
|
|
333
335
|
# ファイアウォールグループを指定するためには、ファイアウォールグループ名が必要です。削除済みのファイアウォールグループを指定した、
|
|
334
336
|
# 管理外のファイアウォールグループを指定したなど、無効なファイアウォールグループを指定した場合は、エラーが返されます。
|
|
335
337
|
#
|
|
336
|
-
#
|
|
337
|
-
#
|
|
338
|
-
#
|
|
338
|
+
# ファイアウォールグループの設定情報の更新には、時間がかかることがあります。
|
|
339
|
+
#
|
|
340
|
+
# API「DescribeSecurityGroups」のレスポンス値「groupStatus」でファイアウォールグループのステータスを確認できます。
|
|
341
|
+
# また、ファイアウォールグループのステータスが「適用済み」の場合、更新した情報が正しくファイアウォールグループに反映されているかの確認が必要です。
|
|
342
|
+
# 同じくAPI「DescribeSecurityGroups」のレスポンス値で確認できます。
|
|
343
|
+
#
|
|
344
|
+
# @option options [String] :group_name ファイアウォールグループ名(必須)
|
|
345
|
+
# @option options [String] :group_name_update ファイアウォールグループ名の変更
|
|
346
|
+
# @option options [String] :group_description_update ファイアウォールグループのメモの変更
|
|
347
|
+
# @option options [Integer] :group_log_limit_update ファイアウォールグループのログ取得件数の変更
|
|
348
|
+
# @option options [Boolean] :group_log_filter_net_bios WindowsサーバのBroadcast通信ログの抑止状態
|
|
339
349
|
# @return [Hash] レスポンスXML解析結果
|
|
340
350
|
#
|
|
341
351
|
# @example
|
|
@@ -345,9 +355,54 @@ module NIFTY
|
|
|
345
355
|
raise ArgumentError, "No :group_name provided." if blank?(options[:group_name])
|
|
346
356
|
raise ArgumentError, "Invalid :group_name provided." unless GROUP_NAME =~ options[:group_name].to_s
|
|
347
357
|
raise ArgumentError, "Invalid :group_name_update provided." unless blank?(options[:group_name_update]) || ALPHANUMERIC =~ options[:group_name_update].to_s
|
|
358
|
+
raise ArgumentError, "Invalid :group_log_limit_update provided." unless blank?(options[:group_log_limit_update]) || NUMERIC =~ options[:group_log_limit_update].to_s
|
|
359
|
+
raise ArgumentError, "Invalid :group_log_filter_net_bios provided." unless blank?(options[:group_log_filter_net_bios]) || BOOLEAN.include?(options[:group_log_filter_net_bios].to_s)
|
|
348
360
|
|
|
349
361
|
params = {'Action' => 'UpdateSecurityGroup'}
|
|
350
|
-
params.merge!(opts_to_prms(options, [:group_name, :group_name_update, :group_description_update]))
|
|
362
|
+
params.merge!(opts_to_prms(options, [:group_name, :group_name_update, :group_description_update, :group_log_limit_update, :group_log_filter_net_bios]))
|
|
363
|
+
|
|
364
|
+
return response_generator(params)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
# API「UpdateSecurityGroupOption」を実行し、ファイアウォールのオプション情報を更新します。
|
|
369
|
+
#
|
|
370
|
+
# 利用コースを変更する場合は、注意事項に同意しなければ、エラーが返されます。
|
|
371
|
+
#
|
|
372
|
+
# (※)当該APIはv1.11以降、正常応答では常に応答フィールドreturnにtrueが返されます。
|
|
373
|
+
#
|
|
374
|
+
# @option options [String] :course_update 有償・無償の指定
|
|
375
|
+
# 許可値: 1(無償) | 2(有償)
|
|
376
|
+
# @option options [Boolean] :agreement 注意事項に同意(:course_updateが2の場合は必須)
|
|
377
|
+
# @option options [Integer] :security_group_limit_update ファイアウォールグループ数上限
|
|
378
|
+
# @return [Hash] レスポンスXML解析結果
|
|
379
|
+
#
|
|
380
|
+
# @example
|
|
381
|
+
# update_security_group_option(:course_update => 2, :agreement => true)
|
|
382
|
+
#
|
|
383
|
+
def update_security_group_option( options={} )
|
|
384
|
+
raise ArgumentError, "No :agreement provided." if options[:course_update].to_s == '2' && blank?(options[:agreement])
|
|
385
|
+
raise ArgumentError, "Invalid :course_update provided." unless blank?(options[:course_update]) || SECURITY_GROUP_COURSE.include?(options[:course_update].to_s)
|
|
386
|
+
raise ArgumentError, "Invalid :agreement provided." unless blank?(options[:agreement]) || BOOLEAN.include?(options[:agreement].to_s)
|
|
387
|
+
raise ArgumentError, "Invalid :security_group_limit_update provided." unless blank?(options[:security_group_limit_update]) || NUMERIC =~ options[:security_group_limit_update].to_s
|
|
388
|
+
|
|
389
|
+
params = {'Action' => 'UpdateSecurityGroupOption'}
|
|
390
|
+
params.merge!(opts_to_prms(options, [:course_update, :security_group_limit_update]))
|
|
391
|
+
params.merge!(opts_to_prms(options, [:agreement], 'CourseUpdate'))
|
|
392
|
+
|
|
393
|
+
return response_generator(params)
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
# API「DescribeSecurityGroupOption」を実行し、ファイアウォールのオプション利用情報を取得します。
|
|
398
|
+
#
|
|
399
|
+
# @return [Hash] レスポンスXML解析結果
|
|
400
|
+
#
|
|
401
|
+
# @example
|
|
402
|
+
# describe_security_group_option()
|
|
403
|
+
#
|
|
404
|
+
def describe_security_group_option( options={} )
|
|
405
|
+
params = {'Action' => 'DescribeSecurityGroupOption'}
|
|
351
406
|
|
|
352
407
|
return response_generator(params)
|
|
353
408
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module NIFTY
|
|
2
|
+
module Cloud
|
|
3
|
+
class Base < NIFTY::Base
|
|
4
|
+
ATTRIBUTE = 'test'
|
|
5
|
+
|
|
6
|
+
# API「DescribeUploads」を実行し、アップロード中のタスク情報を返却します。
|
|
7
|
+
#
|
|
8
|
+
# アップロードタスクを指定するためには、タスクIDが必要です。
|
|
9
|
+
#
|
|
10
|
+
# タスクIDを指定した場合、指定したIDのアップロードタスクの情報が返されます。
|
|
11
|
+
# タスクIDを指定しなかった場合は、現在アップロード・インポート中のすべてのタスクが返されます。
|
|
12
|
+
#
|
|
13
|
+
# すでにインポートが完了したタスクやキャンセル済みのタスクなど、無効なタスクIDを指定した場合は、エラーが返されます。
|
|
14
|
+
#
|
|
15
|
+
# @option options [Array<String>] :conversion_task_id タスクID
|
|
16
|
+
# @return [Hash] レスポンスXML解析結果
|
|
17
|
+
#
|
|
18
|
+
# @example
|
|
19
|
+
# describe_uploads(:conversion_task_id => ['d6f1ba72-0a76-4b1d-8421-a4f6089d3d7a', 'd6f1ba72-0a76-4b1d-8421-a4f6089d3d7b'])
|
|
20
|
+
#
|
|
21
|
+
def describe_uploads( options={} )
|
|
22
|
+
params = {'Action' => 'DescribeUploads'}
|
|
23
|
+
params.merge!(pathlist('ConversionTaskId', options[:conversion_task_id]))
|
|
24
|
+
|
|
25
|
+
return response_generator(params)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# API「CancelUpload」を実行し、サーバーインポートの処理をキャンセルします。
|
|
30
|
+
# アップロード済みのVMDKファイルは削除されます。
|
|
31
|
+
#
|
|
32
|
+
# アップロードタスクを指定するためには、タスクIDが必要です。
|
|
33
|
+
# すでにインポートが完了したタスクやキャンセル済みのタスクなど、無効なタスクIDを指定した場合は、エラーが返されます。
|
|
34
|
+
#
|
|
35
|
+
# @option options [String] :conversion_task_id タスクID(必須)
|
|
36
|
+
# @return [Hash] レスポンスXML解析結果
|
|
37
|
+
#
|
|
38
|
+
# @example
|
|
39
|
+
# cancel_upload(:conversion_task_id => 'f6dd8353-eb6b-6b4fd32e4f05')
|
|
40
|
+
#
|
|
41
|
+
def cancel_upload( options={} )
|
|
42
|
+
raise ArgumentError, "No :conversion_task_id provided." if blank?(options[:conversion_task_id])
|
|
43
|
+
|
|
44
|
+
params = {'Action' => 'CancelUpload'}
|
|
45
|
+
params.merge!(opts_to_prms(options, [:conversion_task_id]))
|
|
46
|
+
|
|
47
|
+
return response_generator(params)
|
|
48
|
+
end
|
|
49
|
+
end # end of Base class
|
|
50
|
+
end # end of Cloud module
|
|
51
|
+
end # end of NIFTY module
|
data/lib/NIFTY/version.rb
CHANGED