2016-08-15 15 views
0

このURLを使用して、修正を加えてクローンを作成する既存の自動スケールグループを取得しています。サービスポート、ポリシー、リソーストリガー、ウォッチ、アクションに関するすべての情報を持っているようです。SoftLayer REST APIを使用して自動スケールグループを作成する方法

https://api.softlayer.com/rest/v3/SoftLayer_Scale_Group/1120061/getObject.json?objectMask=mask[policies[resourceUseTriggers[watches],actions],loadBalancers]

得られた応答は、以下の "RESPONSE 1" に含まれます。

次に、「IDを削除する」というレスポンスを修正し、それをテンプレートとして使用して新しい自動スケールグループを作成し、新しいリクエストJSONを下の「要求1」に示します。

私は

https://api.softlayer.com/rest/v3/SoftLayer_Scale_Group/createObject.json

私は標準エラーを取得するにPOSTを使用してSOFTLAYERに "REQUEST 1" を提出 - ":(500)内部サーバーエラーリモートサーバーがエラーを返しました。"

私はここで間違って何をしていますか?

私はそれが新しいオートスケールグループを作成すると、コピーペーストのようなので、簡単だと思いますし、いくつかのIDを削除しないでください== REQUEST 1 ==

{ "parameters": [ 

{ 
    "virtualGuestMemberTemplate": { 
    "accountId": 940999, 
    "domain": "partpic.com", 
    "hostname": "CaffeServer-test-001", 
    "maxMemory": 1024, 
    "postInstallScriptUri": "https://webdev.partpic.com/ppsvc/CaffeStartup.aspx?model=Sample.tar.gz", 
    "startCpus": 1, 
    "blockDeviceTemplateGroup": { 
     "globalIdentifier": "fb2fd46d-713a-4d9b-8de1-d47030adc728" 
    }, 
    "datacenter": { 
     "name": "dal06" 
    }, 
    "hourlyBillingFlag": true 
    }, 
    "loadBalancers": [{ 
    "healthCheckId": 609283, 
    "id": 101503, 
    "port": 32400, 
    "virtualServerId": 275643 
    }], 
    "policies": [{ 
    "name": "ScaleDown", 
    "resourceUseTriggers": [{ 
     "typeId": 3, 
     "watches": [{ 
     "algorithm": "EWMA", 
     "metric": "host.cpu.percent", 
     "operator": "<", 
     "period": 1500, 
     "value": "20" 
     }] 
    }], 
    "actions": [{ 
     "typeId": 1, 
     "amount": 80, 
     "scaleType": "PERCENT" 
    }] 
    }, 
    { 
    "name": "ScaleUp", 
    "resourceUseTriggers": [{ 
     "typeId": 3, 
     "watches": [{ 
     "algorithm": "EWMA", 
     "metric": "host.cpu.percent", 
     "operator": ">", 
     "period": 600, 
     "value": "80" 
     }] 
    }], 
    "actions": [{ 
     "typeId": 1, 
     "amount": 150, 
     "scaleType": "PERCENT" 
    }] 
    }], 
    "status": { 
    "id": 1, 
    "keyName": "ACTIVE", 
    "name": "Active" 
    }, 
    "virtualGuestAssets": [], 
    "virtualGuestMembers": [], 
    "accountId": 940999, 
    "cooldown": 60, 
    "name": "scale_test-001", 
    "regionalGroupId": 22, 
    "terminationPolicyId": 1 
} 

]} 

== RESPONSE 1 ==

{ 
    "accountId": 940999, 
    "balancedTerminationFlag": false, 
    "cooldown": 60, 
    "createDate": "2016-08-08T13:19:51-05:00", 
    "desiredMemberCount": null, 
    "id": 1120061, 
    "lastActionDate": "2016-08-12T14:22:51-05:00", 
    "maximumMemberCount": 0, 
    "minimumMemberCount": 0, 
    "modifyDate": "2016-08-12T14:22:57-05:00", 
    "name": "scale_CaffeServerSample", 
    "regionalGroupId": 22, 
    "suspendedFlag": false, 
    "terminationPolicyId": 1, 
    "virtualGuestMemberTemplate": { 
    "accountId": 940999, 
    "createDate": null, 
    "dedicatedAccountHostOnlyFlag": null, 
    "domain": "partpic.com", 
    "hostname": "CaffeServerSample", 
    "id": null, 
    "lastPowerStateId": null, 
    "lastVerifiedDate": null, 
    "maxCpu": null, 
    "maxMemory": 1024, 
    "metricPollDate": null, 
    "modifyDate": null, 
    "postInstallScriptUri": "https:\/\/webdev.partpic.com\/ppsvc\/CaffeStartup.aspx?model=Sample.tar.gz", 
    "provisionDate": null, 
    "startCpus": 1, 
    "statusId": null, 
    "blockDeviceTemplateGroup": { 
     "accountId": null, 
     "createDate": null, 
     "id": null, 
     "parentId": null, 
     "publicFlag": null, 
     "statusId": null, 
     "transactionId": null, 
     "userRecordId": null, 
     "globalIdentifier": "fb2fd46d-713a-4d9b-8de1-d47030adc728" 
    }, 
    "datacenter": { 
     "id": null, 
     "name": "dal06", 
     "statusId": null 
    }, 
    "hourlyBillingFlag": true, 
    "localDiskFlag": false, 
    "privateNetworkOnlyFlag": false 
    }, 
    "loadBalancers": [{ 
    "createDate": "2016-08-12T14:06:07-05:00", 
    "deleteFlag": null, 
    "healthCheckId": 609283, 
    "id": 101503, 
    "modifyDate": "2016-08-12T14:19:33-05:00", 
    "port": 32400, 
    "scaleGroupId": 1120061, 
    "virtualServerId": 274353, 
    "scaleGroup": { 
     "accountId": 940999, 
     "balancedTerminationFlag": false, 
     "cooldown": 60, 
     "createDate": "2016-08-08T13:19:51-05:00", 
     "desiredMemberCount": null, 
     "id": 1120061, 
     "lastActionDate": "2016-08-12T14:22:51-05:00", 
     "maximumMemberCount": 0, 
     "minimumMemberCount": 0, 
     "modifyDate": "2016-08-12T14:22:57-05:00", 
     "name": "scale_CaffeServerSample", 
     "regionalGroupId": 22, 
     "suspendedFlag": false, 
     "terminationPolicyId": 1, 
     "virtualGuestMemberTemplate": { 
     "accountId": 940999, 
     "createDate": null, 
     "dedicatedAccountHostOnlyFlag": null, 
     "domain": "partpic.com", 
     "hostname": "CaffeServerSample", 
     "id": null, 
     "lastPowerStateId": null, 
     "lastVerifiedDate": null, 
     "maxCpu": null, 
     "maxMemory": 1024, 
     "metricPollDate": null, 
     "modifyDate": null, 
     "postInstallScriptUri": "https:\/\/webdev.partpic.com\/ppsvc\/CaffeStartup.aspx?model=Sample.tar.gz", 
     "provisionDate": null, 
     "startCpus": 1, 
     "statusId": null, 
     "blockDeviceTemplateGroup": { 
      "accountId": null, 
      "createDate": null, 
      "id": null, 
      "parentId": null, 
      "publicFlag": null, 
      "statusId": null, 
      "transactionId": null, 
      "userRecordId": null, 
      "globalIdentifier": "fb2fd46d-713a-4d9b-8de1-d47030adc728" 
     }, 
     "datacenter": { 
      "id": null, 
      "name": "dal06", 
      "statusId": null 
     }, 
     "hourlyBillingFlag": true, 
     "localDiskFlag": false, 
     "privateNetworkOnlyFlag": false 
     }, 
     "loadBalancers": null, 
     "policies": [{ 
     "cooldown": null, 
     "createDate": "2016-08-12T14:23:01-05:00", 
     "deleteFlag": null, 
     "id": 174557, 
     "modifyDate": null, 
     "name": "ScaleDown", 
     "scaleGroupId": 1120061, 
     "actions": [{ 
      "createDate": "2016-08-12T14:23:01-05:00", 
      "deleteFlag": null, 
      "id": 166457, 
      "modifyDate": null, 
      "scalePolicyId": 174557, 
      "typeId": 1, 
      "scalePolicy": null, 
      "amount": 80, 
      "scaleType": "PERCENT" 
     }], 
     "resourceUseTriggers": [{ 
      "createDate": "2016-08-12T14:23:01-05:00", 
      "deleteFlag": null, 
      "id": 173005, 
      "modifyDate": null, 
      "scalePolicyId": 174557, 
      "typeId": 3, 
      "scalePolicy": null, 
      "watches": [{ 
      "algorithm": "EWMA", 
      "createDate": "2016-08-12T14:23:01-05:00", 
      "deleteFlag": null, 
      "id": 143505, 
      "metric": "host.cpu.percent", 
      "modifyDate": null, 
      "operator": "<", 
      "period": 1500, 
      "scalePolicyTriggerId": 173005, 
      "value": "20", 
      "scalePolicyTrigger": null 
      }] 
     }], 
     "scaleGroup": null 
     }, 
     { 
     "cooldown": null, 
     "createDate": "2016-08-12T14:22:51-05:00", 
     "deleteFlag": null, 
     "id": 174555, 
     "modifyDate": null, 
     "name": "ScaleUp", 
     "scaleGroupId": 1120061, 
     "actions": [{ 
      "createDate": "2016-08-12T14:23:01-05:00", 
      "deleteFlag": null, 
      "id": 166455, 
      "modifyDate": null, 
      "scalePolicyId": 174555, 
      "typeId": 1, 
      "scalePolicy": null, 
      "amount": 150, 
      "scaleType": "PERCENT" 
     }], 
     "resourceUseTriggers": [{ 
      "createDate": "2016-08-12T14:22:51-05:00", 
      "deleteFlag": null, 
      "id": 173003, 
      "modifyDate": null, 
      "scalePolicyId": 174555, 
      "typeId": 3, 
      "scalePolicy": null, 
      "watches": [{ 
      "algorithm": "EWMA", 
      "createDate": "2016-08-12T14:22:51-05:00", 
      "deleteFlag": null, 
      "id": 143503, 
      "metric": "host.cpu.percent", 
      "modifyDate": null, 
      "operator": ">", 
      "period": 600, 
      "scalePolicyTriggerId": 173003, 
      "value": "80", 
      "scalePolicyTrigger": null 
      }] 
     }], 
     "scaleGroup": null 
     }], 
     "status": { 
     "id": 1, 
     "keyName": "ACTIVE", 
     "name": "Active" 
     }, 
     "virtualGuestAssets": [], 
     "virtualGuestMembers": [] 
    } 
    }], 
    "policies": [{ 
    "cooldown": null, 
    "createDate": "2016-08-12T14:23:01-05:00", 
    "deleteFlag": null, 
    "id": 174557, 
    "modifyDate": null, 
    "name": "ScaleDown", 
    "scaleGroupId": 1120061, 
    "actions": [{ 
     "createDate": "2016-08-12T14:23:01-05:00", 
     "deleteFlag": null, 
     "id": 166457, 
     "modifyDate": null, 
     "scalePolicyId": 174557, 
     "typeId": 1, 
     "scalePolicy": null, 
     "amount": 80, 
     "scaleType": "PERCENT" 
    }], 
    "resourceUseTriggers": [{ 
     "createDate": "2016-08-12T14:23:01-05:00", 
     "deleteFlag": null, 
     "id": 173005, 
     "modifyDate": null, 
     "scalePolicyId": 174557, 
     "typeId": 3, 
     "scalePolicy": null, 
     "watches": [{ 
     "algorithm": "EWMA", 
     "createDate": "2016-08-12T14:23:01-05:00", 
     "deleteFlag": null, 
     "id": 143505, 
     "metric": "host.cpu.percent", 
     "modifyDate": null, 
     "operator": "<", 
     "period": 1500, 
     "scalePolicyTriggerId": 173005, 
     "value": "20", 
     "scalePolicyTrigger": null 
     }] 
    }], 
    "scaleGroup": { 
     "accountId": 940999, 
     "balancedTerminationFlag": false, 
     "cooldown": 60, 
     "createDate": "2016-08-08T13:19:51-05:00", 
     "desiredMemberCount": null, 
     "id": 1120061, 
     "lastActionDate": "2016-08-12T14:22:51-05:00", 
     "maximumMemberCount": 0, 
     "minimumMemberCount": 0, 
     "modifyDate": "2016-08-12T14:22:57-05:00", 
     "name": "scale_CaffeServerSample", 
     "regionalGroupId": 22, 
     "suspendedFlag": false, 
     "terminationPolicyId": 1, 
     "virtualGuestMemberTemplate": { 
     "accountId": 940999, 
     "createDate": null, 
     "dedicatedAccountHostOnlyFlag": null, 
     "domain": "partpic.com", 
     "hostname": "CaffeServerSample", 
     "id": null, 
     "lastPowerStateId": null, 
     "lastVerifiedDate": null, 
     "maxCpu": null, 
     "maxMemory": 1024, 
     "metricPollDate": null, 
     "modifyDate": null, 
     "postInstallScriptUri": "https:\/\/webdev.partpic.com\/ppsvc\/CaffeStartup.aspx?model=Sample.tar.gz", 
     "provisionDate": null, 
     "startCpus": 1, 
     "statusId": null, 
     "blockDeviceTemplateGroup": { 
      "accountId": null, 
      "createDate": null, 
      "id": null, 
      "parentId": null, 
      "publicFlag": null, 
      "statusId": null, 
      "transactionId": null, 
      "userRecordId": null, 
      "globalIdentifier": "fb2fd46d-713a-4d9b-8de1-d47030adc728" 
     }, 
     "datacenter": { 
      "id": null, 
      "name": "dal06", 
      "statusId": null 
     }, 
     "hourlyBillingFlag": true, 
     "localDiskFlag": false, 
     "privateNetworkOnlyFlag": false 
     }, 
     "loadBalancers": [{ 
     "createDate": "2016-08-12T14:06:07-05:00", 
     "deleteFlag": null, 
     "healthCheckId": 609283, 
     "id": 101503, 
     "modifyDate": "2016-08-12T14:19:33-05:00", 
     "port": 32400, 
     "scaleGroupId": 1120061, 
     "virtualServerId": 274353, 
     "scaleGroup": null 
     }], 
     "policies": null, 
     "status": { 
     "id": 1, 
     "keyName": "ACTIVE", 
     "name": "Active" 
     }, 
     "virtualGuestAssets": [], 
     "virtualGuestMembers": [] 
    } 
    }, 
    { 
    "cooldown": null, 
    "createDate": "2016-08-12T14:22:51-05:00", 
    "deleteFlag": null, 
    "id": 174555, 
    "modifyDate": null, 
    "name": "ScaleUp", 
    "scaleGroupId": 1120061, 
    "actions": [{ 
     "createDate": "2016-08-12T14:23:01-05:00", 
     "deleteFlag": null, 
     "id": 166455, 
     "modifyDate": null, 
     "scalePolicyId": 174555, 
     "typeId": 1, 
     "scalePolicy": null, 
     "amount": 150, 
     "scaleType": "PERCENT" 
    }], 
    "resourceUseTriggers": [{ 
     "createDate": "2016-08-12T14:22:51-05:00", 
     "deleteFlag": null, 
     "id": 173003, 
     "modifyDate": null, 
     "scalePolicyId": 174555, 
     "typeId": 3, 
     "scalePolicy": null, 
     "watches": [{ 
     "algorithm": "EWMA", 
     "createDate": "2016-08-12T14:22:51-05:00", 
     "deleteFlag": null, 
     "id": 143503, 
     "metric": "host.cpu.percent", 
     "modifyDate": null, 
     "operator": ">", 
     "period": 600, 
     "scalePolicyTriggerId": 173003, 
     "value": "80", 
     "scalePolicyTrigger": null 
     }] 
    }], 
    "scaleGroup": { 
     "accountId": 940999, 
     "balancedTerminationFlag": false, 
     "cooldown": 60, 
     "createDate": "2016-08-08T13:19:51-05:00", 
     "desiredMemberCount": null, 
     "id": 1120061, 
     "lastActionDate": "2016-08-12T14:22:51-05:00", 
     "maximumMemberCount": 0, 
     "minimumMemberCount": 0, 
     "modifyDate": "2016-08-12T14:22:57-05:00", 
     "name": "scale_CaffeServerSample", 
     "regionalGroupId": 22, 
     "suspendedFlag": false, 
     "terminationPolicyId": 1, 
     "virtualGuestMemberTemplate": { 
     "accountId": 940999, 
     "createDate": null, 
     "dedicatedAccountHostOnlyFlag": null, 
     "domain": "partpic.com", 
     "hostname": "CaffeServerSample", 
     "id": null, 
     "lastPowerStateId": null, 
     "lastVerifiedDate": null, 
     "maxCpu": null, 
     "maxMemory": 1024, 
     "metricPollDate": null, 
     "modifyDate": null, 
     "postInstallScriptUri": "https:\/\/webdev.partpic.com\/ppsvc\/CaffeStartup.aspx?model=Sample.tar.gz", 
     "provisionDate": null, 
     "startCpus": 1, 
     "statusId": null, 
     "blockDeviceTemplateGroup": { 
      "accountId": null, 
      "createDate": null, 
      "id": null, 
      "parentId": null, 
      "publicFlag": null, 
      "statusId": null, 
      "transactionId": null, 
      "userRecordId": null, 
      "globalIdentifier": "fb2fd46d-713a-4d9b-8de1-d47030adc728" 
     }, 
     "datacenter": { 
      "id": null, 
      "name": "dal06", 
      "statusId": null 
     }, 
     "hourlyBillingFlag": true, 
     "localDiskFlag": false, 
     "privateNetworkOnlyFlag": false 
     }, 
     "loadBalancers": [{ 
     "createDate": "2016-08-12T14:06:07-05:00", 
     "deleteFlag": null, 
     "healthCheckId": 609283, 
     "id": 101503, 
     "modifyDate": "2016-08-12T14:19:33-05:00", 
     "port": 32400, 
     "scaleGroupId": 1120061, 
     "virtualServerId": 274353, 
     "scaleGroup": null 
     }], 
     "policies": null, 
     "status": { 
     "id": 1, 
     "keyName": "ACTIVE", 
     "name": "Active" 
     }, 
     "virtualGuestAssets": [], 
     "virtualGuestMembers": [] 
    } 
    }], 
    "status": { 
    "id": 1, 
    "keyName": "ACTIVE", 
    "name": "Active" 
    }, 
    "virtualGuestAssets": [], 
    "virtualGuestMembers": [] 
} 

答えて

0

はこの要求を試してみてください。

{ 
    "parameters": [ 

     { 
      "balancedTerminationFlag": false, 
      "maximumMemberCount": 0, 
      "minimumMemberCount": 0, 
      "cooldown": 60, 
      "name": "scale_test-0012a", 
      "regionalGroupId": 22, 
      "suspendedFlag": false, 
      "terminationPolicyId": 1, 
      "virtualGuestMemberTemplate": { 
       "domain": "partpic.com", 
       "hostname": "CaffeServer-test-001", 
       "maxMemory": 1024, 
       "postInstallScriptUri": "https://webdev.partpic.com/ppsvc/CaffeStartup.aspx?model=Sample.tar.gz", 
       "startCpus": 1, 
       "blockDeviceTemplateGroup": { 
        "globalIdentifier": "fb2fd46d-713a-4d9b-8de1-d47030adc728" 
       }, 
       "datacenter": { 
        "name": "dal06" 
       }, 
       "hourlyBillingFlag": true, 
       "localDiskFlag": false, 
       "privateNetworkOnlyFlag": false 
      }, 
      "loadBalancers": [{ 
       "deleteFlag" : false, 
       "port": 32400, 
       "virtualServerId": 275643, 
       "healthCheck": { 
        "type": { 
         "keyname": "DEFAULT" 
        } 
       } 
      }], 
      "policies": [{ 
       "name": "ScaleDown", 
       "resourceUseTriggers": [{ 
        "watches": [{ 
         "algorithm": "EWMA", 
         "metric": "host.cpu.percent", 
         "operator": "<", 
         "period": 1500, 
         "value": "20" 
        }] 
       }], 
       "scaleActions": [{ 
        "amount": 80, 
        "scaleType": "PERCENT" 
       }] 
      }, { 
       "name": "ScaleUp", 
       "resourceUseTriggers": [{ 
        "typeId": 3, 
        "watches": [{ 
         "algorithm": "EWMA", 
         "metric": "host.cpu.percent", 
         "operator": ">", 
         "period": 600, 
         "value": "80" 
        }] 
       }], 
       "scaleActions": [{ 
        "amount": 150, 
        "scaleType": "PERCENT" 
       }] 
      }] 
     } 

    ] 
} 
+0

私はそれを動作させるために「virtualServiceId」への1つの小さな変更を加える必要はなく、それは作業を行います。ご協力いただきありがとうございます。 –

関連する問題