It is important to note here that James Shirley was known more for his dramatic works than for his poetic works. That being said, however, it is lucky to have had a college professor who spoke on this very thing, especially in reference to the pastoral.
Most scholars associate this poem with Shirley's usual adherence to the traditional and the orthodox, as he always shies away from licentiousness and rebellion, even the Puritan type of rebellion.
His antilicentiousness links him to the Elizabethans more closely than to the Restoration playwrights, for though his plays are not homiletic, he rewards virtue and encourages reformation.
In regards to the connection to politics, one can make a point to connect this strangely pastoral poem to Shirley's involvement in the English Civil War, on the Royalist side against Oliver Cromwell (that is to say, against Puritanism). The main point is in the first stanza:
This Garden does not take my eyes,
Though here you show how art of men
Can purchase Nature at a price
Would stock old Paradise again.
To what could this refer? Let's apply two connected theories. Oliver Cromwell and cronies taking over the Parliament and/or the Puritans shutting down the theaters. Let's start here, though: the literal meaning would be a large garden purchased and forbidden to anyone other than the buyer. This "garden" used to be something shared and loved by everyone, but now is forbidden. As a result, the speaker is forced to move elsewhere.
Give me a little plot of ground,
Where might I with the Sun agree,
Though every day he walk the round,
My Garden he should seldom see.
This new "Garden" prefaced significantly with the word "My," is hidden from the original purchaser (or thief) and is capable of just as much beauty as the original. I kind of think of it as a simple idea of, "You may be able to take our theaters or our government, but you cannot take our souls!" In this regards, the original "Garden" can be seen as Royal England (under the reign of kings and queens) that supports drama. Further, "My Garden" can be seen as James Shirley's continuation of his work even after the Puritans closed all of the theaters (and/or Cromwell taking over Parliament), taking away Shirley's means of livelihood.
How long will this loyalty last? Until death.
Upon whose death I'll try to write
An epitaph in some funeral stone
Yes, this is about the proverbial "lover" that Shirley speaks entering into the poem later on, but he does admit "it may invite / my self to die, and prove mine own."
Thus, what a strange connection against Cromwell and Puritanism is in this poem! Remember, in living his life mostly during the seventeenth century, James Shirley had a definite feeling against the rebellion of Puritanism and Oliver Cromwell that was going on. Whether he considered drama a worthy art (which he probably did) or whether he was simply protecting his livelihood is not known, but what is known is that James Shirley was going to cultivate his own "Garden" and never give up on the Royal Crown nor on the patronage of the dramatists involved in creating entertainment for those very royals.