यहां Apigee Edge से जुड़े दस्तावेज़ देखे जा रहे हैं.
Apigee X से जुड़े दस्तावेज़ पर जाएं. info
वर्शन: 1.4.1
इस कॉन्टेंट में, इस एक्सटेंशन को कॉन्फ़िगर करने और इस्तेमाल करने के बारे में जानकारी दी गई है. एपीआई प्रॉक्सी से इस एक्सटेंशन का इस्तेमाल करने से पहले, आपको ये काम करने होंगे:
अनुमति दें कि GCP का वह सेवा खाता बकेट ऐक्सेस कर सके जो आपके Google Cloud Storage एक्सटेंशन को दिखाता है. इस्तेमाल की जाने वाली भूमिका के बारे में ज़्यादा जानने के लिए, Cloud Storage की भूमिकाएं देखें. Cloud Storage में अनुमतियों के बारे में ज़्यादा जानने के लिए, Identity and Access Management (IAM) की अनुमतियों का इस्तेमाल करना लेख पढ़ें.
सेवा खाते के लिए कुंजी जनरेट करने के लिए, GCP कंसोल का इस्तेमाल करें.
एक्सटेंशन को जोड़ने और कॉन्फ़िगर करने के लिए, कॉन्फ़िगरेशन के रेफ़रंस का इस्तेमाल करते समय, जनरेट हुई कुंजी वाली JSON फ़ाइल के कॉन्टेंट का इस्तेमाल करें.
Cloud Storage के बारे में जानकारी
Cloud Storage, फ़ाइलों को सुरक्षित, टिकाऊ, और ज़रूरत के हिसाब से बढ़ाने वाले स्टोरेज की सेवा है. अगर आपने Cloud Storage का इस्तेमाल करना शुरू ही किया है, तो Cloud Storage के दस्तावेज़ में दिया गया क्विकस्टार्ट आपके लिए मददगार साबित हो सकता है.
सैंपल
यहां दिए गए उदाहरणों में, ExtensionCallout नीति का इस्तेमाल करके, Cloud Storage एक्सटेंशन की कार्रवाइयों के लिए सहायता कॉन्फ़िगर करने का तरीका बताया गया है.
फ़ाइलों की सूची देखना
यहां दिए गए उदाहरण में, एक्सटेंशन की listFiles कार्रवाई, फ़ाइलों की सूची वापस लाती है और उन्हें एक कलेक्शन में दिखाती है. listFiles कार्रवाई में कोई इनपुट पैरामीटर नहीं होता.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ConnectorCallout async="false" continueOnError="false" enabled="true" name="Get-Storage-File-List">
<DisplayName>Get Storage File List</DisplayName>
<Connector>cloud-storage-extension-example</Connector>
<Action>listFiles</Action>
<Input><![CDATA[{}]]></Input>
<Output parsed="false">storage.filelist.retrieved</Output>
</ConnectorCallout>
जवाब की वैल्यू कुछ इस तरह दिखती है:
["example-text.txt","example-image.png"]
यहां दी गई Assign Message नीति, ऊपर दी गई ExtensionCallout नीति से जवाब की वैल्यू वापस लाती है और उसे जवाब के पेलोड में कॉपी करती है.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Storage-File-List">
<DisplayName>Assign Storage File List</DisplayName>
<AssignTo type="response" createNew="false"/>
<Set>
<Payload contentType="application/json">{storage.filelist.retrieved}</Payload>
</Set>
</AssignMessage>
कोई फ़ाइल डाउनलोड करना
यहां दी गई ExtensionCallout नीति, Google Cloud Storage एक्सटेंशन का इस्तेमाल करके, एक सामान्य टेक्स्ट फ़ाइल डाउनलोड करती है. इस फ़ाइल में सिर्फ़ Some example text. लिखा होता है.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ConnectorCallout async="false" continueOnError="false" enabled="true" name="Download-File">
<DisplayName>Download File</DisplayName>
<Connector>cloud-storage-extension-example</Connector>
<Action>downloadFile</Action>
<Input><![CDATA[{"fileName": "example-text.txt"}]]></Input>
<Output>storage.file.retrieved</Output>
</ConnectorCallout>
जवाब की वैल्यू इस तरह दिखती है:
{"content":"Some example text."}
यहां दी गई Assign Message नीति, एक्सटेंशन से मिली वैल्यू को वापस लाती है और उसे जवाब के पेलोड में कॉपी करती है.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Storage-File-List">
<DisplayName>Assign Storage File List</DisplayName>
<AssignTo type="response" createNew="false"/>
<Set>
<Payload contentType="application/json">{storage.file.retrieved}</Payload>
</Set>
</AssignMessage>
साइन किया गया यूआरएल जनरेट करना
यहां दी गई ExtensionCallout नीति, Cloud Storage बकेट से तय की गई फ़ाइल को डाउनलोड करने के लिए, इस एक्सटेंशन का इस्तेमाल करके एक यूआरएल जनरेट करती है. यह फ़ाइल का नाम और वह तारीख पास करती है जिसके बाद यूआरएल की समयसीमा खत्म हो जानी चाहिए और वह काम नहीं करना चाहिए.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ConnectorCallout async="false" continueOnError="false" enabled="true" name="Get-Signed-URL">
<DisplayName>Get Signed URL</DisplayName>
<Connector>cloud-storage-extension-example</Connector>
<Action>generateSignedURL</Action>
<Input><![CDATA[{
"fileName" : "example-text.txt",
"expiresOn" : "2018-08-05"
}]]></Input>
<Output>storage.url.retrieved</Output>
</ConnectorCallout>
एक्सटेंशन की रिटर्न वैल्यू कुछ इस तरह दिखती है.
{"url":"https://storage.googleapis.com/storage-extension-example/example-text.txt?GoogleAccessId=extension-test%40my-test-33333.iam.gserviceaccount.com&Expires=1533427200&Signature=Y1cE1DCHesWeIZILRhdIuDR%2FhzZXZ%2BPeY3J1PUkRiosFYj41itHBWh2%2BTQgH9kI6E8s2mWrVDFU43YR7s8Tm9W5VgWRwh0nXSactQ0xKbkKbGZmCcWxgIscOezc1zc%2Bp7lnXSx1qd4wIlIKVH4KCd9WLx4qB1dLxGNxMKB32tA3dio5IiMXaHEA%2FR2fYc0Pjh45t8L5rilk5pekv7jfd3sfsgdfgfdglkj%2F7E%2FlJ%2B60RnetqV2IDqrc0sVEgSLTpgTbDGU%2Ft3EcitRUFOSdOb5czt7CiIwKAYSmDEFMSNHHiNTWjvLzq4IU%2BCa4Z5aKyvww%3D%3D"}
यहां दी गई Assign Message नीति, एक्सटेंशन से मिली वैल्यू को वापस लाती है और उसे जवाब के मुख्य हिस्से में कॉपी करती है.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Storage-File-URL">
<DisplayName>Assign Storage File URL</DisplayName>
<AssignTo type="response" createNew="false"/>
<Set>
<Payload contentType="application/json">{storage.url.retrieved}</Payload>
</Set>
</AssignMessage>
कार्रवाइयां
downloadFile
तय की गई फ़ाइल डाउनलोड करता है.
अनुरोध के पैरामीटर
| पैरामीटर | ब्यौरा | टाइप | डिफ़ॉल्ट | ज़रूरी है |
|---|---|---|---|---|
| fileName | डाउनलोड की जाने वाली फ़ाइल. | स्ट्रिंग | कोई नहीं. | हां. |
सिंटैक्स
<Input><![CDATA[{"fileName" : "the-file-to-download"}]]></Input>
उदाहरण
<Input><![CDATA[{"fileName" : "example-text.txt"}]]></Input>
जवाब
डाउनलोड की गई फ़ाइल के कॉन्टेंट वाले ऑब्जेक्ट को दिखाने वाला JSON. उदाहरण के लिए:
{"content":"Some example text."}
listFiles
डाउनलोड के लिए उपलब्ध फ़ाइलों की सूची दिखाता है.
अनुरोध के पैरामीटर
कोई नहीं.
जवाब
फ़ाइल के नामों का कलेक्शन. उदाहरण के लिए:
["example-text.txt","example-image.png"]
generateSignedURL
बकेट में मौजूद तय की गई फ़ाइल के लिए, साइन किया गया यूआरएल बनाता है. इस यूआरएल का इस्तेमाल, फ़ाइल डाउनलोड करने के लिए किया जा सकता है.
अनुरोध के पैरामीटर
| पैरामीटर | ब्यौरा | टाइप | डिफ़ॉल्ट | ज़रूरी है |
|---|---|---|---|---|
| fileName | Cloud Storage के उस ऑब्जेक्ट का नाम जिसके लिए साइन किया गया यूआरएल जनरेट करना है. | स्ट्रिंग | कोई नहीं. | हां. |
| expiresOn | वह तारीख जब साइन किए गए यूआरएल की समयसीमा खत्म हो जानी चाहिए. | स्ट्रिंग | कोई नहीं. | नहीं. |
सिंटैक्स
<Input><![CDATA[{
"fileName" : "file-for-which-to-generate-url",
"expiresOn" : "date-to-expire-url"
}]]></Input>
उदाहरण
<Input><![CDATA[{
"fileName" : "example-text.txt",
"expiresOn" : "2018-08-05"
}]]></Input>
जवाब
साइन किए गए यूआरएल वाले ऑब्जेक्ट को दिखाने वाला JSON. उदाहरण के लिए:
{"url":"https://storage.googleapis.com/storage-extension-example/example-text.txt?GoogleAccessId=extension-test%40my-test-33333.iam.gserviceaccount.com&Expires=1533427200&Signature=Y1cE1DCHesWeIZILRhdIuDR%2FhzZXZ%2BPeY3J1PUkRiosFYj41itHBWh2%2BTQgH9kI6E8s2mWrVDFU43YR7s8Tm9W5VgWRwh0nXSactQ0xKbkKbGZmCcWxgIscOezc1zc%2Bp7lnXSx1qd4wIlIKVH4KCd9WLx4qB1dLxGNxMKB32tA3dio5IiMXaHEA%2FR2fYc0Pjh45t8L5rilk5pekv7jfd3sfsgdfgfdglkj%2F7E%2FlJ%2B60RnetqV2IDqrc0sVEgSLTpgTbDGU%2Ft3EcitRUFOSdOb5czt7CiIwKAYSmDEFMSNHHiNTWjvLzq4IU%2BCa4Z5aKyvww%3D%3D"}
कॉन्फ़िगरेशन का रेफ़रंस
एपीआई प्रॉक्सी में इस्तेमाल करने के लिए, इस एक्सटेंशन को कॉन्फ़िगर और डिप्लॉय करते समय, यहां दी गई जानकारी का इस्तेमाल करें. Apigee कंसोल का इस्तेमाल करके, किसी एक्सटेंशन को कॉन्फ़िगर करने के तरीके जानने के लिए, एक्सटेंशन जोड़ना और उसे कॉन्फ़िगर करना लेख पढ़ें.
एक्सटेंशन की सामान्य प्रॉपर्टी
हर प्रॉपर्टी के लिए नीचे दी गई प्रॉपर्टी मौजूद हैं.
| प्रॉपर्टी | जानकारी | डिफ़ॉल्ट | ज़रूरी है |
|---|---|---|---|
name |
वह नाम, जिसे आप एक्सटेंशन का यह कॉन्फ़िगरेशन दे रहे हैं. | कभी नहीं | हां |
packageName |
एक्सटेंशन पैकेज का नाम, जो Apigee Edge से दिया गया है. | कभी नहीं | हां |
version |
उस एक्सटेंशन पैकेज का वर्शन नंबर जिससे आपको एक्सटेंशन कॉन्फ़िगर करना है. | कभी नहीं | हां |
configuration |
आप जिस एक्सटेंशन को जोड़ रहे हैं उसके लिए खास तौर पर कॉन्फ़िगरेशन वैल्यू. इस एक्सटेंशन पैकेज के लिए प्रॉपर्टी देखें | कभी नहीं | हां |
इस एक्सटेंशन पैकेज की प्रॉपर्टी
| प्रॉपर्टी | ब्यौरा | डिफ़ॉल्ट | ज़रूरी है |
|---|---|---|---|
| bucketName | वह GCS बकेट जिसके साथ इस एक्सटेंशन को इंटरैक्ट करना चाहिए. | कोई नहीं. | हां. |